1313
1414package prometheus
1515
16- import (
17- "time"
18- )
16+ import "time"
1917
2018// Timer is a helper type to time functions. Use NewTimer to create new
2119// instances.
@@ -154,7 +152,7 @@ func (t *TimerHistogramVec) Wrap(labels map[string]string, fn func()) {
154152fn ()
155153}
156154
157- func (t * TimerHistogramVec )WrapLV (values []string ,fn func ()) {
155+ func (t * TimerHistogramVec )WrapLabelValues (values []string ,fn func ()) {
158156defer t .ObserveLabelValues (values ... )()
159157fn ()
160158}
@@ -201,7 +199,7 @@ func (t *TimerCounter) Observe() func() {
201199
202200return func () {
203201d := time .Since (start )
204- t .Counter . Add (d .Seconds ())
202+ t .Add (d .Seconds ())
205203}
206204}
207205
@@ -227,15 +225,15 @@ func (t *TimerCounterVec) Observe(labels map[string]string) func() {
227225
228226return func () {
229227d := time .Since (start )
230- t .CounterVec . With (labels ).Add (d .Seconds ())
228+ t .With (labels ).Add (d .Seconds ())
231229}
232230}
233231
234232func (t * TimerCounterVec )ObserveLabelValues (values ... string )func () {
235233start := time .Now ()
236234return func () {
237235d := time .Since (start )
238- t .CounterVec . WithLabelValues (values ... ).Add (d .Seconds ())
236+ t .WithLabelValues (values ... ).Add (d .Seconds ())
239237}
240238}
241239
@@ -292,13 +290,13 @@ func (t *TimerContinuous) Observe() func() {
292290case <- ch :
293291d := time .Since (start )
294292if diff := d .Seconds ()- added ;diff > 0 {
295- t .Counter . Add (diff )
293+ t .Add (diff )
296294}
297295return
298296case <- ticker .C :
299297d := time .Since (start )
300298if diff := d .Seconds ()- added ;diff > 0 {
301- t .Counter . Add (diff )
299+ t .Add (diff )
302300added += diff
303301}
304302}
@@ -340,13 +338,13 @@ func (t *TimerContinuousVec) Observe(labels map[string]string) func() {
340338case <- ch :
341339d := time .Since (start )
342340if diff := d .Seconds ()- added ;diff > 0 {
343- t .CounterVec . With (labels ).Add (diff )
341+ t .With (labels ).Add (diff )
344342}
345343return
346344case <- ticker .C :
347345d := time .Since (start )
348346if diff := d .Seconds ()- added ;diff > 0 {
349- t .CounterVec . With (labels ).Add (diff )
347+ t .With (labels ).Add (diff )
350348added += diff
351349}
352350}
@@ -371,13 +369,13 @@ func (t *TimerContinuousVec) ObserveLabelValues(values ...string) func() {
371369case <- ch :
372370d := time .Since (start )
373371if diff := d .Seconds ()- added ;diff > 0 {
374- t .CounterVec . WithLabelValues (values ... ).Add (diff )
372+ t .WithLabelValues (values ... ).Add (diff )
375373}
376374return
377375case <- ticker .C :
378376d := time .Since (start )
379377if diff := d .Seconds ()- added ;diff > 0 {
380- t .CounterVec . WithLabelValues (values ... ).Add (diff )
378+ t .WithLabelValues (values ... ).Add (diff )
381379added += diff
382380}
383381}