Skip to content

feat(sqlcommenter): add comment_position option to control SQL comment placement#4628

Open
RiyaChaturvedi37 wants to merge 3 commits into
open-telemetry:mainfrom
RiyaChaturvedi37:fix/sqlcommenter-clean
Open

feat(sqlcommenter): add comment_position option to control SQL comment placement#4628
RiyaChaturvedi37 wants to merge 3 commits into
open-telemetry:mainfrom
RiyaChaturvedi37:fix/sqlcommenter-clean

Conversation

@RiyaChaturvedi37
Copy link
Copy Markdown
Contributor

Problem
The SQL comment was always appended to the end of the query, which caused truncation issues in database query logs for long queries (e.g. queries produced by Django in AWS RDS logs).
Solution
Added a comment_position parameter to _add_sql_comment() that defaults to "end" (preserving existing behavior per OTel spec). Set comment_position="start" to prepend the comment instead.
Usage
python_add_sql_comment(sql, comment_position="start", **meta)
Notes

Default behavior unchanged
Part of a series of PRs adding comment_position support across instrumentation libraries
Replaces #4490

Part of #3583

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

1 participant