Skip to content

Commit

Permalink
Added clarification.
Browse files Browse the repository at this point in the history
Signed-off-by: bwplotka <[email protected]>
  • Loading branch information
bwplotka committed May 3, 2023
1 parent 2ea234e commit b8fdd23
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions prometheus/promhttp/option.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ func WithExtraMethods(methods ...string) Option {
})
}

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

0 comments on commit b8fdd23

Please sign in to comment.