Skip to content

Commit 4f9b66a

Browse files
authored
Remove status code 206 from retriable (Azure#38647)
1 parent 61d6697 commit 4f9b66a

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

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

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

1111
- Detect live metrics usage during runtime in addition to on startup
1212
([#37694](https://github.com/Azure/azure-sdk-for-python/pull/37694))
13+
- Remove status code `206` from retry code + only count batch level for statsbeat
14+
([#38647](https://github.com/Azure/azure-sdk-for-python/pull/38647))
1315

1416
### Other Changes
1517

sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/_constants.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
)
3232

3333
_RETRYABLE_STATUS_CODES = (
34-
206, # Partial success
3534
401, # Unauthorized
3635
403, # Forbidden
3736
408, # Request Timeout

sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/export/_base.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,8 +220,6 @@ def _transmit(self, envelopes: List[TelemetryItem]) -> ExportResult:
220220
for error in track_response.errors:
221221
if _is_retryable_code(error.status_code):
222222
resend_envelopes.append(envelopes[error.index]) # type: ignore
223-
if self._should_collect_stats():
224-
_update_requests_map(_REQ_RETRY_NAME[1], value=error.status_code)
225223
else:
226224
if not self._is_stats_exporter():
227225
logger.error(

sdk/monitor/azure-monitor-opentelemetry-exporter/tests/test_base_exporter.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -641,8 +641,9 @@ def test_statsbeat_206_retry(self, stats_mock):
641641
)
642642
result = exporter._transmit(custom_envelopes_to_export)
643643
stats_mock.assert_called_once()
644-
self.assertEqual(len(_REQUESTS_MAP), 3)
645-
self.assertEqual(_REQUESTS_MAP[_REQ_RETRY_NAME[1]][500], 1)
644+
# We do not record any network statsbeat for 206 status code
645+
self.assertEqual(len(_REQUESTS_MAP), 2)
646+
self.assertIsNone(_REQUESTS_MAP.get('retry'))
646647
self.assertEqual(_REQUESTS_MAP["count"], 1)
647648
self.assertIsNotNone(_REQUESTS_MAP[_REQ_DURATION_NAME[1]])
648649
self.assertEqual(result, ExportResult.FAILED_NOT_RETRYABLE)

0 commit comments

Comments
 (0)