Using histogram metrics instead of summary

Kubernetes-commit: 42214c5ac423289a6c87e0f3c1014f652d58bf62
This commit is contained in:
danielqsj 2018-12-12 16:50:32 +08:00 committed by Kubernetes Publisher
parent c270b352df
commit 6658e1f4a3
2 changed files with 13 additions and 8 deletions

View File

@ -57,6 +57,11 @@ type SummaryMetric interface {
Observe(float64)
}
// HistogramMetric counts individual observations.
type HistogramMetric interface {
Observe(float64)
}
type noopMetric struct{}
func (noopMetric) Inc() {}
@ -73,9 +78,9 @@ type defaultQueueMetrics struct {
// total number of adds handled by a workqueue
adds CounterMetric
// how long an item stays in a workqueue
latency SummaryMetric
latency HistogramMetric
// how long processing an item from a workqueue takes
workDuration SummaryMetric
workDuration HistogramMetric
addTimes map[t]time.Time
processingStartTimes map[t]time.Time
@ -190,8 +195,8 @@ func (m *defaultRetryMetrics) retry() {
type MetricsProvider interface {
NewDepthMetric(name string) GaugeMetric
NewAddsMetric(name string) CounterMetric
NewLatencyMetric(name string) SummaryMetric
NewWorkDurationMetric(name string) SummaryMetric
NewLatencyMetric(name string) HistogramMetric
NewWorkDurationMetric(name string) HistogramMetric
NewUnfinishedWorkSecondsMetric(name string) SettableGaugeMetric
NewLongestRunningProcessorSecondsMetric(name string) SettableGaugeMetric
NewRetriesMetric(name string) CounterMetric
@ -214,11 +219,11 @@ func (_ noopMetricsProvider) NewAddsMetric(name string) CounterMetric {
return noopMetric{}
}
func (_ noopMetricsProvider) NewLatencyMetric(name string) SummaryMetric {
func (_ noopMetricsProvider) NewLatencyMetric(name string) HistogramMetric {
return noopMetric{}
}
func (_ noopMetricsProvider) NewWorkDurationMetric(name string) SummaryMetric {
func (_ noopMetricsProvider) NewWorkDurationMetric(name string) HistogramMetric {
return noopMetric{}
}

View File

@ -155,11 +155,11 @@ func (m *testMetricsProvider) NewAddsMetric(name string) CounterMetric {
return &m.adds
}
func (m *testMetricsProvider) NewLatencyMetric(name string) SummaryMetric {
func (m *testMetricsProvider) NewLatencyMetric(name string) HistogramMetric {
return &m.latency
}
func (m *testMetricsProvider) NewWorkDurationMetric(name string) SummaryMetric {
func (m *testMetricsProvider) NewWorkDurationMetric(name string) HistogramMetric {
return &m.duration
}