client_golang
moduleThis package is not in the latest version of its module.
Details
Validgo.mod file
The Go module system was introduced in Go 1.11 and is the official dependency management solution for Go.
Redistributable license
Redistributable licenses place minimal restrictions on how software can be used, modified, and redistributed.
Tagged version
Modules with tagged versions give importers more predictable builds.
Stable version
When a project reaches major version v1 it is considered stable.
- Learn more about best practices
Repository
Links
README¶
Prometheus Go client library
This is theGo client library forPrometheus. It has two separate parts, one forinstrumenting application code, and one for creating clients that talk to thePrometheus 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 ourRelease Process for details on compatibility and support policies.
Important note about releases and stability
This repository generally followsSemanticVersioning. However, the API client inprometheus/client_golang/api/…
is still considered experimental. Breakingchanges of the API client willnot trigger a new major release. The same istrue for selected other new features explicitly marked asEXPERIMENTAL inCHANGELOG.md.
Features that require breaking changes in the stable parts of the repositoryare being batched up and tracked in thev2milestone, but plans for further development of v2 at the moment.
NOTE: The initial v2 attempt is in aseparate branch. We also startedexperimenting on a new
prometheus.V2.*
APIs inthe 1.x's V2 struct. Help wanted!
Instrumenting applications
Theprometheus
directorycontains the instrumentation library. See theguide on the Prometheuswebsite to learn more about instrumenting applications.
Theexamples
directorycontains simple examples of instrumented code.
Client for the Prometheus HTTP API
Theapi/prometheus
directorycontains the client for thePrometheus HTTP API. It allows youto write Go applications that query time series data from a Prometheusserver. It is still in alpha stage.
Where ismodel
,extraction
, andtext
?
Themodel
packages has been moved toprometheus/common/model
.
Theextraction
andtext
packages are now contained inprometheus/common/expfmt
.
Contributing and community
See thecontributing guidelines and theCommunity section of the homepage.
client_golang
community is also present on the CNCF Slack#prometheus-client_golang
.
Directories¶
Path | Synopsis |
---|---|
Package api provides clients for the HTTP APIs. | Package api provides clients for the HTTP APIs. |
prometheus/v1 Package v1 provides bindings to the Prometheus HTTP API v1: http://prometheus.io/docs/querying/api/ | Package v1 provides bindings to the Prometheus HTTP API v1: http://prometheus.io/docs/querying/api/ |
examples | |
createdtimestampscommand | |
customlabelscommand | |
exemplarscommand | |
gocollectorcommand A minimal example of how to include Prometheus instrumentation. | A minimal example of how to include Prometheus instrumentation. |
middlewarecommand | |
middleware/httpmiddleware Package httpmiddleware is adapted from https://github.com/bwplotka/correlator/tree/main/examples/observability/ping/pkg/httpinstrumentation | Package httpmiddleware is adapted from https://github.com/bwplotka/correlator/tree/main/examples/observability/ping/pkg/httpinstrumentation |
randomcommand A simple example exposing fictional RPC latencies with different types of random distributions (uniform, normal, and exponential) as Prometheus metrics. | A simple example exposing fictional RPC latencies with different types of random distributions (uniform, normal, and exponential) as Prometheus metrics. |
simplecommand A minimal example of how to include Prometheus instrumentation. | A minimal example of how to include Prometheus instrumentation. |
versioncollectorcommand A minimal example of how to include Prometheus instrumentation. | A minimal example of how to include Prometheus instrumentation. |
expmodule | |
internal | |
github.com/golang/gddo/httputil/header Package header provides functions for parsing HTTP headers. | Package header provides functions for parsing HTTP headers. |
Package prometheus is the core instrumentation package. | Package prometheus is the core instrumentation package. |
collectors Package collectors provides implementations of prometheus.Collector to conveniently collect process and Go-related metrics. | Package collectors provides implementations of prometheus.Collector to conveniently collect process and Go-related metrics. |
graphite Package graphite provides a bridge to push Prometheus metrics to a Graphite server. | Package graphite provides a bridge to push Prometheus metrics to a Graphite server. |
promauto Package promauto provides alternative constructors for the fundamental Prometheus metric types and their …Vec and …Func variants. | Package promauto provides alternative constructors for the fundamental Prometheus metric types and their …Vec and …Func variants. |
promhttp Package promhttp provides tooling around HTTP servers and clients. | Package promhttp provides tooling around HTTP servers and clients. |
promhttp/zstd Package zstd activates support for zstd compression. | Package zstd activates support for zstd compression. |
push Package push provides functions to push metrics to a Pushgateway. | Package push provides functions to push metrics to a Pushgateway. |
testutil Package testutil provides helpers to test code using the prometheus package of client_golang. | Package testutil provides helpers to test code using the prometheus package of client_golang. |
testutil/promlint Package promlint provides a linter for Prometheus metrics. | Package promlint provides a linter for Prometheus metrics. |
tutorials | |
whatsupmodule |