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

Method ObserveDurationWithExemplar

prometheus/timer.go:70–81  ·  view source on GitHub ↗

ObserveDurationWithExemplar is like ObserveDuration, but it will also observe exemplar with the duration unless exemplar is nil or provided Observer can't be casted to ExemplarObserver.

(exemplar Labels)

Source from the content-addressed store, hash-verified

68// observe exemplar with the duration unless exemplar is nil or provided Observer can't
69// be casted to ExemplarObserver.
70func (t *Timer) ObserveDurationWithExemplar(exemplar Labels) time.Duration {
71 d := time.Since(t.begin)
72 eo, ok := t.observer.(ExemplarObserver)
73 if ok && exemplar != nil {
74 eo.ObserveWithExemplar(d.Seconds(), exemplar)
75 return d
76 }
77 if t.observer != nil {
78 t.observer.Observe(d.Seconds())
79 }
80 return d
81}

Callers 1

Calls 2

ObserveWithExemplarMethod · 0.65
ObserveMethod · 0.65

Tested by 1