Make requests span attributes available to samplers (#931)
This commit is contained in:
parent
7bb29bd9ab
commit
2ab66416ab
|
|
@ -11,6 +11,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
|
|
||||||
- `opentelemetry-instrumentation-dbapi` add experimental sql commenter capability
|
- `opentelemetry-instrumentation-dbapi` add experimental sql commenter capability
|
||||||
([#908](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/908))
|
([#908](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/908))
|
||||||
|
- `opentelemetry-instrumentation-requests` make span attribute available to samplers
|
||||||
|
([#931](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/931))
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -162,13 +162,15 @@ def _instrument(
|
||||||
|
|
||||||
url = remove_url_credentials(url)
|
url = remove_url_credentials(url)
|
||||||
|
|
||||||
|
span_attributes = {
|
||||||
|
SpanAttributes.HTTP_METHOD: method,
|
||||||
|
SpanAttributes.HTTP_URL: url,
|
||||||
|
}
|
||||||
|
|
||||||
with tracer.start_as_current_span(
|
with tracer.start_as_current_span(
|
||||||
span_name, kind=SpanKind.CLIENT
|
span_name, kind=SpanKind.CLIENT, attributes=span_attributes
|
||||||
) as span, set_ip_on_next_http_connection(span):
|
) as span, set_ip_on_next_http_connection(span):
|
||||||
exception = None
|
exception = None
|
||||||
if span.is_recording():
|
|
||||||
span.set_attribute(SpanAttributes.HTTP_METHOD, method)
|
|
||||||
span.set_attribute(SpanAttributes.HTTP_URL, url)
|
|
||||||
|
|
||||||
headers = get_or_create_headers()
|
headers = get_or_create_headers()
|
||||||
inject(headers)
|
inject(headers)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue