Skip to content

Commit e9f83e1

Browse files
make span attribute available to urllib (#1014)
1 parent 7deea05 commit e9f83e1

File tree

2 files changed

+3
-4
lines changed
  • instrumentation/opentelemetry-instrumentation-urllib/src/opentelemetry/instrumentation/urllib

2 files changed

+3
-4
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99

1010
### Fixed
1111

12+
- `opentelemetry-instrumentation-urllib` make span attributes available to sampler
13+
([1014](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1014))
1214
- `opentelemetry-instrumentation-flask` Fix non-recording span bug
1315
([#999])(https://github.com/open-telemetry/opentelemetry-python-contrib/pull/999)
1416
- `opentelemetry-instrumentation-tornado` Fix non-recording span bug

instrumentation/opentelemetry-instrumentation-urllib/src/opentelemetry/instrumentation/urllib/__init__.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -184,14 +184,11 @@ def _instrumented_open_call(
184184
}
185185

186186
with tracer.start_as_current_span(
187-
span_name, kind=SpanKind.CLIENT
187+
span_name, kind=SpanKind.CLIENT, attributes=labels
188188
) as span:
189189
exception = None
190190
if callable(request_hook):
191191
request_hook(span, request)
192-
if span.is_recording():
193-
span.set_attribute(SpanAttributes.HTTP_METHOD, method)
194-
span.set_attribute(SpanAttributes.HTTP_URL, url)
195192

196193
headers = get_or_create_headers()
197194
inject(headers)

0 commit comments

Comments
 (0)