kompose/vendor/github.com/prometheus/client_golang/prometheus
Tomas Kral 1f8a0e06c9
Upgrade OpenShift and its dependencies.
OpenShift version 1.4.0-alpha.0
2016-10-18 12:04:00 +02:00
..
.gitignore update vendoring 2016-08-05 00:31:16 +07:00
collector.go update vendoring 2016-08-05 00:31:16 +07:00
counter.go update vendoring 2016-08-05 00:31:16 +07:00
desc.go update vendoring 2016-08-05 00:31:16 +07:00
doc.go update vendoring 2016-08-05 00:31:16 +07:00
expvar.go update vendoring 2016-08-05 00:31:16 +07:00
gauge.go update vendoring 2016-08-05 00:31:16 +07:00
go_collector.go Upgrade OpenShift and its dependencies. 2016-10-18 12:04:00 +02:00
histogram.go update vendoring 2016-08-05 00:31:16 +07:00
http.go update vendoring 2016-08-05 00:31:16 +07:00
metric.go update vendoring 2016-08-05 00:31:16 +07:00
process_collector.go update vendoring 2016-08-05 00:31:16 +07:00
push.go update vendoring 2016-08-05 00:31:16 +07:00
README.md update vendoring 2016-08-05 00:31:16 +07:00
registry.go update vendoring 2016-08-05 00:31:16 +07:00
summary.go update vendoring 2016-08-05 00:31:16 +07:00
untyped.go update vendoring 2016-08-05 00:31:16 +07:00
value.go update vendoring 2016-08-05 00:31:16 +07:00
vec.go update vendoring 2016-08-05 00:31:16 +07:00

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)
}

Documentation

GoDoc