MCPcopy
hub / github.com/prometheus/client_golang / NewCollector

Function NewCollector

prometheus/collectors/version/version.go:26–47  ·  view source on GitHub ↗

NewCollector returns a collector that exports metrics about current version information.

(program string)

Source from the content-addressed store, hash-verified

24// NewCollector returns a collector that exports metrics about current version
25// information.
26func NewCollector(program string) prometheus.Collector {
27 return prometheus.NewGaugeFunc(
28 prometheus.GaugeOpts{
29 Namespace: program,
30 Name: "build_info",
31 Help: fmt.Sprintf(
32 "A metric with a constant '1' value labeled by version, revision, branch, goversion from which %s was built, and the goos and goarch for the build.",
33 program,
34 ),
35 ConstLabels: prometheus.Labels{
36 "version": version.Version,
37 "revision": version.GetRevision(),
38 "branch": version.Branch,
39 "goversion": version.GoVersion,
40 "goos": version.GoOS,
41 "goarch": version.GoArch,
42 "tags": version.GetTags(),
43 },
44 },
45 func() float64 { return 1 },
46 )
47}

Callers 1

mainFunction · 0.92

Calls 1

NewGaugeFuncFunction · 0.92

Tested by

no test coverage detected