Skip to content

Commit 64b9434

Browse files
authored
Disable distributed tracing for live metrics calls (#35822)
1 parent 719362c commit 64b9434

File tree

4 files changed

+26
-6
lines changed

4 files changed

+26
-6
lines changed

sdk/monitor/azure-monitor-opentelemetry-exporter/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66

77
- Handle invalid status codes in std metric payload
88
([#35762](https://github.com/Azure/azure-sdk-for-python/pull/35762))
9+
- Disable distributed tracing for live metrics client calls
10+
([#35822](https://github.com/Azure/azure-sdk-for-python/pull/35822))
911

1012
### Other Changes
1113

sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/_quickpulse/_exporter.py

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,13 @@
2323
)
2424

2525
from azure.core.exceptions import HttpResponseError
26+
from azure.core.pipeline.policies import ContentDecodePolicy
2627
from azure.monitor.opentelemetry.exporter._quickpulse._constants import (
2728
_LONG_PING_INTERVAL_SECONDS,
2829
_POST_CANCEL_INTERVAL_SECONDS,
2930
_POST_INTERVAL_SECONDS,
3031
)
32+
from azure.monitor.opentelemetry.exporter._quickpulse._generated._configuration import QuickpulseClientConfiguration
3133
from azure.monitor.opentelemetry.exporter._quickpulse._generated._client import QuickpulseClient
3234
from azure.monitor.opentelemetry.exporter._quickpulse._generated.models import MonitoringDataPoint
3335
from azure.monitor.opentelemetry.exporter._quickpulse._state import (
@@ -82,8 +84,24 @@ def __init__(self, connection_string: Optional[str]) -> None:
8284
self._instrumentation_key = parsed_connection_string.instrumentation_key
8385
# TODO: Support AADaudience (scope)/credentials
8486
# Pass `None` for now until swagger definition is fixed
85-
self._client = QuickpulseClient(credential=None, endpoint=self._live_endpoint) # type: ignore
86-
# TODO: Support redirect
87+
config = QuickpulseClientConfiguration(credential=None) # type: ignore
88+
policies = [
89+
# TODO: Support redirect
90+
config.redirect_policy,
91+
# Needed for serialization
92+
ContentDecodePolicy(),
93+
# Logging for client calls
94+
config.http_logging_policy,
95+
# TODO: Support AADaudience (scope)/credentials
96+
config.authentication_policy,
97+
# Explicitly disabling to avoid tracing live metrics calls
98+
# DistributedTracingPolicy(),
99+
]
100+
self._client = QuickpulseClient(
101+
credential=None, # type: ignore
102+
endpoint=self._live_endpoint,
103+
policies=policies
104+
)
87105

88106
MetricExporter.__init__(
89107
self,

sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/_quickpulse/_generated/_operations/_operations.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ def is_subscribed(
230230
:raises ~azure.core.exceptions.HttpResponseError:
231231
"""
232232

233-
@distributed_trace
233+
# @distributed_trace
234234
def is_subscribed(
235235
self,
236236
endpoint: str = "https://global.livediagnostics.monitor.azure.com",
@@ -440,7 +440,7 @@ def publish(
440440
:raises ~azure.core.exceptions.HttpResponseError:
441441
"""
442442

443-
@distributed_trace
443+
# @distributed_trace
444444
def publish(
445445
self,
446446
endpoint: str = "https://global.livediagnostics.monitor.azure.com",

sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/_quickpulse/_generated/aio/_operations/_operations.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ async def is_subscribed(
150150
:raises ~azure.core.exceptions.HttpResponseError:
151151
"""
152152

153-
@distributed_trace_async
153+
# @distributed_trace_async
154154
async def is_subscribed(
155155
self,
156156
endpoint: str = "https://global.livediagnostics.monitor.azure.com",
@@ -360,7 +360,7 @@ async def publish(
360360
:raises ~azure.core.exceptions.HttpResponseError:
361361
"""
362362

363-
@distributed_trace_async
363+
# @distributed_trace_async
364364
async def publish(
365365
self,
366366
endpoint: str = "https://global.livediagnostics.monitor.azure.com",

0 commit comments

Comments
 (0)