diff --git a/sdk/monitor/azure-monitor-opentelemetry-exporter/CHANGELOG.md b/sdk/monitor/azure-monitor-opentelemetry-exporter/CHANGELOG.md index 94f3c2fed293..c129421b9028 100644 --- a/sdk/monitor/azure-monitor-opentelemetry-exporter/CHANGELOG.md +++ b/sdk/monitor/azure-monitor-opentelemetry-exporter/CHANGELOG.md @@ -5,10 +5,13 @@ ### Features Added - Added storage configuration options - ([#25369](https://github.com/Azure/azure-sdk-for-python/pull/25369)) + ([#25633](https://github.com/Azure/azure-sdk-for-python/pull/25633)) ### Breaking Changes +- Update to OpenTelemetry api/sdk v1.12.0 + ([#25659](https://github.com/Azure/azure-sdk-for-python/pull/25659)) + ### Bugs Fixed - Opentelemetry span events have wrong ParentId in Azure Monitor logs diff --git a/sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/export/metrics/_exporter.py b/sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/export/metrics/_exporter.py index 5e4b559fa471..9004017ed3fa 100644 --- a/sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/export/metrics/_exporter.py +++ b/sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/export/metrics/_exporter.py @@ -35,6 +35,14 @@ class AzureMonitorMetricExporter(BaseExporter, MetricExporter): """Azure Monitor Metric exporter for OpenTelemetry.""" + def __init__(self, **kwargs: Any) -> None: + BaseExporter.__init__(self, **kwargs) + MetricExporter.__init__( + self, + preferred_temporality=kwargs.get("preferred_temporality"), + preferred_aggregation=kwargs.get("preferred_aggregation"), + ) + def export( self, metrics_data: OTMetricsData, @@ -70,6 +78,16 @@ def export( _logger.exception("Exception occurred while exporting the data.") return _get_metric_export_result(ExportResult.FAILED_NOT_RETRYABLE) + def force_flush( + self, + timeout_millis: float = 10_000, + ) -> None: + """ + Ensure that export of any metrics currently received by the exporter + are completed as soon as possible. + """ + # TODO + def shutdown( self, timeout_millis: float = 30_000, # pylint: disable=unused-argument diff --git a/sdk/monitor/azure-monitor-opentelemetry-exporter/setup.py b/sdk/monitor/azure-monitor-opentelemetry-exporter/setup.py index 5b8e2198aa49..a09a4f22c3de 100644 --- a/sdk/monitor/azure-monitor-opentelemetry-exporter/setup.py +++ b/sdk/monitor/azure-monitor-opentelemetry-exporter/setup.py @@ -82,8 +82,8 @@ install_requires=[ "azure-core<2.0.0,>=1.23.0", "msrest>=0.6.10", - "opentelemetry-api==1.12.0rc1", - "opentelemetry-sdk==1.12.0rc1", + "opentelemetry-api<2.0.0,>=1.12.0", + "opentelemetry-sdk<2.0.0,>=1.12.0", ], ) diff --git a/shared_requirements.txt b/shared_requirements.txt index 90fd6f43ebb8..e34a7a601f6d 100644 --- a/shared_requirements.txt +++ b/shared_requirements.txt @@ -209,8 +209,8 @@ opentelemetry-sdk<2.0.0,>=1.5.0,!=1.10a0 #override azure-ai-translation-document azure-core<2.0.0,>=1.14.0 #override azure-monitor-opentelemetry-exporter azure-core<2.0.0,>=1.23.0 #override azure-monitor-opentelemetry-exporter msrest>=0.6.10 -#override azure-monitor-opentelemetry-exporter opentelemetry-api==1.12.0rc1 -#override azure-monitor-opentelemetry-exporter opentelemetry-sdk==1.12.0rc1 +#override azure-monitor-opentelemetry-exporter opentelemetry-api<2.0.0,>=1.12.0 +#override azure-monitor-opentelemetry-exporter opentelemetry-sdk<2.0.0,>=1.12.0 #override azure-core-tracing-opentelemetry opentelemetry-api<2.0.0,>=1.0.0 #override azure-identity six>=1.12.0 #override azure-keyvault-keys six>=1.12.0