Current unit and integration tests for instrumentors are using unittest mock objects in place of the real database driver frameworks, e.g. mysqlclient, psycopg2. These let us check how the drivers are being called, but not how the drivers are behaving while being instrumented. The latter is especially important for testing existing and future sqlcommenting functionality.
Describe the solution you'd like
Create a docker-test suite that will check existing db client instrumentor functionality such as:
sqlcommenting of query statements made by driver
span context matches sqlcomment content
db.statement attribute matches sqlcomment
configuration of above
This probably requires spinning up MySQL and PostgreSQL databases in containers that are queryable by instrumented database client services.
Neither MySQL nor PostgreSQL drivers can query sqlite3, else we could write unit/integration tests that read from file.
There is a 3rd party package I saw called testing.mysqld but we're not currently using that dep and it's been a while since its last release so I'd hesitate in adding it.
What problem do you want to solve?
Current unit and integration tests for instrumentors are using
unittest
mock objects in place of the real database driver frameworks, e.g. mysqlclient, psycopg2. These let us check how the drivers are being called, but not how the drivers are behaving while being instrumented. The latter is especially important for testing existing and future sqlcommenting functionality.Describe the solution you'd like
Create a docker-test suite that will check existing db client instrumentor functionality such as:
db.statement
attribute matches sqlcommentThis probably requires spinning up MySQL and PostgreSQL databases in containers that are queryable by instrumented database client services.
sqlcommenting is currently implemented for:
Describe alternatives you've considered
Neither MySQL nor PostgreSQL drivers can query sqlite3, else we could write unit/integration tests that read from file.
There is a 3rd party package I saw called testing.mysqld but we're not currently using that dep and it's been a while since its last release so I'd hesitate in adding it.
Additional Context
Was discussed here: https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2941/#discussion_r1850623119
Recent issue for implementing sqlcomment support for more instrumentors: https://github.com/open-telemetry/opentelemetry-python-contrib/issues/2902
Would you like to implement a fix?
None