From 034c8cd7660243c8109a58033313c9417c68f350 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arthur=20Woimb=C3=A9e?= Date: Thu, 28 Nov 2024 16:23:42 +0100 Subject: [PATCH 1/4] configurable max backoff for GRPC exporter --- .../src/opentelemetry/exporter/otlp/proto/grpc/exporter.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/exporter/opentelemetry-exporter-otlp-proto-grpc/src/opentelemetry/exporter/otlp/proto/grpc/exporter.py b/exporter/opentelemetry-exporter-otlp-proto-grpc/src/opentelemetry/exporter/otlp/proto/grpc/exporter.py index 582d083e86..1b9488126e 100644 --- a/exporter/opentelemetry-exporter-otlp-proto-grpc/src/opentelemetry/exporter/otlp/proto/grpc/exporter.py +++ b/exporter/opentelemetry-exporter-otlp-proto-grpc/src/opentelemetry/exporter/otlp/proto/grpc/exporter.py @@ -185,6 +185,7 @@ class OTLPExporterMixin( timeout: Backend request timeout in seconds compression: gRPC compression method to use """ + _MAX_RETRY_TIMEOUT = 64 def __init__( self, @@ -286,12 +287,11 @@ def _export( # data.__class__.__name__, # delay, # ) - max_value = 64 # expo returns a generator that yields delay values which grow # exponentially. Once delay is greater than max_value, the yielded # value will remain constant. - for delay in _create_exp_backoff_generator(max_value=max_value): - if delay == max_value or self._shutdown: + for delay in _create_exp_backoff_generator(max_value=self._MAX_RETRY_TIMEOUT): + if delay == self._MAX_RETRY_TIMEOUT or self._shutdown: return self._result.FAILURE with self._export_lock: From 2819c2362ad1245e4e4b8946fa90810d069c33ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arthur=20Woimb=C3=A9e?= Date: Thu, 28 Nov 2024 16:32:37 +0100 Subject: [PATCH 2/4] update changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9b62a4ef39..fe1b08d35b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ([#4324](https://github.com/open-telemetry/opentelemetry-python/pull/4324)) - Remove `TestBase.assertEqualSpanInstrumentationInfo` method, use `assertEqualSpanInstrumentationScope` instead ([#4310](https://github.com/open-telemetry/opentelemetry-python/pull/4310)) +- Configurable max retry timeout for grpc exporter + ([#4328](https://github.com/open-telemetry/opentelemetry-python/pull/4328)) ## Version 1.28.0/0.49b0 (2024-11-05) From a4b87b3732aa5b5a29cf6259bb07bd8b42d11e24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arthur=20Woimb=C3=A9e?= Date: Thu, 28 Nov 2024 16:38:54 +0100 Subject: [PATCH 3/4] update pr link in changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fe1b08d35b..e13b18deec 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,7 +24,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Remove `TestBase.assertEqualSpanInstrumentationInfo` method, use `assertEqualSpanInstrumentationScope` instead ([#4310](https://github.com/open-telemetry/opentelemetry-python/pull/4310)) - Configurable max retry timeout for grpc exporter - ([#4328](https://github.com/open-telemetry/opentelemetry-python/pull/4328)) + ([#4333](https://github.com/open-telemetry/opentelemetry-python/pull/4333)) ## Version 1.28.0/0.49b0 (2024-11-05) From 996354253a75a6887d7af275fe334b39ca55d0f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arthur=20Woimb=C3=A9e?= Date: Thu, 28 Nov 2024 16:41:52 +0100 Subject: [PATCH 4/4] oops --- .../src/opentelemetry/exporter/otlp/proto/grpc/exporter.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/exporter/opentelemetry-exporter-otlp-proto-grpc/src/opentelemetry/exporter/otlp/proto/grpc/exporter.py b/exporter/opentelemetry-exporter-otlp-proto-grpc/src/opentelemetry/exporter/otlp/proto/grpc/exporter.py index 1b9488126e..9be4e505ac 100644 --- a/exporter/opentelemetry-exporter-otlp-proto-grpc/src/opentelemetry/exporter/otlp/proto/grpc/exporter.py +++ b/exporter/opentelemetry-exporter-otlp-proto-grpc/src/opentelemetry/exporter/otlp/proto/grpc/exporter.py @@ -185,6 +185,7 @@ class OTLPExporterMixin( timeout: Backend request timeout in seconds compression: gRPC compression method to use """ + _MAX_RETRY_TIMEOUT = 64 def __init__( @@ -290,7 +291,9 @@ def _export( # expo returns a generator that yields delay values which grow # exponentially. Once delay is greater than max_value, the yielded # value will remain constant. - for delay in _create_exp_backoff_generator(max_value=self._MAX_RETRY_TIMEOUT): + for delay in _create_exp_backoff_generator( + max_value=self._MAX_RETRY_TIMEOUT + ): if delay == self._MAX_RETRY_TIMEOUT or self._shutdown: return self._result.FAILURE