Merge pull request #5860 from tariq1890/variadic

pass multiple args to Registerer.MustRegister method
This commit is contained in:
Björn Rabenstein 2019-08-13 13:22:30 +02:00 committed by GitHub
commit 70ce3df23c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -177,8 +177,10 @@ type clientGoRequestMetricAdapter struct{}
func (f *clientGoRequestMetricAdapter) Register(registerer prometheus.Registerer) { func (f *clientGoRequestMetricAdapter) Register(registerer prometheus.Registerer) {
metrics.Register(f, f) metrics.Register(f, f)
registerer.MustRegister(clientGoRequestResultMetricVec) registerer.MustRegister(
registerer.MustRegister(clientGoRequestLatencyMetricVec) clientGoRequestResultMetricVec,
clientGoRequestLatencyMetricVec,
)
} }
func (clientGoRequestMetricAdapter) Increment(code string, method string, host string) { func (clientGoRequestMetricAdapter) Increment(code string, method string, host string) {
clientGoRequestResultMetricVec.WithLabelValues(code).Inc() clientGoRequestResultMetricVec.WithLabelValues(code).Inc()
@ -192,15 +194,16 @@ type clientGoCacheMetricsProvider struct{}
func (f *clientGoCacheMetricsProvider) Register(registerer prometheus.Registerer) { func (f *clientGoCacheMetricsProvider) Register(registerer prometheus.Registerer) {
cache.SetReflectorMetricsProvider(f) cache.SetReflectorMetricsProvider(f)
registerer.MustRegister(clientGoCacheWatchesDurationMetric) registerer.MustRegister(
registerer.MustRegister(clientGoCacheWatchesCountMetric) clientGoCacheWatchesDurationMetric,
registerer.MustRegister(clientGoCacheListDurationMetric) clientGoCacheWatchesCountMetric,
registerer.MustRegister(clientGoCacheListTotalMetric) clientGoCacheListDurationMetric,
registerer.MustRegister(clientGoCacheLastResourceVersionMetric) clientGoCacheListTotalMetric,
registerer.MustRegister(clientGoCacheShortWatchesCountMetric) clientGoCacheLastResourceVersionMetric,
registerer.MustRegister(clientGoCacheItemsInWatchesCountMetric) clientGoCacheShortWatchesCountMetric,
registerer.MustRegister(clientGoCacheItemsInListCountMetric) clientGoCacheItemsInWatchesCountMetric,
clientGoCacheItemsInListCountMetric,
)
} }
func (clientGoCacheMetricsProvider) NewListsMetric(name string) cache.CounterMetric { func (clientGoCacheMetricsProvider) NewListsMetric(name string) cache.CounterMetric {
return clientGoCacheListTotalMetric return clientGoCacheListTotalMetric
@ -232,12 +235,14 @@ type clientGoWorkqueueMetricsProvider struct{}
func (f *clientGoWorkqueueMetricsProvider) Register(registerer prometheus.Registerer) { func (f *clientGoWorkqueueMetricsProvider) Register(registerer prometheus.Registerer) {
workqueue.SetProvider(f) workqueue.SetProvider(f)
registerer.MustRegister(clientGoWorkqueueDepthMetricVec) registerer.MustRegister(
registerer.MustRegister(clientGoWorkqueueAddsMetricVec) clientGoWorkqueueDepthMetricVec,
registerer.MustRegister(clientGoWorkqueueLatencyMetricVec) clientGoWorkqueueAddsMetricVec,
registerer.MustRegister(clientGoWorkqueueWorkDurationMetricVec) clientGoWorkqueueLatencyMetricVec,
registerer.MustRegister(clientGoWorkqueueUnfinishedWorkSecondsMetricVec) clientGoWorkqueueWorkDurationMetricVec,
registerer.MustRegister(clientGoWorkqueueLongestRunningProcessorMetricVec) clientGoWorkqueueUnfinishedWorkSecondsMetricVec,
clientGoWorkqueueLongestRunningProcessorMetricVec,
)
} }
func (f *clientGoWorkqueueMetricsProvider) NewDepthMetric(name string) workqueue.GaugeMetric { func (f *clientGoWorkqueueMetricsProvider) NewDepthMetric(name string) workqueue.GaugeMetric {