Stop observes the elapsed duration since the creation of the timer. The timer is created using a StopWatch
()
| 132 | |
| 133 | // Stop observes the elapsed duration since the creation of the timer. The timer is created using a StopWatch |
| 134 | func (s Timer) Stop() float64 { |
| 135 | observed := time.Since(s.start).Nanoseconds() |
| 136 | outputScaleDuration := s.outputScale.Nanoseconds() |
| 137 | if outputScaleDuration == 0 { |
| 138 | s.timer.Observe(0) |
| 139 | return 0 |
| 140 | } |
| 141 | scaled := float64(observed) / float64(outputScaleDuration) |
| 142 | s.timer.Observe(scaled) |
| 143 | return scaled |
| 144 | } |
| 145 | |
| 146 | // A SummaryOptions represents a set of options that can be supplied when creating a new prometheus summary metric |
| 147 | type SummaryOptions struct { |
no test coverage detected