From bda17559535c91b5af6e5be865a436bf67afd9c4 Mon Sep 17 00:00:00 2001 From: Oleksii Shmalko Date: Tue, 19 May 2026 22:20:09 +0300 Subject: [PATCH] feat(openfeature): decrease default initialization timeout to 10s (#18169) We found that 30s timeout doesn't play well with gunicorn, which has 30s initialization timout for the worker. If the user naively calls `openfeature.api.set_provider()` at the top-level, RC failing to deliver configuration may bring their whole application down with hard-to-debug `[CRITICAL] WORKER TIMEOUT` error message. Decrease default timeout to 10s, which is enough when RC is working but not too long to cause other issues/upstream timeouts. Part of incident-54756, follow up to https://github.com/DataDog/dd-trace-py/pull/16650 Co-authored-by: brett.langdon (cherry picked from commit 017bc2a93c432210060c3feae83d093698478e73) --- ddtrace/internal/openfeature/_provider.py | 2 +- .../internal/settings/_supported_configurations.py | 1 + ddtrace/internal/settings/openfeature.py | 4 ++-- ...ix-openfeature-init-blocking-70c8d5a99287cc49.yaml | 2 +- supported-configurations.json | 11 ++++++++++- 5 files changed, 15 insertions(+), 5 deletions(-) diff --git a/ddtrace/internal/openfeature/_provider.py b/ddtrace/internal/openfeature/_provider.py index e92e6039459..258382d04d7 100644 --- a/ddtrace/internal/openfeature/_provider.py +++ b/ddtrace/internal/openfeature/_provider.py @@ -96,7 +96,7 @@ def __init__(self, *args: typing.Any, initialization_timeout: typing.Optional[fl self._metadata = Metadata(name="Datadog") self._status = ProviderStatus.NOT_READY - # Initialization timeout: constructor arg takes priority, then env var (default 30s) + # Initialization timeout: constructor arg takes priority, then env var if initialization_timeout is not None: self._initialization_timeout = initialization_timeout else: diff --git a/ddtrace/internal/settings/_supported_configurations.py b/ddtrace/internal/settings/_supported_configurations.py index 58146c8290d..7abbc0e0fc8 100644 --- a/ddtrace/internal/settings/_supported_configurations.py +++ b/ddtrace/internal/settings/_supported_configurations.py @@ -205,6 +205,7 @@ "DD_EXCEPTION_REPLAY_CAPTURE_MAX_FRAMES", "DD_EXCEPTION_REPLAY_ENABLED", "DD_EXPERIMENTAL_FLAGGING_PROVIDER_ENABLED", + "DD_EXPERIMENTAL_FLAGGING_PROVIDER_INITIALIZATION_TIMEOUT_MS", "DD_EXPERIMENTAL_PROPAGATE_PROCESS_TAGS_ENABLED", "DD_EXTERNAL_ENV", "DD_FALCON_DISTRIBUTED_TRACING", diff --git a/ddtrace/internal/settings/openfeature.py b/ddtrace/internal/settings/openfeature.py index ada8dd42fa1..a6324d1ccb8 100644 --- a/ddtrace/internal/settings/openfeature.py +++ b/ddtrace/internal/settings/openfeature.py @@ -32,11 +32,11 @@ class OpenFeatureConfig(DDConfig): # Provider initialization timeout in milliseconds. # Controls how long initialize() blocks waiting for the first Remote Config payload. - # Default is 30000ms (30 seconds), matching Java, Go, and Node.js SDKs. + # Default is 10000ms (10 seconds). initialization_timeout_ms = DDConfig.var( int, "DD_EXPERIMENTAL_FLAGGING_PROVIDER_INITIALIZATION_TIMEOUT_MS", - default=30000, + default=10000, ) _openfeature_config_keys = [ diff --git a/releasenotes/notes/fix-openfeature-init-blocking-70c8d5a99287cc49.yaml b/releasenotes/notes/fix-openfeature-init-blocking-70c8d5a99287cc49.yaml index 3622bad9ca7..a6de2e99e1d 100644 --- a/releasenotes/notes/fix-openfeature-init-blocking-70c8d5a99287cc49.yaml +++ b/releasenotes/notes/fix-openfeature-init-blocking-70c8d5a99287cc49.yaml @@ -9,6 +9,6 @@ features: - | openfeature: This introduces a configurable initialization timeout for ``DataDogProvider``. The timeout controls how long ``initialize()`` waits for configuration before returning, - and defaults to 30 seconds. Set it via the + and defaults to 10 seconds. Set it via the ``DD_EXPERIMENTAL_FLAGGING_PROVIDER_INITIALIZATION_TIMEOUT_MS`` environment variable or the ``init_timeout`` constructor parameter. diff --git a/supported-configurations.json b/supported-configurations.json index 0bbac4e12cb..e7c4c6f9659 100644 --- a/supported-configurations.json +++ b/supported-configurations.json @@ -1514,7 +1514,16 @@ { "implementation": "A", "type": "boolean", - "default": "false" + "default": "false", + "experimental": true + } + ], + "DD_EXPERIMENTAL_FLAGGING_PROVIDER_INITIALIZATION_TIMEOUT_MS": [ + { + "implementation": "A", + "type": "int", + "default": "10000", + "experimental": true } ], "DD_EXPERIMENTAL_PROPAGATE_PROCESS_TAGS_ENABLED": [