Skip to content

RUBY-3952 Skip span work for spans with invalid contexts - #3123

Merged
comandeo-mongo merged 1 commit into
mongodb:masterfrom
comandeo-mongo:3952-otel-skip-invalid-spans
Oct 29, 2026
Merged

comandeo-mongo merged 1 commit into
mongodb:masterfrom
comandeo-mongo:3952-otel-skip-invalid-spans

Conversation

@comandeo-mongo

Copy link
Copy Markdown
Contributor

When tracing is enabled but no OpenTelemetry SDK is installed, every span the API returns has an invalid context. The driver still made each one current, processed the result and finished it. This returns early for those spans in both tracers, as the guidelines in mongodb/specifications#1986 recommend. It is the first of several small PRs that replace #3122.

Jira: https://jira.mongodb.org/browse/RUBY-3952

With no OpenTelemetry SDK installed and no valid parent, the API returns
spans whose context is invalid. They cannot be made current, recorded or
propagated, but the tracers still entered with_span, built the result
attributes and finished them for every operation and command. Return
before any of that, as the OpenTelemetry spec's performance guidelines
recommend.
@comandeo-mongo
comandeo-mongo marked this pull request as ready for review October 29, 2026 13:16
@comandeo-mongo
comandeo-mongo requested a review from a team as a code owner October 29, 2026 13:16
@comandeo-mongo
comandeo-mongo requested a review from jamis October 29, 2026 13:16
@comandeo-mongo
comandeo-mongo merged commit f468c5a into mongodb:master Oct 29, 2026
241 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants