Skip to content

Commit

Permalink
Update exporter to use opentelemetry api/sdk 1.12.0 (#25659)
Browse files Browse the repository at this point in the history
  • Loading branch information
lzchen authored Aug 11, 2022
1 parent aa09ef6 commit 8de7c12
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions sdk/monitor/azure-monitor-opentelemetry-exporter/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
],
)

4 changes: 2 additions & 2 deletions shared_requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 8de7c12

Please sign in to comment.