Skip to content

Commit

Permalink
Remove status code 206 from retriable (Azure#38647)
Browse files Browse the repository at this point in the history
  • Loading branch information
lzchen authored Nov 23, 2024
1 parent 61d6697 commit 4f9b66a
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 2 additions & 0 deletions sdk/monitor/azure-monitor-opentelemetry-exporter/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

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

### Other Changes

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
)

_RETRYABLE_STATUS_CODES = (
206, # Partial success
401, # Unauthorized
403, # Forbidden
408, # Request Timeout
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,6 @@ def _transmit(self, envelopes: List[TelemetryItem]) -> ExportResult:
for error in track_response.errors:
if _is_retryable_code(error.status_code):
resend_envelopes.append(envelopes[error.index]) # type: ignore
if self._should_collect_stats():
_update_requests_map(_REQ_RETRY_NAME[1], value=error.status_code)
else:
if not self._is_stats_exporter():
logger.error(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -641,8 +641,9 @@ def test_statsbeat_206_retry(self, stats_mock):
)
result = exporter._transmit(custom_envelopes_to_export)
stats_mock.assert_called_once()
self.assertEqual(len(_REQUESTS_MAP), 3)
self.assertEqual(_REQUESTS_MAP[_REQ_RETRY_NAME[1]][500], 1)
# We do not record any network statsbeat for 206 status code
self.assertEqual(len(_REQUESTS_MAP), 2)
self.assertIsNone(_REQUESTS_MAP.get('retry'))
self.assertEqual(_REQUESTS_MAP["count"], 1)
self.assertIsNotNone(_REQUESTS_MAP[_REQ_DURATION_NAME[1]])
self.assertEqual(result, ExportResult.FAILED_NOT_RETRYABLE)
Expand Down

0 comments on commit 4f9b66a

Please sign in to comment.