Skip to content

Commit

Permalink
Remove status code 206 from retriable (#1247)
Browse files Browse the repository at this point in the history
  • Loading branch information
lzchen authored Nov 22, 2024
1 parent 2e0710b commit 2275bd0
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
6 changes: 5 additions & 1 deletion contrib/opencensus-ext-azure/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,13 @@

## Unreleased

# 1.1.13
- Remove status code `206` from retry code + only count batch level for statsbeat
([#1247](https://github.com/census-instrumentation/opencensus-python/pull/1247))

## 1.1.13

Released 2024-01-03

- Changed bit-mapping for `httpx` and `fastapi` integrations
([#1239](https://github.com/census-instrumentation/opencensus-python/pull/1239))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
_REACHED_INGESTION_STATUS_CODES = (200, 206, 402, 408, 429, 439, 500)
REDIRECT_STATUS_CODES = (307, 308)
RETRYABLE_STATUS_CODES = (
206, # Partial success
401, # Unauthorized
403, # Forbidden
408, # Request Timeout
Expand Down Expand Up @@ -214,8 +213,6 @@ def _transmit(self, envelopes):
for error in data['errors']:
if _status_code_is_retryable(error['statusCode']):
resend_envelopes.append(envelopes[error['index']])
if self._check_stats_collection():
_update_requests_map('retry', value=error['statusCode']) # noqa: E501
else:
if not self._is_stats_exporter():
logger.error(
Expand Down
5 changes: 3 additions & 2 deletions contrib/opencensus-ext-azure/tests/test_transport_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -454,9 +454,10 @@ def test_statsbeat_206_partial_retry(self):
],
}))
result = mixin._transmit([1, 2, 3])
self.assertEqual(len(_requests_map), 3)
# We do not record any network statsbeat for 206 status code
self.assertEqual(len(_requests_map), 2)
self.assertIsNotNone(_requests_map['duration'])
self.assertEqual(_requests_map['retry'][500], 1)
self.assertIsNone(_requests_map.get('retry'))
self.assertEqual(_requests_map['count'], 1)
self.assertEqual(result, TransportStatusCode.DROP)
storage_mock.put.assert_called_once()
Expand Down

0 comments on commit 2275bd0

Please sign in to comment.