File tree 2 files changed +9
-12
lines changed
instrumentation/opentelemetry-instrumentation-aiohttp-client/src/opentelemetry/instrumentation/aiohttp_client
2 files changed +9
-12
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
8
8
## [ Unreleased] ( https://github.com/open-telemetry/opentelemetry-python/compare/v1.11.1-0.30b1...HEAD )
9
9
10
10
### Fixed
11
+ - ` opentelemetry-instrumentation-aiohttp-client ` make span attributes available to sampler
12
+ ([ 1072] ( https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1072 ) )
11
13
- ` opentelemetry-instrumentation-aws-lambda ` Fixed an issue - in some rare cases (API GW proxy integration test)
12
14
headers are set to None, breaking context propagators.
13
15
([ #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(
180
180
181
181
http_method = params .method .upper ()
182
182
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
+ }
183
189
184
190
trace_config_ctx .span = trace_config_ctx .tracer .start_span (
185
191
request_span_name ,
186
192
kind = SpanKind .CLIENT ,
193
+ attributes = span_attributes
187
194
)
188
195
189
196
if callable (request_hook ):
190
197
request_hook (trace_config_ctx .span , params )
191
198
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
-
204
199
trace_config_ctx .token = context_api .attach (
205
200
trace .set_span_in_context (trace_config_ctx .span )
206
201
)
You can’t perform that action at this time.
0 commit comments