tortoiseorm: capture db.query.parameter.<key> under new semconv#4805
Draft
ocelotl wants to merge 2 commits into
Draft
tortoiseorm: capture db.query.parameter.<key> under new semconv#4805ocelotl wants to merge 2 commits into
ocelotl wants to merge 2 commits into
Conversation
Add a shared _set_db_query_parameters helper that emits one db.query.parameter.<key> attribute per prepared-statement parameter, keyed by name for named parameters and by 0-based index for positional parameters, with values stringified. Wire it into the dbapi CursorTracer so that, when capture_parameters is enabled, the legacy db.statement.parameters attribute is reported only in the old semconv while db.query.parameter.<key> is reported in the new (stable) database semconv. Parameters are not captured on batch operations (executemany), per the semantic conventions.
Capture SQL query parameters as db.query.parameter.<key> attributes when the new database semantic conventions are opted in, keeping the legacy db.statement.parameters blob only under old semconv. Parameters remain behind the existing capture_parameters opt-in and are not captured on execute_many batch operations. Extend tests to cover old, new and dup semconv modes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Records Tortoise ORM query parameters as
db.query.parameter.<key>under the new database semconv (keeping the legacydb.statement.parametersblob under the old semconv), behind the existingcapture_parametersopt-in, and not onexecute_manybatches.Part of #4787. Fixes #4795.
Type of change
How Has This Been Tested?
Does This PR Require a Core Repo Change?
Checklist: