|
|
9 years ago | |
|---|---|---|
| .. | ||
| .gitignore | 9 years ago | |
| README.md | 9 years ago | |
| collector.go | 9 years ago | |
| counter.go | 9 years ago | |
| desc.go | 9 years ago | |
| doc.go | 9 years ago | |
| expvar.go | 9 years ago | |
| gauge.go | 9 years ago | |
| go_collector.go | 9 years ago | |
| histogram.go | 9 years ago | |
| http.go | 9 years ago | |
| metric.go | 9 years ago | |
| process_collector.go | 9 years ago | |
| push.go | 9 years ago | |
| registry.go | 9 years ago | |
| summary.go | 9 years ago | |
| untyped.go | 9 years ago | |
| value.go | 9 years ago | |
| vec.go | 9 years ago | |
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.
$ go get github.com/prometheus/client_golang/prometheus
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)
}