Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create database client instrumentation docker-test #3032

Open
tammy-baylis-swi opened this issue Nov 20, 2024 · 0 comments
Open

Create database client instrumentation docker-test #3032

tammy-baylis-swi opened this issue Nov 20, 2024 · 0 comments

Comments

@tammy-baylis-swi
Copy link
Contributor

tammy-baylis-swi commented Nov 20, 2024

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:

  1. sqlcommenting of query statements made by driver
  2. span context matches sqlcomment content
  3. db.statement attribute matches sqlcomment
  4. configuration of above

This probably requires spinning up MySQL and PostgreSQL databases in containers that are queryable by instrumented database client services.

sqlcommenting is currently implemented for:

  1. Django ORM
  2. Flask 'ORM'
  3. SQLAlchemy
  4. psycopg2
  5. psycopg

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: #2941

Recent issue for implementing sqlcomment support for more instrumentors: #2902

Would you like to implement a fix?

None

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

No branches or pull requests

1 participant