Skip to content

Conversation

@arielvalentin
Copy link
Contributor

@arielvalentin arielvalentin commented Nov 27, 2025

Implements a helper to propagate context via SQL comments as specified here:

Instrumentations MAY propagate context using SQL commenter by injecting comments into SQL queries before execution. SQL commenter-based context propagation SHOULD NOT be enabled by default, but instrumentation MAY allow users to opt into it.

The instrumentation implementation SHOULD append the comment to the end of the query. Semantic conventions for individual database systems MAY specify different format, which may include different position, encoding, or schema, depending on the specific database system’s requirements or preferences.

The instrumentation SHOULD allow users to pass a propagator to overwrite the global propagator. If no propagator is provided by the user, instrumentation SHOULD use the global propagator.

https://opentelemetry.io/docs/specs/semconv/database/database-spans/#context-propagation

This helper conforms to the propagator inject interface, since it does not ever extract values we are skipping that implementation.

Once the processors replaces the obfuscator then we can include the propagators in the SQL gems for trilogy, mysql2, and pg

See #479

Implements a helper to propagate context via SQL comments as specified here:

> Instrumentations MAY propagate context using SQL commenter by injecting comments into SQL queries before execution. SQL commenter-based context propagation SHOULD NOT be enabled by default, but instrumentation MAY allow users to opt into it.
>
> The instrumentation implementation SHOULD append the comment to the end of the query. Semantic conventions for individual database systems MAY specify different format, which may include different position, encoding, or schema, depending on the specific database system’s requirements or preferences.
>
> The instrumentation SHOULD allow users to pass a propagator to overwrite the global propagator. If no propagator is provided by the user, instrumentation SHOULD use the global propagator.

https://opentelemetry.io/docs/specs/semconv/database/database-spans/#context-propagation

This helper conforms to the propagator inject interface, since it does not ever extract values we are skipping that implementation.

Once the processors replaces the obfuscator then we can include the propagators in the SQL gems for trilogy, mysql2, and pg
- name: opentelemetry-sampler-xray
directory: sampler/xray
version_constant: [OpenTelemetry, Sampler, XRay, VERSION]
version_constant: [OpenTelemetry, Sampler, XRay, VERSION]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unrelated but I am fixing a missing new line at the end of this file

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.

1 participant