@@ -11,6 +11,8 @@ import (
11
11
"github.com/prometheus/client_golang/prometheus/promhttp"
12
12
)
13
13
14
+ const metricNamespace = "aks_mq_lease_service"
15
+
14
16
type Metrics interface {
15
17
GetFactory () promauto.Factory
16
18
GetHTTPHandler () http.Handler
@@ -79,49 +81,49 @@ func (m *metricsImpl) GetHTTPHandler() http.Handler {
79
81
}
80
82
81
83
func (m * metricsImpl ) NewCounter (opts prometheus.CounterOpts ) prometheus.Counter {
82
- opts .Namespace = m . appName
84
+ opts .Namespace = metricNamespace
83
85
opts .ConstLabels = m .mergeLabels (opts .ConstLabels )
84
86
return m .GetFactory ().NewCounter (opts )
85
87
}
86
88
87
89
func (m * metricsImpl ) NewCounterVec (opts prometheus.CounterOpts , labelNames []string ) * prometheus.CounterVec {
88
- opts .Namespace = m . appName
90
+ opts .Namespace = metricNamespace
89
91
opts .ConstLabels = m .mergeLabels (opts .ConstLabels )
90
92
return m .GetFactory ().NewCounterVec (opts , m .mergeLabelsNames (labelNames ))
91
93
}
92
94
93
95
func (m * metricsImpl ) NewGauge (opts prometheus.GaugeOpts ) prometheus.Gauge {
94
- opts .Namespace = m . appName
96
+ opts .Namespace = metricNamespace
95
97
opts .ConstLabels = m .mergeLabels (opts .ConstLabels )
96
98
return m .GetFactory ().NewGauge (opts )
97
99
}
98
100
99
101
func (m * metricsImpl ) NewGaugeVec (opts prometheus.GaugeOpts , labelNames []string ) * prometheus.GaugeVec {
100
- opts .Namespace = m . appName
102
+ opts .Namespace = metricNamespace
101
103
opts .ConstLabels = m .mergeLabels (opts .ConstLabels )
102
104
return m .GetFactory ().NewGaugeVec (opts , m .mergeLabelsNames (labelNames ))
103
105
}
104
106
105
107
func (m * metricsImpl ) NewSummary (opts prometheus.SummaryOpts ) prometheus.Summary {
106
- opts .Namespace = m . appName
108
+ opts .Namespace = metricNamespace
107
109
opts .ConstLabels = m .mergeLabels (opts .ConstLabels )
108
110
return m .GetFactory ().NewSummary (opts )
109
111
}
110
112
111
113
func (m * metricsImpl ) NewSummaryVec (opts prometheus.SummaryOpts , labelNames []string ) * prometheus.SummaryVec {
112
- opts .Namespace = m . appName
114
+ opts .Namespace = metricNamespace
113
115
opts .ConstLabels = m .mergeLabels (opts .ConstLabels )
114
116
return m .GetFactory ().NewSummaryVec (opts , m .mergeLabelsNames (labelNames ))
115
117
}
116
118
117
119
func (m * metricsImpl ) NewHistogram (opts prometheus.HistogramOpts ) prometheus.Histogram {
118
- opts .Namespace = m . appName
120
+ opts .Namespace = metricNamespace
119
121
opts .ConstLabels = m .mergeLabels (opts .ConstLabels )
120
122
return m .GetFactory ().NewHistogram (opts )
121
123
}
122
124
123
125
func (m * metricsImpl ) NewHistogramVec (opts prometheus.HistogramOpts , labelNames []string ) * prometheus.HistogramVec {
124
- opts .Namespace = m . appName
126
+ opts .Namespace = metricNamespace
125
127
opts .ConstLabels = m .mergeLabels (opts .ConstLabels )
126
128
return m .GetFactory ().NewHistogramVec (opts , m .mergeLabelsNames (labelNames ))
127
129
}
0 commit comments