From 311186992bf6effde06911948b56bb19c3b92f52 Mon Sep 17 00:00:00 2001 From: Riccardo Magliocchetti Date: Thu, 22 Jan 2026 16:25:04 +0100 Subject: [PATCH 1/2] opentelemetry-instrumentation-falcon: pass request attributes at span creation To ease sampling work. --- .../src/opentelemetry/instrumentation/falcon/__init__.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/instrumentation/opentelemetry-instrumentation-falcon/src/opentelemetry/instrumentation/falcon/__init__.py b/instrumentation/opentelemetry-instrumentation-falcon/src/opentelemetry/instrumentation/falcon/__init__.py index 33fe6d578b..3a8c7600aa 100644 --- a/instrumentation/opentelemetry-instrumentation-falcon/src/opentelemetry/instrumentation/falcon/__init__.py +++ b/instrumentation/opentelemetry-instrumentation-falcon/src/opentelemetry/instrumentation/falcon/__init__.py @@ -368,15 +368,16 @@ def __call__(self, env, start_response): start_time = time_ns() + attributes = otel_wsgi.collect_request_attributes( + env, self._sem_conv_opt_in_mode + ) span, token = _start_internal_or_server_span( tracer=self._otel_tracer, span_name=otel_wsgi.get_default_span_name(env), start_time=start_time, context_carrier=env, context_getter=otel_wsgi.wsgi_getter, - ) - attributes = otel_wsgi.collect_request_attributes( - env, self._sem_conv_opt_in_mode + attributes=attributes, ) active_requests_count_attrs = ( otel_wsgi._parse_active_request_count_attrs( @@ -386,8 +387,6 @@ def __call__(self, env, start_response): self.active_requests_counter.add(1, active_requests_count_attrs) if span.is_recording(): - for key, value in attributes.items(): - span.set_attribute(key, value) if span.is_recording() and span.kind == trace.SpanKind.SERVER: custom_attributes = ( otel_wsgi.collect_custom_request_headers_attributes(env) From 2b829a25b1d9ac0fd0b6ba55340b02d658f20e07 Mon Sep 17 00:00:00 2001 From: Riccardo Magliocchetti Date: Thu, 22 Jan 2026 16:29:58 +0100 Subject: [PATCH 2/2] Add changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 92fdec1d64..a4dbb3d25c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -37,6 +37,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ([#4051](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/4051)) - `opentelemetry-instrumentation-aiohttp-server` Implement new semantic convention opt-in migration ([#3980](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3980)) +- `opentelemetry-instrumentation-falcon`: pass request attributes at span creation + ([#4119](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/4119)) - `opentelemetry-instrumentation`: add database stability attribute setters in `_semconv` utilities ([#4108](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/4108))