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

Function WrapCollectorWith

prometheus/wrap.go:97–102  ·  view source on GitHub ↗

WrapCollectorWith returns a Collector wrapping the provided Collector. The wrapped Collector will add the provided Labels to all Metrics it collects (as ConstLabels). The Metrics collected by the unmodified Collector must not duplicate any of those labels. WrapCollectorWith can be useful to work wi

(labels Labels, c Collector)

Source from the content-addressed store, hash-verified

95// Then you can un-register the wrapped collector effectively un-registering the
96// metrics registered by foo.New.
97func WrapCollectorWith(labels Labels, c Collector) Collector {
98 return &wrappingCollector{
99 wrappedCollector: c,
100 labels: labels,
101 }
102}
103
104// WrapCollectorWithPrefix returns a Collector wrapping the provided Collector. The
105// wrapped Collector will add the provided prefix to the name of all Metrics it collects.

Callers 2

ExampleWrapCollectorWithFunction · 0.92
TestWrapCollectorFunction · 0.85

Calls

no outgoing calls

Tested by 2

ExampleWrapCollectorWithFunction · 0.74
TestWrapCollectorFunction · 0.68