Open flood4life opened 1 month ago
We are looking into using the OpenTelemetry instrumenter for collecting traces, and our preliminary tests showed traces with a lot of connect spans:
connect
Upon closer inspection, we found that they're coming from the Sentry SDK:
It was somewhat surprising, because Sentry SpanProcessor is supposed to filter them out: https://github.com/getsentry/sentry-ruby/blob/master/sentry-opentelemetry/lib/sentry/opentelemetry/span_processor.rb#L82-L98
Then we found out that Net::HTTP OTEL instrumentation can produce both HTTP connect and connect spans: https://github.com/open-telemetry/opentelemetry-ruby-contrib/blob/b26b765b91b789bce25d47743326d3cc16b6feb7/instrumentation/net_http/lib/opentelemetry/instrumentation/net/http/patches/instrumentation.rb#L62-L68
HTTP connect
However, Sentry SpanProcessor will apply that logic only for spans with names starting with "HTTP".
For now, we have solved it internally by monkey-patching
if otel_span.name.start_with?("HTTP")
to
if otel_span.name.start_with?("HTTP") || otel_span.name == "connect"
And that seems to have resolved the issue for us, but this felt like something that belongs upstream.
Follow this guide: https://docs.sentry.io/platforms/ruby/tracing/instrumentation/opentelemetry/
Internal "connect" spans are not reported, just like internal "HTTP" spans
Internal "connect" spans are reported, unlike the internal "HTTP" spans
3.3.1
5.16.1
No response
thx @flood4life will fix this
Issue Description
We are looking into using the OpenTelemetry instrumenter for collecting traces, and our preliminary tests showed traces with a lot of
connect
spans:Upon closer inspection, we found that they're coming from the Sentry SDK:
It was somewhat surprising, because Sentry SpanProcessor is supposed to filter them out: https://github.com/getsentry/sentry-ruby/blob/master/sentry-opentelemetry/lib/sentry/opentelemetry/span_processor.rb#L82-L98
Then we found out that Net::HTTP OTEL instrumentation can produce both
HTTP connect
andconnect
spans: https://github.com/open-telemetry/opentelemetry-ruby-contrib/blob/b26b765b91b789bce25d47743326d3cc16b6feb7/instrumentation/net_http/lib/opentelemetry/instrumentation/net/http/patches/instrumentation.rb#L62-L68However, Sentry SpanProcessor will apply that logic only for spans with names starting with "HTTP".
For now, we have solved it internally by monkey-patching
to
And that seems to have resolved the issue for us, but this felt like something that belongs upstream.
Reproduction Steps
Follow this guide: https://docs.sentry.io/platforms/ruby/tracing/instrumentation/opentelemetry/
Expected Behavior
Internal "connect" spans are not reported, just like internal "HTTP" spans
Actual Behavior
Internal "connect" spans are reported, unlike the internal "HTTP" spans
Ruby Version
3.3.1
SDK Version
5.16.1
Integration and Its Version
No response
Sentry Config
No response