docs: fix stale explanation in instrumenting HTTP server tutorial - #3074
Open
santhiprakash wants to merge 1 commit into
Open
docs: fix stale explanation in instrumenting HTTP server tutorial#3074santhiprakash wants to merge 1 commit into
santhiprakash wants to merge 1 commit into
Conversation
- Problem: explanation paragraph references MustRegister, promhttp.Handler(),
and 'default registry' — none of which are used in the code (changed to
custom registry in Nov 2022). Also claims Go runtime metrics appear because
of the 'default registry' collector, but the code uses prometheus.NewRegistry()
which does not include them.
- Fix: update the prose to match the actual code (promauto.With(reg),
promhttp.HandlerFor, custom registry). Fix Help text inconsistency
('request' vs 'requests' between code blocks). Replace the misleading
Go runtime metrics claim with an accurate note about custom registries.
- Verification: diff read against upstream/main (12e2edf). Fixes prometheus#2815.
Signed-off-by: Santhi Prakash <b.santhiprakash@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The explanation paragraph in the Go instrumenting tutorial still references
MustRegister,promhttp.Handler(), and the "default registry" — none ofwhich appear in the code. The code was changed to use
prometheus.NewRegistry()(custom registry) in Nov 2022 (commit 292bc32), but the surrounding prose was
never updated. Subsequent grammar fixes (PR #2824, merged) cleaned up style but
left the stale API references intact.
Additionally:
requests" in the incremental code block above.
with a collector," but the code uses a custom registry that does not include
them.
Partially addresses #2815 (PR #2824 fixed grammar but these correctness issues
remained).
Fix
promauto.With(reg),promhttp.HandlerFor(reg, ...), and "custom registry" — matching theactual code.
the full sample code.
the custom registry does not include them by default and how to add them.
Verification
upstream/main(12e2edf).the code blocks on the same page.
custom registry code but left the old prose untouched.
Notes
go_threads,go_goroutines)predates the custom-registry change and is now slightly misleading. An
updated screenshot would be ideal but is out of scope for this text-only fix.