Skip to content

Commit 2275bd0

Browse files
authored
Remove status code 206 from retriable (#1247)
1 parent 2e0710b commit 2275bd0

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

contrib/opencensus-ext-azure/CHANGELOG.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,13 @@
22

33
## Unreleased
44

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

710
Released 2024-01-03
11+
812
- Changed bit-mapping for `httpx` and `fastapi` integrations
913
([#1239](https://github.com/census-instrumentation/opencensus-python/pull/1239))
1014

contrib/opencensus-ext-azure/opencensus/ext/azure/common/transport.py

-3
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
_REACHED_INGESTION_STATUS_CODES = (200, 206, 402, 408, 429, 439, 500)
4040
REDIRECT_STATUS_CODES = (307, 308)
4141
RETRYABLE_STATUS_CODES = (
42-
206, # Partial success
4342
401, # Unauthorized
4443
403, # Forbidden
4544
408, # Request Timeout
@@ -214,8 +213,6 @@ def _transmit(self, envelopes):
214213
for error in data['errors']:
215214
if _status_code_is_retryable(error['statusCode']):
216215
resend_envelopes.append(envelopes[error['index']])
217-
if self._check_stats_collection():
218-
_update_requests_map('retry', value=error['statusCode']) # noqa: E501
219216
else:
220217
if not self._is_stats_exporter():
221218
logger.error(

contrib/opencensus-ext-azure/tests/test_transport_mixin.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -454,9 +454,10 @@ def test_statsbeat_206_partial_retry(self):
454454
],
455455
}))
456456
result = mixin._transmit([1, 2, 3])
457-
self.assertEqual(len(_requests_map), 3)
457+
# We do not record any network statsbeat for 206 status code
458+
self.assertEqual(len(_requests_map), 2)
458459
self.assertIsNotNone(_requests_map['duration'])
459-
self.assertEqual(_requests_map['retry'][500], 1)
460+
self.assertIsNone(_requests_map.get('retry'))
460461
self.assertEqual(_requests_map['count'], 1)
461462
self.assertEqual(result, TransportStatusCode.DROP)
462463
storage_mock.put.assert_called_once()

0 commit comments

Comments
 (0)