-
Notifications
You must be signed in to change notification settings - Fork 0
/
metrics_tracker.go
22 lines (19 loc) · 1006 Bytes
/
metrics_tracker.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
package gobulk
// MetricsTracker registers and measures pipeline steps duration and instanc metrics.
type MetricsTracker interface {
// Add registers the measurement in the metrics tracker with the following description.
Add(measurement, description string)
// Start launches the measurement duration timer.
Start(measurement string)
// Stop stops the measurement timer and registers the time diff in the metrics tracker.
Stop(measurement string)
// Set registers the measurement value in the metrics tracker. Should be used to register
// instant metrics.
Set(measurement, value string)
}
// emptyMetricsTracker is used when no metrics tracker is needed. It just does nothing on every call.
type emptyMetricsTracker struct{}
func (emptyMetricsTracker) Add(measurement, description string) {}
func (emptyMetricsTracker) Start(measurement string) {}
func (emptyMetricsTracker) Stop(measurement string) {}
func (emptyMetricsTracker) Set(measurement, value string) {}