Skip to content

Commit b8fdd23

Browse files
committed
Added clarification.
Signed-off-by: bwplotka <[email protected]>
1 parent 2ea234e commit b8fdd23

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

prometheus/promhttp/option.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,9 @@ func WithExtraMethods(methods ...string) Option {
6666
})
6767
}
6868

69-
// WithExemplarFromContext adds allows to put a hook to all counter and histogram metrics.
70-
// If the hook function returns non-nil labels, exemplars will be added for that request, otherwise metric
71-
// will get instrumented without exemplar.
69+
// WithExemplarFromContext allows to inject function that will get exemplar from context that will be put to counter and histogram metrics.
70+
// If the function returns nil labels or the metric does not support exemplars, no exemplar will be added (noop), but
71+
// metric will continue to observe/increment.
7272
func WithExemplarFromContext(getExemplarFn func(requestCtx context.Context) prometheus.Labels) Option {
7373
return optionApplyFunc(func(o *options) {
7474
o.getExemplarFn = getExemplarFn

0 commit comments

Comments
 (0)