Prometheus instrumentation library for Go applications
Go to file
Michael Stapelberg c1370d07ca Strip trailing / from push URL.
This circumvents the following problem:
• The prometheus client library appends “/metrics/…” to the pushURL.
• When pushURL ends in a trailing slash, the URL becomes e.g.
  http://pushgateway.example.com:9091//metrics/…
• The pushgateway will reply with an HTTP 307 status code
  (temporary redirect).
• While Go’s net/http client follows redirects by default, it will only
  follow HTTP 302 (Found) and HTTP 303 (See Other) redirects for PUT and
  POST requests, which the prometheus client library uses.

Hence, when calling e.g.:

    prometheus.Push("foo", "bar", "http://pushgateway.example.com:9091/")

…your metrics would not actually get pushed successfully, but rather
you’d see the error message:

    2015/11/26 10:59:49 main.go:209: unexpected status code 307 while pushing to http://push...
2015-11-26 19:16:53 +01:00
api/prometheus Use ctxhttp package for cancelable requests 2015-10-02 12:04:48 +02:00
examples Add a histogram to the random example. 2015-02-23 16:19:01 +01:00
prometheus Strip trailing / from push URL. 2015-11-26 19:16:53 +01:00
.gitignore Enclose artifact generation process into Makefile. 2013-07-21 17:45:53 +02:00
.travis.yml Set sudo=false for travis CI 2015-08-19 16:13:11 +02:00
AUTHORS.md Update Julius's email address in AUTHORS.md 2015-10-26 02:27:06 +01:00
CHANGELOG.md Cut v0.7.0 2015-07-27 17:09:29 +02:00
CONTRIBUTING.md License cleanup 2015-01-22 16:13:15 +01:00
LICENSE License cleanup 2015-01-22 16:13:15 +01:00
NOTICE Add newly vendored libraries to NOTICE file. 2015-02-26 14:04:24 +01:00
README.md Update README.md 2015-09-18 14:41:53 +02:00
VERSION Cut v0.7.0 2015-07-27 17:09:29 +02:00

README.md

Prometheus Go client library

Build Status

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.

Instrumenting applications

code-coverage go-doc

The prometheus directory contains the instrumentation library. See the best practices section of the Prometheus documentation to learn more about instrumenting applications.

The examples directory contains simple examples of instrumented code.

Client for the Prometheus HTTP API

code-coverage go-doc

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.

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.