Skip to content

docs: fix stale explanation in instrumenting HTTP server tutorial - #3074

Open
santhiprakash wants to merge 1 commit into
prometheus:mainfrom
santhiprakash:fix-tutorial-stale-explanation
Open

docs: fix stale explanation in instrumenting HTTP server tutorial#3074
santhiprakash wants to merge 1 commit into
prometheus:mainfrom
santhiprakash:fix-tutorial-stale-explanation

Conversation

@santhiprakash

Copy link
Copy Markdown
Contributor

Problem

The explanation paragraph in the Go instrumenting tutorial still references
MustRegister, promhttp.Handler(), and the "default registry" — none of
which 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:

  • The Help text says "No of request" in the full sample code but "No of
    requests" in the incremental code block above.
  • The text claims Go runtime metrics appear because "the default registry comes
    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

  • Update the explanation paragraph to reference promauto.With(reg),
    promhttp.HandlerFor(reg, ...), and "custom registry" — matching the
    actual code.
  • Fix the Help text inconsistency: "No of request" → "No of requests" in
    the full sample code.
  • Replace the misleading Go runtime metrics claim with an accurate note that
    the custom registry does not include them by default and how to add them.

Verification

  • Diff read against upstream/main (12e2edf).
  • Verified all changed prose references functions and patterns that exist in
    the code blocks on the same page.
  • Cross-checked the git history: commit 292bc32 (Nov 2022) introduced the
    custom registry code but left the old prose untouched.

Notes

  • The screenshot showing Go runtime metrics (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.

- 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>
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.

1 participant