forked from mirror/client_golang
169c8a68e1
The new vendoring was produced by running: godep save -r ./examples/... ./prometheus/... ./text/... ./model/... ./extraction/... Two things to note: - "extraction/processor0_0_{1,2}_test.go" imported a package from "github.com/prometheus/prometheus", all for just one tiny testing function. To not have to deal with a circular vendoring dependency, I simply replaced the usage of the function by some in-line logic. - godep grouped the rewritten imports slightly differently for some reason, but at least the standard library imports are still in a separate section. Not sure if it's worth manually keeping our old import grouping scheme or if we should simply use that godep-generated one. |
||
---|---|---|
.. | ||
.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 | ||
histogram.go | ||
histogram_test.go | ||
http.go | ||
http_test.go | ||
metric.go | ||
metric_test.go | ||
process_collector.go | ||
process_collector_procfs.go | ||
process_collector_rest.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)
}