- Package Name: azure-monitor-opentelemetry-exporter
- Package Version: v1.0.0b48
- Operating System: Not relevant
- Python Version: 3.14
Describe the bug
When using azure-monitor-opentelemetry-exporter to export telemetry, and especially when instrumenting HTTP dependencies with httpx, together with sampling, one will encounter that some of the telemetry ends up without any attributes all, marking them in App Insights/Azure Monitor as HTTP POST N/A, HTTP GET N/A, etc.
To Reproduce
Setup Azure Monitor using the default configure_azure_monitor() without any arguments, leaving the default at RateLimitedSampler(5.0).
This triggers a bug in _rate_limited_sampler.py, line 133:
# current (buggy)
if sampling_percentage == 100.0:
new_attributes = {} # drops all input attributes
Expected behavior
When sampling creates a net set of attributes, it should not throw away the attributes already populated for the span:
# correct
if sampling_percentage == 100.0:
new_attributes = {} if attributes is None else dict(attributes)
# intentionally no _SAMPLE_RATE_KEY at 100% — that part is correct
Screenshots
Additional context
Especially prevalent with Async python code, but it may not be a requirement to trigger the condition.
Describe the bug
When using
azure-monitor-opentelemetry-exporterto export telemetry, and especially when instrumenting HTTP dependencies withhttpx, together with sampling, one will encounter that some of the telemetry ends up without any attributes all, marking them in App Insights/Azure Monitor as HTTP POST N/A, HTTP GET N/A, etc.To Reproduce
Setup Azure Monitor using the default
configure_azure_monitor()without any arguments, leaving the default atRateLimitedSampler(5.0).This triggers a bug in
_rate_limited_sampler.py, line 133:Expected behavior
When sampling creates a net set of attributes, it should not throw away the attributes already populated for the span:
Screenshots
Additional context
Especially prevalent with Async python code, but it may not be a requirement to trigger the condition.