File tree Expand file tree Collapse file tree 2 files changed +598
-284
lines changed
src/opentelemetry/sdk/metrics/_internal/export Expand file tree Collapse file tree 2 files changed +598
-284
lines changed Original file line number Diff line number Diff line change @@ -657,11 +657,19 @@ def _export_batch(self) -> int:
657657 token = attach (set_value (_SUPPRESS_INSTRUMENTATION_KEY , True ))
658658 try :
659659 with self ._export_lock :
660+ # Create a combined metrics data object with all resource_metrics from the batch
661+ batch = []
660662 for metrics_data in pending_metrics :
661- self ._exporter .export (
662- metrics_data ,
663- timeout_millis = self ._export_timeout_millis ,
664- )
663+ batch .extend (metrics_data .resource_metrics )
664+
665+ # Create a single MetricsData object with all resource_metrics
666+ combined_metrics_data = MetricsData (resource_metrics = batch )
667+
668+ # Export the combined batch
669+ self ._exporter .export (
670+ combined_metrics_data ,
671+ timeout_millis = self ._export_timeout_millis ,
672+ )
665673 except Exception : # pylint: disable=broad-exception-caught
666674 _logger .exception ("Exception while exporting metrics." )
667675 finally :
You can’t perform that action at this time.
0 commit comments