@@ -224,15 +224,14 @@ def _translate_to_prometheus(
224224 metrics .append (metric )
225225
226226 for metric in metrics :
227- label_valuess = []
227+ label_values_data_points = []
228+ label_keys_data_points = []
228229 values = []
229230
230- pre_metric_family_ids = []
231+ per_metric_family_ids = []
231232
232233 metric_name = sanitize_full_name (metric .name )
233-
234234 metric_description = metric .description or ""
235-
236235 metric_unit = map_unit (metric .unit )
237236
238237 for number_data_point in metric .data .data_points :
@@ -243,7 +242,7 @@ def _translate_to_prometheus(
243242 label_keys .append (sanitize_attribute (key ))
244243 label_values .append (self ._check_value (value ))
245244
246- pre_metric_family_ids .append (
245+ per_metric_family_ids .append (
247246 "|" .join (
248247 [
249248 metric_name ,
@@ -254,7 +253,8 @@ def _translate_to_prometheus(
254253 )
255254 )
256255
257- label_valuess .append (label_values )
256+ label_values_data_points .append (label_values )
257+ label_keys_data_points .append (label_keys )
258258 if isinstance (number_data_point , HistogramDataPoint ):
259259 values .append (
260260 {
@@ -268,8 +268,11 @@ def _translate_to_prometheus(
268268 else :
269269 values .append (number_data_point .value )
270270
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 ,
273276 ):
274277 is_non_monotonic_sum = (
275278 isinstance (metric .data , Sum )
@@ -291,7 +294,7 @@ def _translate_to_prometheus(
291294 and not should_convert_sum_to_gauge
292295 ):
293296 metric_family_id = "|" .join (
294- [pre_metric_family_id , CounterMetricFamily .__name__ ]
297+ [per_metric_family_id , CounterMetricFamily .__name__ ]
295298 )
296299
297300 if metric_family_id not in metric_family_id_metric_family :
@@ -311,7 +314,7 @@ def _translate_to_prometheus(
311314 or should_convert_sum_to_gauge
312315 ):
313316 metric_family_id = "|" .join (
314- [pre_metric_family_id , GaugeMetricFamily .__name__ ]
317+ [per_metric_family_id , GaugeMetricFamily .__name__ ]
315318 )
316319
317320 if (
@@ -331,7 +334,7 @@ def _translate_to_prometheus(
331334 ].add_metric (labels = label_values , value = value )
332335 elif isinstance (metric .data , Histogram ):
333336 metric_family_id = "|" .join (
334- [pre_metric_family_id , HistogramMetricFamily .__name__ ]
337+ [per_metric_family_id , HistogramMetricFamily .__name__ ]
335338 )
336339
337340 if (
0 commit comments