MCPcopy Create free account
hub / github.com/prometheus/client_golang

github.com/prometheus/client_golang

Chat with this repo
repository ↗ · DeepWiki ↗ · release v1.25.0 ↗ · + Follow · compare 5 versions
1,586 symbols 6,290 edges 162 files ⚖ custom 634 documented · 40% ● updated 2d agov1.25.0 · 2026-10-08★ 6,05183 open issues

Browse by type

⨍ Functions 1,307◇ Types & classes 279
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Prometheus Go client library

Go Reference OpenSSF Scorecard Slack

This is the Go client library for Prometheus. It has two separate parts, one for instrumenting application code, and one for creating clients that talk to the Prometheus HTTP API.

Version Compatibility

This library supports the two most recent major releases of Go. While it may function with older versions, we only provide fixes and support for the currently supported Go releases.

[!NOTE] See our Release Process for details on compatibility and support policies.

Important note about releases and stability

This repository generally follows Semantic Versioning. However, the API client in prometheus/client_golang/api/… is still considered experimental. Breaking changes of the API client will not trigger a new major release. The same is true for selected other new features explicitly marked as EXPERIMENTAL in CHANGELOG.md.

Features that require breaking changes in the stable parts of the repository are being batched up and tracked in the v2 milestone, but plans for further development of v2 at the moment.

NOTE: The initial v2 attempt is in a separate branch. We also started experimenting on a new prometheus.V2.* APIs in the 1.x's V2 struct. Help wanted!

Instrumenting applications

Go Reference

The prometheus directory contains the instrumentation library. See the guide on the Prometheus website to learn more about instrumenting applications.

The examples directory contains simple examples of instrumented code.

Pushing metrics via OpenTelemetry OTLP

Applications instrumented with client_golang can also export their metrics via the OpenTelemetry OTLP push protocol without re-instrumenting against a different metric API. The go.opentelemetry.io/contrib/bridges/prometheus module wraps a prometheus.Registry as an OpenTelemetry metric producer, which an OTLP exporter (HTTP or gRPC) can then push to an OTel collector or OTLP-accepting backend. This is useful for batch jobs or environments where pull-based /metrics scraping is not an option.

Pull-based collection via promhttp remains the recommended default for reliability, central discovery, and failover. The bridge is intended as an additional option, not a replacement.

See the bridge's Go reference and source for setup details.

Client for the Prometheus HTTP API

Go Reference

The api/prometheus directory contains the client for the Prometheus HTTP API. It allows you to write Go applications that query time series data from a Prometheus server. It is still in alpha stage.

Where is model, extraction, and text?

The model packages has been moved to prometheus/common/model.

The extraction and text packages are now contained in prometheus/common/expfmt.

Contributing and community

See the contributing guidelines and the Community section of the homepage.

client_golang community is also present on the CNCF Slack #prometheus-client_golang.

Extension points exported contracts — how you extend this code

browse all types & interfaces →

Core symbols most depended-on inside this repo

browse all functions →

Shape

Function 716
Method 591
Struct 190
TypeAlias 41
Interface 33
FuncType 15

Languages

Go100%
C1%

Modules by API surface

api/prometheus/v1/api.go119 symbols
exp/api/remote/genproto/v2/types.pb.go108 symbols
prometheus/histogram.go67 symbols
exp/api/remote/genproto/v2/types_vtproto.pb.go47 symbols
prometheus/registry.go46 symbols
exp/api/remote/remote_api.go42 symbols
prometheus/summary.go40 symbols
prometheus/vec.go38 symbols
prometheus/promhttp/http_test.go38 symbols
prometheus/histogram_test.go36 symbols
prometheus/promhttp/instrument_server_test.go33 symbols
prometheus/vec_test.go32 symbols

Dependencies from manifests, versioned

cloud.google.com/go/authv0.20.0 · 1×
cloud.google.com/go/auth/oauth2adaptv0.2.8 · 1×
cloud.google.com/go/compute/metadatav0.9.0 · 1×
github.com/Azure/azure-sdk-for-go/sdk/azcorev1.22.0 · 1×
github.com/Azure/azure-sdk-for-go/sdk/azidentityv1.14.0 · 1×
github.com/Azure/azure-sdk-for-go/sdk/internalv1.12.0 · 1×
github.com/AzureAD/microsoft-authentication-library-for-gov1.7.2 · 1×
github.com/alecthomas/unitsv0.0.0-2024092700094 · 1×
github.com/aws/aws-sdk-go-v2v1.42.0 · 1×
github.com/aws/aws-sdk-go-v2/configv1.32.25 · 1×
github.com/aws/aws-sdk-go-v2/credentialsv1.19.24 · 1×
github.com/aws/aws-sdk-go-v2/feature/ec2/imdsv1.18.29 · 1×

For agents

$ claude mcp add client_golang \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page