From 8fe2bfc4755d29f40bdde05fd041b78de4cb36dc Mon Sep 17 00:00:00 2001 From: hd <63141252+hnrydvd@users.noreply.github.com> Date: Sun, 1 Nov 2026 01:13:37 -0400 Subject: [PATCH] docs: fix outdated go get link and handler wording in Go guide The installation step linked to a pre-modules article about the go command. Point it at the module-aware go get reference instead, as suggested by machine424 in the review of #2563. Also make the prose match the code on the page: both examples use promhttp.HandlerFor with a custom registry, not promhttp.Handler; the first example exposes Go and process metrics; and the second example exposes only its custom counter. Refs #2556 Assisted-by: Claude Opus 5.5 Signed-off-by: hd <63141252+hnrydvd@users.noreply.github.com> --- docs/guides/go-application.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/guides/go-application.md b/docs/guides/go-application.md index f1a709571..45f3ca975 100644 --- a/docs/guides/go-application.md +++ b/docs/guides/go-application.md @@ -9,7 +9,7 @@ NOTE: For comprehensive API documentation, see the [GoDoc](https://godoc.org/git ## Installation -You can install the `prometheus`, `promauto`, and `promhttp` libraries necessary for the guide using [`go get`](https://golang.org/doc/articles/go_command.html): +You can install the `prometheus`, `promauto`, and `promhttp` libraries necessary for the guide using [`go get`](https://go.dev/ref/mod#go-get): ```bash go get github.com/prometheus/client_golang/prometheus @@ -19,7 +19,7 @@ go get github.com/prometheus/client_golang/prometheus/promhttp ## How Go exposition works -To expose Prometheus metrics in a Go application, you need to provide a `/metrics` HTTP endpoint. You can use the [`prometheus/promhttp`](https://godoc.org/github.com/prometheus/client_golang/prometheus/promhttp) library's HTTP [`Handler`](https://godoc.org/github.com/prometheus/client_golang/prometheus/promhttp#Handler) as the handler function. +To expose Prometheus metrics in a Go application, you need to provide a `/metrics` HTTP endpoint. You can use the [`prometheus/promhttp`](https://godoc.org/github.com/prometheus/client_golang/prometheus/promhttp) library's [`HandlerFor`](https://godoc.org/github.com/prometheus/client_golang/prometheus/promhttp#HandlerFor) function to create an HTTP handler for a metrics registry. This minimal application, for example, would expose the default metrics for Go applications via `http://localhost:2112/metrics`: @@ -59,7 +59,7 @@ curl http://localhost:2112/metrics ## Adding your own metrics -The application [above](#how-go-exposition-works) exposes only the default Go metrics. You can also register your own custom application-specific metrics. This example application exposes a `myapp_processed_ops_total` [counter](/docs/concepts/metric_types/#counter) that counts the number of operations that have been processed thus far. Every 2 seconds, the counter is incremented by one. +The application [above](#how-go-exposition-works) exposes only the default Go and process metrics. You can also register your own custom application-specific metrics. This example application exposes a `myapp_processed_ops_total` [counter](/docs/concepts/metric_types/#counter) that counts the number of operations that have been processed thus far. Every 2 seconds, the counter is incremented by one. ```go package main @@ -143,4 +143,4 @@ In this guide we covered just a small handful of features available in the Prome ## Summary -In this guide, you created two sample Go applications that expose metrics to Prometheus---one that exposes only the default Go metrics and one that also exposes a custom Prometheus counter---and configured a Prometheus instance to scrape metrics from those applications. +In this guide, you created two sample Go applications that expose metrics to Prometheus---one that exposes the default Go and process metrics and one that exposes a custom Prometheus counter---and configured a Prometheus instance to scrape metrics from those applications.