Merge pull request #343 from bakins/registry-interface

Use an interface for Registry so we may have alternate implementations
This commit is contained in:
Matthias Rampke 2020-10-23 09:37:19 +02:00 committed by GitHub
commit 45b616fe8c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -31,9 +31,17 @@ const (
regErrF = "Failed to update metric" regErrF = "Failed to update metric"
) )
type Registry interface {
GetCounter(metricName string, labels prometheus.Labels, help string, mapping *mapper.MetricMapping, metricsCount *prometheus.GaugeVec) (prometheus.Counter, error)
GetGauge(metricName string, labels prometheus.Labels, help string, mapping *mapper.MetricMapping, metricsCount *prometheus.GaugeVec) (prometheus.Gauge, error)
GetHistogram(metricName string, labels prometheus.Labels, help string, mapping *mapper.MetricMapping, metricsCount *prometheus.GaugeVec) (prometheus.Observer, error)
GetSummary(metricName string, labels prometheus.Labels, help string, mapping *mapper.MetricMapping, metricsCount *prometheus.GaugeVec) (prometheus.Observer, error)
RemoveStaleMetrics()
}
type Exporter struct { type Exporter struct {
Mapper *mapper.MetricMapper Mapper *mapper.MetricMapper
Registry *registry.Registry Registry Registry
Logger log.Logger Logger log.Logger
EventsActions *prometheus.CounterVec EventsActions *prometheus.CounterVec
EventsUnmapped prometheus.Counter EventsUnmapped prometheus.Counter