c1370d07ca
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... |
||
---|---|---|
api/prometheus | ||
examples | ||
prometheus | ||
.gitignore | ||
.travis.yml | ||
AUTHORS.md | ||
CHANGELOG.md | ||
CONTRIBUTING.md | ||
LICENSE | ||
NOTICE | ||
README.md | ||
VERSION |
README.md
Prometheus Go client library
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
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
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.