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

Extending SQLCommenter support of dbapi into psycopg2 #940

Merged

Conversation

Thiyagu55
Copy link
Contributor

@Thiyagu55 Thiyagu55 commented Mar 2, 2022

Description

This PR integrates SQLCommenter into Psycopg2. When SQLCommenter is enabled in the library the SQL query logs will have traceparent id appended.

It's enabled using flag enable_commenter
Psycopg2Instrumentor()._instrument(tracer_provider=provider, enable_commenter=True)

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

  • tox -e py39-test-instrumentation-psycopg2
  • tox -e docker-tests

Does This PR Require a Core Repo Change?

  • Yes. - Link to PR:

Checklist:

See contributing.md for styleguide, changelog guidelines, and more.

  • Followed the style guidelines of this project
  • Changelogs have been updated
  • Unit tests have been added
  • Documentation has been updated

@Thiyagu55 Thiyagu55 requested a review from a team March 2, 2022 10:34
@Thiyagu55 Thiyagu55 marked this pull request as draft March 2, 2022 10:34
@Thiyagu55 Thiyagu55 marked this pull request as ready for review March 2, 2022 12:42
Copy link
Member

@srikanthccv srikanthccv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Thiyagu55 Can you add a test for this

@Thiyagu55
Copy link
Contributor Author

Thiyagu55 commented Mar 7, 2022

@Thiyagu55 Can you add a test for this
@srikanthccv

  1. It's just an extension of dbapi as this PR involves only passing enable_commenter param
  2. We can't add test for mock connection

@ocelotl
Copy link
Contributor

ocelotl commented Mar 9, 2022

@Thiyagu55 Can you add a test for this
@srikanthccv

  1. It's just an extension of dbapi as this PR involves only passing enable_commenter param
  2. We can't add test for mock connection

A test case for this change can be very simple, making sure the default value is False, that passing enable_commenter is read into kwargs, etc.

@srikanthccv
Copy link
Member

And you can add some integration tests here enabling this feature.

@Thiyagu55
Copy link
Contributor Author

And you can add some integration tests here enabling this feature.

@srikanthccv @ocelotl Unit tests and integration tests have been added and PR description is updated

@srikanthccv
Copy link
Member

@Thiyagu55 Please fix the failing tests

@Thiyagu55 Thiyagu55 force-pushed the sqlcommenter-psycopg2-integration-v2 branch from bad6b36 to 36737e4 Compare March 17, 2022 05:54
@ocelotl ocelotl merged commit e861b93 into open-telemetry:main Mar 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants