Skip to content

docs: fix Prometheus README snippet, remove nonexistent NewHandler() - #230

Merged
kevinburkesegment merged 1 commit into
mainfrom
fix-prometheus-readme-newhandler
Sep 9, 2026
Merged

docs: fix Prometheus README snippet, remove nonexistent NewHandler()#230
kevinburkesegment merged 1 commit into
mainfrom
fix-prometheus-readme-newhandler

Conversation

@kinghorn-twilio

Copy link
Copy Markdown
Contributor

Summary

  • The Prometheus section's usage snippet calls prometheus.NewHandler(), which doesn't exist and never has (checked back through v4.7.2). Handler is a plain struct with no constructor.
  • Root cause: this section was added in 7e7070d alongside the OTLP exporter and looks like a copy-paste from otlp.NewHandler, a real constructor on that subpackage.
  • Fixed to use the package's own zero-config DefaultHandler, with a note that a &prometheus.Handler{} literal works too if you need to set TrimPrefix/MetricTimeout/Buckets.

Test plan

  • Confirmed DefaultHandler and the Handler struct/fields exist as described, via handler.go and handler_test.go
  • Docs-only change, no code affected

Handler has never had a NewHandler constructor at any version (confirmed
back through v4.7.2) -- it's a plain struct, used via a literal or the
package's own DefaultHandler var. This snippet was added in 7e7070d
alongside the OTLP exporter and appears to be a copy-paste from
otlp.NewHandler (a real constructor on that subpackage). Anyone following
the README as written gets a compile error.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

@kevinburkesegment kevinburkesegment left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you

@kevinburkesegment
kevinburkesegment merged commit d837bac into main Sep 9, 2026
14 checks passed
@kevinburkesegment
kevinburkesegment deleted the fix-prometheus-readme-newhandler branch September 9, 2026 21:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants