Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

"Capture group reference appears to be unused" with integer names

Aperta
#581 1 commento 1 reazione 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
go
Ambito
observability

Direzione di ricerca

Inizia in checker.go, in particolare dall'avviso riportato in checker.go:253, e riproduci il problema con il programma nginx.mtail e i riferimenti ai gruppi di cattura mostrati qui. Traccia il modo in cui i gruppi di cattura denominati e numerici vengono raccolti e associati, quindi verifica che gli avvisi identifichino solo i gruppi effettivamente inutilizzati e non segnalino più erroneamente i riferimenti numerici.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

bug mtail-Language/VM

Hello,
I have noticed checker.go using integers to reference unused capture groups (together with the expected names). I can't quite understand why since AFAICS all capture groups are named with strings, this is the program I'm testing:

counter nginx_http_requests by host, vhost, method, code
counter nginx_http_requests_cache by host, vhost, cache_status

/(?P<hostname>[-0-9A-Za-z._:]+) nginx_access: (?P<vhost>[-0-9A-Za-z._:]+) \S+ (?P<remote_addr>[0-9a-f\.:]+) - - \[[^\]]+\] "(?P<request_method>[A-Z]+) (?P<request_uri>\S+) (?P<http_version>HTTP\/[0-9\.]+)" (?P<status>\d{3}) ((?P<response_size>\d+)|-) "[^"]*" "[^"]*" ([-0-9A-Za-z._:]+) ((?P<ups_resp_seconds>\d+\.\d+)|-) (?P<request_seconds>\d+)\.(?P<request_milliseconds>\d+) (?P<cache_status>\S+)/ {

  nginx_http_requests[$hostname][$vhost][$request_method][$status]++
  nginx_http_requests_cache[$hostname][$vhost][$cache_status]++
}

And rc47 shows this output:

mtail[367499]: I0905 15:15:34.294884  367499 main.go:114] mtail version 3.0.0-rc47 git revision 5e0099f843e4e4f2b7189c21019de18eb49181bf go version go1.16.5 go arch amd64 go os linux
mtail[367499]: I0905 15:15:34.295490  367499 main.go:115] Commandline: ["/usr/bin/mtail" "--progs" "/etc/mtail" "--logtostderr" "--port" "3903" "--poll_interval" "0" "--logs" "/dev/fd/3"] 
mtail[367499]: I0905 15:15:34.295633  367499 main.go:145] no poll interval specified; defaulting to 250ms poll
mtail[367499]: I0905 15:15:34.296227  367499 store.go:182] Starting metric store expiry loop every 1h0m0s
mtail[367499]: I0905 15:15:34.296629  367499 checker.go:253] capture group reference `http_version' at nginx.mtail:4:1-399 appears to be unused
mtail[367499]: I0905 15:15:34.296644  367499 checker.go:253] capture group reference `request_seconds' at nginx.mtail:4:1-399 appears to be unused
mtail[367499]: I0905 15:15:34.296648  367499 checker.go:253] capture group reference `request_milliseconds' at nginx.mtail:4:1-399 appears to be unused
mtail[367499]: I0905 15:15:34.296652  367499 checker.go:253] capture group reference `request_uri' at nginx.mtail:4:1-399 appears to be unused
mtail[367499]: I0905 15:15:34.296655  367499 checker.go:253] capture group reference `ups_resp_seconds' at nginx.mtail:4:1-399 appears to be unused
mtail[367499]: I0905 15:15:34.296658  367499 checker.go:253] capture group reference `remote_addr' at nginx.mtail:4:1-399 appears to be unused
mtail[367499]: I0905 15:15:34.296661  367499 checker.go:253] capture group reference `remote_addr' at nginx.mtail:4:1-399 appears to be unused
mtail[367499]: I0905 15:15:34.296664  367499 checker.go:253] capture group reference `request_uri' at nginx.mtail:4:1-399 appears to be unused
mtail[367499]: I0905 15:15:34.296668  367499 checker.go:253] capture group reference `response_size' at nginx.mtail:4:1-399 appears to be unused
mtail[367499]: I0905 15:15:34.296671  367499 checker.go:253] capture group reference `response_size' at nginx.mtail:4:1-399 appears to be unused
mtail[367499]: I0905 15:15:34.296674  367499 checker.go:253] capture group reference `request_seconds' at nginx.mtail:4:1-399 appears to be unused
mtail[367499]: I0905 15:15:34.296677  367499 checker.go:253] capture group reference `http_version' at nginx.mtail:4:1-399 appears to be unused
mtail[367499]: I0905 15:15:34.296680  367499 checker.go:253] capture group reference `8' at nginx.mtail:4:1-399 appears to be unused
mtail[367499]: I0905 15:15:34.296683  367499 checker.go:253] capture group reference `request_milliseconds' at nginx.mtail:4:1-399 appears to be unused
mtail[367499]: I0905 15:15:34.296687  367499 checker.go:253] capture group reference `10' at nginx.mtail:4:1-399 appears to be unused
mtail[367499]: I0905 15:15:34.296690  367499 checker.go:253] capture group reference `ups_resp_seconds' at nginx.mtail:4:1-399 appears to be unused
mtail[367499]: I0905 15:15:34.296693  367499 checker.go:253] capture group reference `11' at nginx.mtail:4:1-399 appears to be unused
mtail[367499]: I0905 15:15:34.296764  367499 runtime.go:188] Loaded program nginx.mtail
mtail[367499]: I0905 15:15:34.296775  367499 runtime.go:84] unmarking nginx.mtail 
mtail[367499]: I0905 15:15:34.296780  367499 runtime.go:84] unmarking systemd.mtail_
mtail[367499]: I0905 15:15:34.296812  367499 logstream.go:61] Parsed url as /dev/fd/3
mtail[367499]: I0905 15:15:34.296833  367499 tail.go:282] Tailing /dev/fd/3
mtail[367499]: I0905 15:15:34.297620  367499 mtail.go:126] Listening on [::]:3903

Specifically capture groups 8 / 10 / 11

Thank you !

Lingua principale
Go
Stelle
4k
Fork
394
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di google/mtail

Tutte le issue di google/mtail

Issue simili

Altre issue su Go

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.