client_golang/prometheus
William Kennedy a794f77b54 Update go_collector_test.go
We are running into a timeout with TestHistogramConcurrency on our Jenkins box. I noticed in the stack trace for the timeout this block.

goroutine 2348 [chan send]:
github.comcast.com/ventris/kober/vnd/github.com/prometheus/client_golang/prometheus.(*goCollector).Collect(0xc20801e8e0, 0xc20800a7e0)
	/var/lib/jenkins/jobs/Kober/workspace/src/github.comcast.com/ventris/kober/vnd/github.com/prometheus/client_golang/prometheus/go_collector.go:49 +0x6dd
github.comcast.com/ventris/kober/vnd/github.com/prometheus/client_golang/prometheus.func·028()
	/var/lib/jenkins/jobs/Kober/workspace/src/github.comcast.com/ventris/kober/vnd/github.com/prometheus/client_golang/prometheus/go_collector_test.go:27 +0x11a
created by github.comcast.com/ventris/kober/vnd/github.com/prometheus/client_golang/prometheus.TestGoCollector
	/var/lib/jenkins/jobs/Kober/workspace/src/github.comcast.com/ventris/kober/vnd/github.com/prometheus/client_golang/prometheus/go_collector_test.go:28 +0x35e

This suggested that even though the TestGoCollector test was finished, a goroutine was still hanging around. I traced it back to the call to c.Collect always sending twice of the provided channel. This change receives that second value and allows the goroutine to finish with the test.

Still can't figure out why TestHistogramConcurrency is timing out after 2 minutes :(
2015-08-12 15:23:41 -04:00
..
.gitignore Rearrange file and package per convention. 2013-04-04 15:27:09 +02:00
README.md Fix document 2015-02-11 17:35:04 -05:00
benchmark_test.go Add support for histograms to the Go client library. 2015-02-19 15:54:26 +01:00
collector.go Change "Prometheus Team" to "The Prometheus Authors". 2015-02-02 15:14:36 +01:00
counter.go Correct typo in Counter.Set() docstring. 2015-04-30 18:51:33 +02:00
counter_test.go Use non-rewritten Godep imports. 2015-02-27 16:49:40 +01:00
desc.go Make LabelNameRE public. 2015-06-01 15:41:09 +02:00
doc.go Mention histograms in doc.go. 2015-06-13 12:20:08 +02:00
example_clustermanager_test.go Change "Prometheus Team" to "The Prometheus Authors". 2015-02-02 15:14:36 +01:00
example_memstats_test.go Change "Prometheus Team" to "The Prometheus Authors". 2015-02-02 15:14:36 +01:00
example_selfcollector_test.go Use non-rewritten Godep imports. 2015-02-27 16:49:40 +01:00
examples_test.go Document the possibility to create "empty" metrics in a metric vector. 2015-07-15 13:13:56 +02:00
expvar.go Change "Prometheus Team" to "The Prometheus Authors". 2015-02-02 15:14:36 +01:00
expvar_test.go Use non-rewritten Godep imports. 2015-02-27 16:49:40 +01:00
gauge.go Change "Prometheus Team" to "The Prometheus Authors". 2015-02-02 15:14:36 +01:00
gauge_test.go Use non-rewritten Godep imports. 2015-02-27 16:49:40 +01:00
go_collector.go Rename process_goroutines to go_goroutines 2015-05-19 15:47:08 -04:00
go_collector_test.go Update go_collector_test.go 2015-08-12 15:23:41 -04:00
histogram.go doc fix: s/DefObjectives/DefBuckets/ 2015-05-30 17:30:45 +02:00
histogram_test.go Use non-rewritten Godep imports. 2015-02-27 16:49:40 +01:00
http.go Solve "The Proxy Problem" of InstrumentHandler 2015-06-04 23:48:40 +02:00
http_test.go Use non-rewritten Godep imports. 2015-02-27 16:49:40 +01:00
metric.go Use non-rewritten Godep imports. 2015-02-27 16:49:40 +01:00
metric_test.go Change "Prometheus Team" to "The Prometheus Authors". 2015-02-02 15:14:36 +01:00
process_collector.go Inline and remove processCollectSupported(). 2015-04-01 01:18:20 +02:00
process_collector_test.go Use non-rewritten Godep imports. 2015-02-27 16:49:40 +01:00
push.go Add functions to push individual collectors to a Pushgateway. 2015-03-15 19:29:57 +01:00
registry.go Fix a number of minor things. 2015-06-09 12:03:07 +02:00
registry_test.go Fix a number of minor things. 2015-06-09 12:03:07 +02:00
summary.go Reword, using "φ-quantile". 2015-08-03 14:10:20 +02:00
summary_test.go Return NaN when summaries have no observations yet. 2015-03-15 16:33:56 +01:00
untyped.go Fix doc-comment reference to Untyped metric. 2015-06-13 02:16:27 +02:00
value.go Ensure alignment of struct members used in sync.atomic functions. 2015-05-21 12:19:38 +02:00
vec.go Document the possibility to create "empty" metrics in a metric vector. 2015-07-15 13:13:56 +02:00
vec_test.go Change "Prometheus Team" to "The Prometheus Authors". 2015-02-02 15:14:36 +01:00

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

Documentation

GoDoc