grafana / agent

Vendor-neutral programmable observability pipelines.
https://grafana.com/docs/agent/
Apache License 2.0
1.57k stars 478 forks source link

Conflicting router patterns when built with Go 1.23 #6972

Open stefanb opened 1 week ago

stefanb commented 1 week ago

What's wrong?

Conflicting patterns detected when built with Go 1.23


$ grafana-agent --version
  panic: pattern "GET /debug/pprof/" (registered at net/http/pprof/pprof.go:100) conflicts with pattern "/debug/pprof/delta_heap" (registered at github.com/grafana/pyroscope-go/godeltaprof@v0.1.7/http/pprof/pprof.go:24):
    GET /debug/pprof/ matches fewer methods than /debug/pprof/delta_heap, but has a more general path pattern

Steps to reproduce

When runing the tests for https://github.com/Homebrew/homebrew-core/pull/175310 the Grafana agent test failed with:

  ==> Testing grafana-agent
  ==> /opt/homebrew/Cellar/grafana-agent/0.41.1/bin/grafana-agent --version
  panic: pattern "GET /debug/pprof/" (registered at net/http/pprof/pprof.go:100) conflicts with pattern "/debug/pprof/delta_heap" (registered at github.com/grafana/pyroscope-go/godeltaprof@v0.1.7/http/pprof/pprof.go:24):
    GET /debug/pprof/ matches fewer methods than /debug/pprof/delta_heap, but has a more general path pattern

  goroutine 1 [running]:
  net/http.(*ServeMux).register(...)
    net/http/server.go:2805
  net/http.HandleFunc({0x14000074e70?, 0x10587ac8a?}, 0x107723ea0?)
    net/http/server.go:2799 +0x9c
  net/http/pprof.init.0()
    net/http/pprof/pprof.go:100 +0x94

System information

All, irrelevant

Software version

Grafana Agent v0.41.1

Configuration

No response

Logs

No response

stefanb commented 1 week ago

There were some changes in the routing patterns according to https://tip.golang.org/doc/go1.23#nethttppkgnethttp

The patterns used by ServeMux now allow one or more spaces or tabs after the method name. Previously, only a single space was permitted.

...but this should not cause such error.