MCPcopy
hub / github.com/prometheus/client_golang

github.com/prometheus/client_golang @v1.23.2 sqlite

repository ↗ · DeepWiki ↗ · release v1.23.2 ↗
1,508 symbols 5,753 edges 160 files 593 documented · 39%
README

Prometheus Go client library

CI Go Report Card 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.

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

Metric (Interface)
For convenient use with xxhash. A Metric models a single sample value with its meta data being exported to Prometheus. I [14 …
prometheus/metric.go
Collector (Interface)
Collector is the interface implemented by anything that can be used by Prometheus to collect metrics. A Collector has to [18 …
prometheus/collector.go
ObserverVec (Interface)
ObserverVec is an interface implemented by `HistogramVec` and `SummaryVec`. [5 implementers]
prometheus/observer.go
Gatherer (Interface)
Gatherer is the interface for the part of a registry in charge of gathering the collected metrics into a number of Metri [5 …
prometheus/registry.go
HTTPDoer (Interface)
HTTPDoer is an interface for the one method of http.Client that is used by Pusher [5 implementers]
prometheus/push/push.go
Client (Interface)
Client is the interface for an API client. [5 implementers]
api/client.go
Histogram (Interface)
The nativeHistogramBounds above can be generated with the code below. TODO(beorn7): It's tempting to actually use `go g [3 …
prometheus/histogram.go
Summary (Interface)
A Summary captures individual observations from an event or sample stream and summarizes them in a manner similar to tra [3 …
prometheus/summary.go

Core symbols most depended-on inside this repo

Error
called by 206
prometheus/push/push.go
Add
called by 126
prometheus/gauge.go
String
called by 118
prometheus/desc.go
NewDesc
called by 106
prometheus/desc.go
Write
called by 90
prometheus/metric.go
Set
called by 86
prometheus/gauge.go
Run
called by 83
prometheus/graphite/bridge.go
Println
called by 66
prometheus/graphite/bridge.go

Shape

Function 683
Method 573
Struct 171
TypeAlias 38
Interface 33
FuncType 10

Languages

Go100%

Modules by API surface

api/prometheus/v1/api.go118 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.go42 symbols
prometheus/summary.go40 symbols
prometheus/vec.go38 symbols
exp/api/remote/remote_api.go37 symbols
prometheus/histogram_test.go36 symbols
prometheus/vec_test.go32 symbols
prometheus/gauge.go30 symbols
prometheus/counter.go27 symbols

Dependencies from manifests, versioned

github.com/beorn7/perksv1.0.1 · 1×
github.com/bwplotka/tracing-gov0.0.0-2023042106160 · 1×
github.com/cespare/xxhash/v2v2.3.0 · 1×
github.com/davecgh/go-spewv1.1.1 · 1×
github.com/efficientgo/corev1.0.0-rc.3 · 1×
github.com/efficientgo/e2ev0.14.1-0.2023042107 · 1×
github.com/efficientgo/tools/corev0.0.0-2023050515374 · 1×
github.com/felixge/httpsnoopv1.0.4 · 1×
github.com/go-logr/logrv1.4.2 · 1×
github.com/go-logr/stdrv1.2.2 · 1×

For agents

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

⬇ download graph artifact