You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Fix errors in tutorial/instrumenting HTTP server #2815
I compared the tutorial prose in docs/tutorials/instrumenting_http_server_in_go.md against the sample code on current main (605cf81). Three statements still contradict the code:
L87: "The prometheus.MustRegister function registers the pingCounter with the default registry." — the sample code doesn't call MustRegister anywhere; main() creates a custom registry (reg := prometheus.NewRegistry(), L78/L128) and the counter is registered through promauto.With(reg) (L53/L111).
L89: "promhttp.Handler() provides an http.Handler which exposes the metrics registered in the default registry." — the code uses promhttp.HandlerFor(reg, promhttp.HandlerOpts{}) (L82/L132), which serves the custom registry, not the default one.
L150: "The default registry comes with a collector for Go runtime metrics, and that is why we see other metrics like go_threads, go_goroutines, etc." — a bare prometheus.NewRegistry() starts empty and no Go collector is registered in the sample, so running the tutorial as written only exposes ping_request_count. The go_*/promhttp_* series in ping_metric.png look like they date from before the tutorial switched to a custom registry (292bc32).
Is fixing these three sentences the remaining scope of this issue, or was the grammar-only pass #2824 considered sufficient? Happy to put together a PR if it's still wanted.
Activity
docs: fix stale explanation in instrumenting HTTP server tutorial
santhiprakash commentedon Oct 1, 2026
I compared the tutorial prose in
docs/tutorials/instrumenting_http_server_in_go.mdagainst the sample code on currentmain(605cf81). Three statements still contradict the code:L87: "The
prometheus.MustRegisterfunction registers the pingCounter with the default registry." — the sample code doesn't callMustRegisteranywhere;main()creates a custom registry (reg := prometheus.NewRegistry(), L78/L128) and the counter is registered throughpromauto.With(reg)(L53/L111).L89: "
promhttp.Handler()provides anhttp.Handlerwhich exposes the metrics registered in the default registry." — the code usespromhttp.HandlerFor(reg, promhttp.HandlerOpts{})(L82/L132), which serves the custom registry, not the default one.L150: "The default registry comes with a collector for Go runtime metrics, and that is why we see other metrics like
go_threads,go_goroutines, etc." — a bareprometheus.NewRegistry()starts empty and no Go collector is registered in the sample, so running the tutorial as written only exposesping_request_count. Thego_*/promhttp_*series inping_metric.pnglook like they date from before the tutorial switched to a custom registry (292bc32).Is fixing these three sentences the remaining scope of this issue, or was the grammar-only pass #2824 considered sufficient? Happy to put together a PR if it's still wanted.