@@ -224,15 +224,14 @@ def _translate_to_prometheus(
224
224
metrics .append (metric )
225
225
226
226
for metric in metrics :
227
- label_valuess = []
227
+ label_values_data_points = []
228
+ label_keys_data_points = []
228
229
values = []
229
230
230
- pre_metric_family_ids = []
231
+ per_metric_family_ids = []
231
232
232
233
metric_name = sanitize_full_name (metric .name )
233
-
234
234
metric_description = metric .description or ""
235
-
236
235
metric_unit = map_unit (metric .unit )
237
236
238
237
for number_data_point in metric .data .data_points :
@@ -243,7 +242,7 @@ def _translate_to_prometheus(
243
242
label_keys .append (sanitize_attribute (key ))
244
243
label_values .append (self ._check_value (value ))
245
244
246
- pre_metric_family_ids .append (
245
+ per_metric_family_ids .append (
247
246
"|" .join (
248
247
[
249
248
metric_name ,
@@ -254,7 +253,8 @@ def _translate_to_prometheus(
254
253
)
255
254
)
256
255
257
- label_valuess .append (label_values )
256
+ label_values_data_points .append (label_values )
257
+ label_keys_data_points .append (label_keys )
258
258
if isinstance (number_data_point , HistogramDataPoint ):
259
259
values .append (
260
260
{
@@ -268,8 +268,11 @@ def _translate_to_prometheus(
268
268
else :
269
269
values .append (number_data_point .value )
270
270
271
- for pre_metric_family_id , label_values , value in zip (
272
- pre_metric_family_ids , label_valuess , values
271
+ for per_metric_family_id , label_keys , label_values , value in zip (
272
+ per_metric_family_ids ,
273
+ label_keys_data_points ,
274
+ label_values_data_points ,
275
+ values ,
273
276
):
274
277
is_non_monotonic_sum = (
275
278
isinstance (metric .data , Sum )
@@ -291,7 +294,7 @@ def _translate_to_prometheus(
291
294
and not should_convert_sum_to_gauge
292
295
):
293
296
metric_family_id = "|" .join (
294
- [pre_metric_family_id , CounterMetricFamily .__name__ ]
297
+ [per_metric_family_id , CounterMetricFamily .__name__ ]
295
298
)
296
299
297
300
if metric_family_id not in metric_family_id_metric_family :
@@ -311,7 +314,7 @@ def _translate_to_prometheus(
311
314
or should_convert_sum_to_gauge
312
315
):
313
316
metric_family_id = "|" .join (
314
- [pre_metric_family_id , GaugeMetricFamily .__name__ ]
317
+ [per_metric_family_id , GaugeMetricFamily .__name__ ]
315
318
)
316
319
317
320
if (
@@ -331,7 +334,7 @@ def _translate_to_prometheus(
331
334
].add_metric (labels = label_values , value = value )
332
335
elif isinstance (metric .data , Histogram ):
333
336
metric_family_id = "|" .join (
334
- [pre_metric_family_id , HistogramMetricFamily .__name__ ]
337
+ [per_metric_family_id , HistogramMetricFamily .__name__ ]
335
338
)
336
339
337
340
if (
0 commit comments