diff --git a/CHANGELOG.md b/CHANGELOG.md index 8c353d3d8..7092f512e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed +- `opentelemetry-instrumentation-urllib` make span attributes available to sampler + ([1014](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1014)) - `opentelemetry-instrumentation-flask` Fix non-recording span bug ([#999])(https://github.com/open-telemetry/opentelemetry-python-contrib/pull/999) - `opentelemetry-instrumentation-tornado` Fix non-recording span bug diff --git a/instrumentation/opentelemetry-instrumentation-urllib/src/opentelemetry/instrumentation/urllib/__init__.py b/instrumentation/opentelemetry-instrumentation-urllib/src/opentelemetry/instrumentation/urllib/__init__.py index 636ce8d70..3e38999ac 100644 --- a/instrumentation/opentelemetry-instrumentation-urllib/src/opentelemetry/instrumentation/urllib/__init__.py +++ b/instrumentation/opentelemetry-instrumentation-urllib/src/opentelemetry/instrumentation/urllib/__init__.py @@ -184,14 +184,11 @@ def _instrument( } with tracer.start_as_current_span( - span_name, kind=SpanKind.CLIENT + span_name, kind=SpanKind.CLIENT, attributes=labels ) as span: exception = None if callable(request_hook): request_hook(span, request) - if span.is_recording(): - span.set_attribute(SpanAttributes.HTTP_METHOD, method) - span.set_attribute(SpanAttributes.HTTP_URL, url) headers = get_or_create_headers() inject(headers)