feat(instrumentation): lots of refactoring to support tag based backend, #4696
This commit is contained in:
+31
-16
@@ -3,21 +3,33 @@ package metrics
|
||||
//import "sync/atomic"
|
||||
|
||||
type Timer interface {
|
||||
Metric
|
||||
|
||||
AddTiming(int64)
|
||||
Clear()
|
||||
Avg() int64
|
||||
Min() int64
|
||||
Max() int64
|
||||
Total() int64
|
||||
Count() int64
|
||||
}
|
||||
|
||||
func NewTimer() Timer {
|
||||
type StandardTimer struct {
|
||||
*MetricMeta
|
||||
|
||||
total int64
|
||||
count int64
|
||||
avg int64
|
||||
min int64
|
||||
max int64
|
||||
}
|
||||
|
||||
func NewTimer(meta *MetricMeta) Timer {
|
||||
return &StandardTimer{
|
||||
avg: 0,
|
||||
min: 0,
|
||||
max: 0,
|
||||
total: 0,
|
||||
count: 0,
|
||||
MetricMeta: meta,
|
||||
avg: 0,
|
||||
min: 0,
|
||||
max: 0,
|
||||
total: 0,
|
||||
count: 0,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,14 +68,17 @@ func (this *StandardTimer) Max() int64 {
|
||||
return this.max
|
||||
}
|
||||
|
||||
func (this *StandardTimer) Total() int64 {
|
||||
return this.total
|
||||
func (this *StandardTimer) Count() int64 {
|
||||
return this.count
|
||||
}
|
||||
|
||||
type StandardTimer struct {
|
||||
total int64
|
||||
count int64
|
||||
avg int64
|
||||
min int64
|
||||
max int64
|
||||
func (this *StandardTimer) Snapshot() Metric {
|
||||
return &StandardTimer{
|
||||
MetricMeta: this.MetricMeta,
|
||||
avg: this.avg,
|
||||
min: this.min,
|
||||
max: this.max,
|
||||
total: this.total,
|
||||
count: this.count,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user