| 1 |
# Prometheus Go client library |
| 2 |
|
| 3 |
[](https://github.com/prometheus/client_golang/actions/workflows/ci.yml) |
| 4 |
[](https://goreportcard.com/report/github.com/prometheus/client_golang) |
| 5 |
[](https://pkg.go.dev/github.com/prometheus/client_golang) |
| 6 |
[](https://securityscorecards.dev/viewer/?uri=github.com/prometheus/client_golang) |
| 7 |
[](https://slack.cncf.io/) |
| 8 |
|
| 9 |
This is the [Go](http://golang.org) client library for |
| 10 |
[Prometheus](http://prometheus.io). It has two separate parts, one for |
| 11 |
instrumenting application code, and one for creating clients that talk to the |
| 12 |
Prometheus HTTP API. |
| 13 |
|
| 14 |
## Version Compatibility |
| 15 |
|
| 16 |
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. |
| 17 |
|
| 18 |
> [!NOTE] |
| 19 |
> See our [Release Process](RELEASE.md#supported-go-versions) for details on compatibility and support policies. |
| 20 |
|
| 21 |
## Important note about releases and stability |
| 22 |
|
| 23 |
This repository generally follows [Semantic |
| 24 |
Versioning](https://semver.org/). However, the API client in |
| 25 |
`prometheus/client_golang/api/…` is still considered experimental. Breaking |
| 26 |
changes of the API client will _not_ trigger a new major release. The same is |
| 27 |
true for selected other new features explicitly marked as **EXPERIMENTAL** in |
| 28 |
CHANGELOG.md. |
| 29 |
|
| 30 |
Features that require breaking changes in the stable parts of the repository |
| 31 |
are being batched up and tracked in the [v2 |
| 32 |
milestone](https://github.com/prometheus/client_golang/milestone/2), but plans for further development of v2 at the moment. |
| 33 |
|
| 34 |
> NOTE: The initial v2 attempt is in a [separate branch](https://github.com/prometheus/client_golang/tree/dev-v2). We also started |
| 35 |
experimenting on a new `prometheus.V2.*` APIs in [the 1.x's V2 struct](https://github.com/prometheus/client_golang/blob/main/prometheus/vnext.go#L23). Help wanted! |
| 36 |
|
| 37 |
## Instrumenting applications |
| 38 |
|
| 39 |
[](https://pkg.go.dev/github.com/prometheus/client_golang/prometheus) |
| 40 |
|
| 41 |
The |
| 42 |
[`prometheus` directory](https://github.com/prometheus/client_golang/tree/main/prometheus) |
| 43 |
contains the instrumentation library. See the |
| 44 |
[guide](https://prometheus.io/docs/guides/go-application/) on the Prometheus |
| 45 |
website to learn more about instrumenting applications. |
| 46 |
|
| 47 |
The |
| 48 |
[`examples` directory](https://github.com/prometheus/client_golang/tree/main/examples) |
| 49 |
contains simple examples of instrumented code. |
| 50 |
|
| 51 |
## Client for the Prometheus HTTP API |
| 52 |
|
| 53 |
[](https://pkg.go.dev/github.com/prometheus/client_golang/api) |
| 54 |
|
| 55 |
The |
| 56 |
[`api/prometheus` directory](https://github.com/prometheus/client_golang/tree/main/api/prometheus) |
| 57 |
contains the client for the |
| 58 |
[Prometheus HTTP API](http://prometheus.io/docs/querying/api/). It allows you |
| 59 |
to write Go applications that query time series data from a Prometheus |
| 60 |
server. It is still in alpha stage. |
| 61 |
|
| 62 |
## Where is `model`, `extraction`, and `text`? |
| 63 |
|
| 64 |
The `model` packages has been moved to |
| 65 |
[`prometheus/common/model`](https://github.com/prometheus/common/tree/main/model). |
| 66 |
|
| 67 |
The `extraction` and `text` packages are now contained in |
| 68 |
[`prometheus/common/expfmt`](https://github.com/prometheus/common/tree/main/expfmt). |
| 69 |
|
| 70 |
## Contributing and community |
| 71 |
|
| 72 |
See the [contributing guidelines](CONTRIBUTING.md) and the |
| 73 |
[Community section](http://prometheus.io/community/) of the homepage. |
| 74 |
|
| 75 |
`client_golang` community is also present on the CNCF Slack `#prometheus-client_golang`. |