From ae09016e747e07c3b0cd97b22b2ffc9391a66ac2 Mon Sep 17 00:00:00 2001 From: Saihgax Date: Fri, 9 Jan 2026 14:47:20 +0530 Subject: [PATCH] docs: document using client_golang with OpenTelemetry (OTLP) --- README.md | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/README.md b/README.md index 7ad4fc0b2..a3228602c 100644 --- a/README.md +++ b/README.md @@ -48,6 +48,42 @@ The [`examples` directory](https://github.com/prometheus/client_golang/tree/main/examples) contains simple examples of instrumented code. +## Using client_golang with OpenTelemetry (OTLP) + +Applications instrumented with `client_golang` can be integrated into +OpenTelemetry-based observability pipelines by using the OpenTelemetry +Collector as a bridge. + +In this setup: +- Applications expose Prometheus metrics using `client_golang` +- The OpenTelemetry Collector scrapes the Prometheus endpoint +- Metrics are exported using the OTLP protocol to a compatible backend + +This approach allows existing Prometheus instrumentation to be reused +without modifying application code. + +### Example OpenTelemetry Collector configuration + +```yaml +receivers: + prometheus: + config: + scrape_configs: + - job_name: "app" + static_configs: + - targets: ["localhost:2112"] + +exporters: + otlp: + endpoint: "" + +service: + pipelines: + metrics: + receivers: [prometheus] + exporters: [otlp] +``` + ## Client for the Prometheus HTTP API [![Go Reference](https://pkg.go.dev/badge/github.com/prometheus/client_golang/api.svg)](https://pkg.go.dev/github.com/prometheus/client_golang/api)