Skip to content

Commit 02f478b

Browse files
authored
Use with_span
1 parent 173831c commit 02f478b

File tree

1 file changed

+3
-3
lines changed
  • instrumentation/httpx/lib/opentelemetry/instrumentation/httpx

1 file changed

+3
-3
lines changed

instrumentation/httpx/lib/opentelemetry/instrumentation/httpx/plugin.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ def call
4141
)
4242

4343
@span = tracer.start_span(span_name, attributes: attributes, kind: :client)
44-
trace_ctx = OpenTelemetry::Trace.context_with_span(@span)
45-
46-
OpenTelemetry.propagation.inject(@request.headers, context: trace_ctx)
44+
OpenTelemetry::Trace.with_span(@span) do
45+
OpenTelemetry.propagation.inject(@request.headers)
46+
end
4747
rescue StandardError => e
4848
OpenTelemetry.handle_error(exception: e)
4949
end

0 commit comments

Comments
 (0)