diff --git a/contrib/opencensus-ext-azure/CHANGELOG.md b/contrib/opencensus-ext-azure/CHANGELOG.md index 174100a39..ad8e8d689 100644 --- a/contrib/opencensus-ext-azure/CHANGELOG.md +++ b/contrib/opencensus-ext-azure/CHANGELOG.md @@ -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)) diff --git a/contrib/opencensus-ext-azure/opencensus/ext/azure/common/transport.py b/contrib/opencensus-ext-azure/opencensus/ext/azure/common/transport.py index ed0e1f8ec..cf0cf622a 100644 --- a/contrib/opencensus-ext-azure/opencensus/ext/azure/common/transport.py +++ b/contrib/opencensus-ext-azure/opencensus/ext/azure/common/transport.py @@ -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 @@ -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( diff --git a/contrib/opencensus-ext-azure/tests/test_transport_mixin.py b/contrib/opencensus-ext-azure/tests/test_transport_mixin.py index 3a2c5d6aa..f955adfc5 100644 --- a/contrib/opencensus-ext-azure/tests/test_transport_mixin.py +++ b/contrib/opencensus-ext-azure/tests/test_transport_mixin.py @@ -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()