File tree Expand file tree Collapse file tree 2 files changed +8
-12
lines changed
instrumentation/opentelemetry-instrumentation-aiohttp-client/src/opentelemetry/instrumentation/aiohttp_client Expand file tree Collapse file tree 2 files changed +8
-12
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
88## [ Unreleased] ( https://github.com/open-telemetry/opentelemetry-python/compare/v1.11.1-0.30b1...HEAD )
99
1010### Fixed
11+ - ` opentelemetry-instrumentation-aiohttp-client ` make span attributes available to sampler
1112- ` opentelemetry-instrumentation-aws-lambda ` Fixed an issue - in some rare cases (API GW proxy integration test)
1213 headers are set to None, breaking context propagators.
1314 ([ #1055 ] ( https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1055 ) )
Original file line number Diff line number Diff line change @@ -180,27 +180,22 @@ async def on_request_start(
180180
181181 http_method = params .method .upper ()
182182 request_span_name = f"HTTP { http_method } "
183+ request_url = remove_url_credentials (trace_config_ctx .url_filter (params .url )) if callable (trace_config_ctx .url_filter ) else remove_url_credentials (str (params .url )),
184+
185+ span_attributes = {
186+ SpanAttributes .HTTP_METHOD : http_method ,
187+ SpanAttributes .HTTP_URL : request_url ,
188+ }
183189
184190 trace_config_ctx .span = trace_config_ctx .tracer .start_span (
185191 request_span_name ,
186192 kind = SpanKind .CLIENT ,
193+ attributes = span_attributes
187194 )
188195
189196 if callable (request_hook ):
190197 request_hook (trace_config_ctx .span , params )
191198
192- if trace_config_ctx .span .is_recording ():
193- attributes = {
194- SpanAttributes .HTTP_METHOD : http_method ,
195- SpanAttributes .HTTP_URL : remove_url_credentials (
196- trace_config_ctx .url_filter (params .url )
197- )
198- if callable (trace_config_ctx .url_filter )
199- else remove_url_credentials (str (params .url )),
200- }
201- for key , value in attributes .items ():
202- trace_config_ctx .span .set_attribute (key , value )
203-
204199 trace_config_ctx .token = context_api .attach (
205200 trace .set_span_in_context (trace_config_ctx .span )
206201 )
You can’t perform that action at this time.
0 commit comments