05059724f8
Summaries as implemented cannot be aggregated in a meaningful way. Partitoning them by status code and method only made sense if we were interested in the individual latency and size of e.g. GET request that result in status 503. In general, that's not the case. Most of the time, the user will be interested in the latency and size of _all_ HTTP requests. (With future changes to client_golang, we will consider making the HTTP instrumentation configurable, e.g. to handle the case where the user is only interested in the latency of successful requests.) |
||
---|---|---|
.. | ||
.gitignore | ||
README.md | ||
benchmark_test.go | ||
collector.go | ||
counter.go | ||
counter_test.go | ||
desc.go | ||
doc.go | ||
example_clustermanager_test.go | ||
example_memstats_test.go | ||
example_selfcollector_test.go | ||
examples_test.go | ||
expvar.go | ||
expvar_test.go | ||
gauge.go | ||
gauge_test.go | ||
go_collector.go | ||
go_collector_test.go | ||
http.go | ||
http_test.go | ||
metric.go | ||
metric_test.go | ||
process_collector.go | ||
process_collector_test.go | ||
registry.go | ||
registry_test.go | ||
summary.go | ||
summary_test.go | ||
untyped.go | ||
value.go | ||
vec.go | ||
vec_test.go |
README.md
Overview
This is the Prometheus telemetric instrumentation client Go client library. It enable authors to define process-space metrics for their servers and expose them through a web service interface for extraction, aggregation, and a whole slew of other post processing techniques.
Installing
$ go get github.com/prometheus/client_golang/prometheus
Example
package main
import (
"net/http"
"github.com/prometheus/client_golang/prometheus"
)
var (
indexed = prometheus.NewCounter(prometheus.CounterOpts{
Namespace: "my_company",
Subsystem: "indexer",
Name: "documents_indexed",
Help: "The number of documents indexed.",
})
size = prometheus.NewGauge(prometheus.GaugeOpts{
Namespace: "my_company",
Subsystem: "storage",
Name: "documents_total_size_bytes",
Help: "The total size of all documents in the storage."}})
)
func main() {
http.Handle("/metrics", prometheus.Handler())
indexed.Inc()
size.Set(5)
http.ListenAndServe(":8080", nil)
}
func init() {
prometheus.MustRegister(indexed)
prometheus.MustRegister(size)
}