Documentation
¶
Index ¶
- type Metric
- type Stopwatch
- func (sw *Stopwatch) Export(m *prometheus.HistogramVec, options ...UpdateMetricOption)
- func (sw *Stopwatch) ExportValuesAndCounts(mv, mc *prometheus.HistogramVec, options ...UpdateMetricOption)
- func (sw *Stopwatch) GetCounts() map[string]uint32
- func (sw *Stopwatch) GetValues() map[string]time.Duration
- func (sw *Stopwatch) Reset()
- func (sw *Stopwatch) Start(name string) Metric
- func (sw *Stopwatch) Timer(name string) *Timer
- type Timer
- type UpdateMetricOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Stopwatch ¶
type Stopwatch struct {
// contains filtered or unexported fields
}
Stopwatch is designed to measure the time of execution of code fragments. Unlike OpenTelemetry Tracing it is extremely simple and lightweight. Even small fragments can be measured.
There is no means for automatic transferring/collecting data somewhere (storage, etc.) Therefore, you need to explicitly call the Export() or GetValues() method
Stopwatch
- is not concurrent-safe
- supports nested metrics
- supports sampling (in case of frequent measurement of the same metric, for example in a cycle, not all measurements actually occur, in order to save resources)
func (*Stopwatch) Export ¶
func (sw *Stopwatch) Export(m *prometheus.HistogramVec, options ...UpdateMetricOption)
func (*Stopwatch) ExportValuesAndCounts ¶
func (sw *Stopwatch) ExportValuesAndCounts(mv, mc *prometheus.HistogramVec, options ...UpdateMetricOption)
type UpdateMetricOption ¶
type UpdateMetricOption func(prometheus.Labels) prometheus.Labels
func SetLabel ¶
func SetLabel(name, value string) UpdateMetricOption
Click to show internal directories.
Click to hide internal directories.