-
Notifications
You must be signed in to change notification settings - Fork 761
Closed
Labels
Description
What problem do you want to solve?
Some platforms that use the Python db client component instrumentors don't need db.statement
population with sqlcomment -- see this issue comment. Currently this always happens as long as sqlcommenting is enabled, e.g.:
Attributes:
-> db.system: Str(postgresql)
-> db.name: Str(world-db)
-> db.statement: Str(SELECT * FROM city WHERE id = %s /*db_driver='psycopg2%%3A2.9.9',traceparent='00-acbdad825030e4fc58260b2bd9861eb3-451dac2c63520272-01'*/)
-> db.user: Str(world)
-> net.peer.name: Str(postgres-world-db)
-> net.peer.port: Int(5432)
Describe the solution you'd like
Implement support of a config so that Python db client component instrumentors only add sqlcomment to db.statement
when opted in. Default should not include the comment.
Changes are required in:
- DB-API integration: DB-API: db.statement inclusion of sqlcomment as opt-in #3115
- sqlalchemy instrumentor: SQLAlchemy: db.statement inclusion of sqlcomment as opt-in #3112
- psycopg2 instrumentor: DB drivers: db.statement inclusion of sqlcomment as opt-in #3121
- psycopg instrumentor: DB drivers: db.statement inclusion of sqlcomment as opt-in #3121
- mysqlclient instrumentor: DB drivers: db.statement inclusion of sqlcomment as opt-in #3121
- PyMySQL instrumentor: DB drivers: db.statement inclusion of sqlcomment as opt-in #3121
Describe alternatives you've considered
This is a short-term solution. Longer term, we need to start with a general semconv upgrade of the db driver/ORM instrumentors: #2453. Part of this is moving from assignment of db.statement
to db.query.text
.
Additional Context
Will append to changes made for #2936 and #2938
Would you like to implement a fix?
Yes