@@ -50,6 +50,9 @@ func TestProduce(t *testing.T) {
50
50
metric := prometheus .NewGauge (prometheus.GaugeOpts {
51
51
Name : "test_gauge_metric" ,
52
52
Help : "A gauge metric for testing" ,
53
+ ConstLabels : prometheus .Labels (map [string ]string {
54
+ "foo" : "bar" ,
55
+ }),
53
56
})
54
57
reg .MustRegister (metric )
55
58
metric .Set (123.4 )
@@ -65,7 +68,7 @@ func TestProduce(t *testing.T) {
65
68
Data : metricdata.Gauge [float64 ]{
66
69
DataPoints : []metricdata.DataPoint [float64 ]{
67
70
{
68
- Attributes : attribute .NewSet (),
71
+ Attributes : attribute .NewSet (attribute . String ( "foo" , "bar" ) ),
69
72
Value : 123.4 ,
70
73
},
71
74
},
@@ -80,6 +83,9 @@ func TestProduce(t *testing.T) {
80
83
metric := prometheus .NewCounter (prometheus.CounterOpts {
81
84
Name : "test_counter_metric" ,
82
85
Help : "A counter metric for testing" ,
86
+ ConstLabels : prometheus .Labels (map [string ]string {
87
+ "foo" : "bar" ,
88
+ }),
83
89
})
84
90
reg .MustRegister (metric )
85
91
metric .(prometheus.ExemplarAdder ).AddWithExemplar (
@@ -103,7 +109,7 @@ func TestProduce(t *testing.T) {
103
109
IsMonotonic : true ,
104
110
DataPoints : []metricdata.DataPoint [float64 ]{
105
111
{
106
- Attributes : attribute .NewSet (),
112
+ Attributes : attribute .NewSet (attribute . String ( "foo" , "bar" ) ),
107
113
Value : 245.3 ,
108
114
Exemplars : []metricdata.Exemplar [float64 ]{
109
115
{
@@ -126,6 +132,9 @@ func TestProduce(t *testing.T) {
126
132
metric := prometheus .NewSummary (prometheus.SummaryOpts {
127
133
Name : "test_summary_metric" ,
128
134
Help : "A summary metric for testing" ,
135
+ ConstLabels : prometheus .Labels (map [string ]string {
136
+ "foo" : "bar" ,
137
+ }),
129
138
})
130
139
reg .MustRegister (metric )
131
140
metric .Observe (15.0 )
@@ -138,6 +147,9 @@ func TestProduce(t *testing.T) {
138
147
metric := prometheus .NewHistogram (prometheus.HistogramOpts {
139
148
Name : "test_histogram_metric" ,
140
149
Help : "A histogram metric for testing" ,
150
+ ConstLabels : prometheus .Labels (map [string ]string {
151
+ "foo" : "bar" ,
152
+ }),
141
153
})
142
154
reg .MustRegister (metric )
143
155
metric .(prometheus.ExemplarObserver ).ObserveWithExemplar (
@@ -164,7 +176,7 @@ func TestProduce(t *testing.T) {
164
176
Sum : 578.3 ,
165
177
Bounds : []float64 {0.005 , 0.01 , 0.025 , 0.05 , 0.1 , 0.25 , 0.5 , 1 , 2.5 , 5 , 10 },
166
178
BucketCounts : []uint64 {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 1 },
167
- Attributes : attribute .NewSet (),
179
+ Attributes : attribute .NewSet (attribute . String ( "foo" , "bar" ) ),
168
180
Exemplars : []metricdata.Exemplar [float64 ]{
169
181
{
170
182
Value : 578.3 ,
@@ -188,6 +200,9 @@ func TestProduce(t *testing.T) {
188
200
metric := prometheus .NewGauge (prometheus.GaugeOpts {
189
201
Name : "test_gauge_metric" ,
190
202
Help : "A gauge metric for testing" ,
203
+ ConstLabels : prometheus .Labels (map [string ]string {
204
+ "foo" : "bar" ,
205
+ }),
191
206
})
192
207
reg .MustRegister (metric )
193
208
metric .Set (123.4 )
@@ -209,7 +224,7 @@ func TestProduce(t *testing.T) {
209
224
Data : metricdata.Gauge [float64 ]{
210
225
DataPoints : []metricdata.DataPoint [float64 ]{
211
226
{
212
- Attributes : attribute .NewSet (),
227
+ Attributes : attribute .NewSet (attribute . String ( "foo" , "bar" ) ),
213
228
Value : 123.4 ,
214
229
},
215
230
},
0 commit comments