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

NH-46327 APM Python accepts OTEL_SQLCOMMENTER_OPTIONS #182

Merged
merged 5 commits into from
Jul 25, 2023

Conversation

tammy-baylis-swi
Copy link
Contributor

@tammy-baylis-swi tammy-baylis-swi commented Jul 21, 2023

Updates APM Python custom distro to read and parse OTEL_SQLCOMMENTER_OPTIONS if set by customer and if OTEL_SQLCOMMENTER_ENABLED=true. The options are used to init all Otel Python instrumentors that have a sqlcommenting feature. For more details please see "How the two env vars work" section.

This also refactors existing ApmConfig.convert_to_bool as a class method so the distro class can also use it. Not ideal so let me know if it should be in its own class or some other way.

Unit tests added and updated.

Tested manually with results starting in "Results" section. It seems to work as all only the KVs enabled by options are added to sqlcomments, for example this for Flask with SQLAlchemy and MySQL only has db_driver and traceparent when all other options are False:

2023-07-24T23:55:39.935228Z 16 Query SELECT * FROM city WHERE id='1818' /*db_driver='mysqldb',traceparent='00-6268896697b0a44f98575a72d606120b-263f08ace2b0ddfc-01'*/

Please let me know if any questions or comments! 😺

@tammy-baylis-swi tammy-baylis-swi requested a review from a team July 25, 2023 00:19
@tammy-baylis-swi tammy-baylis-swi marked this pull request as ready for review July 25, 2023 00:19
Copy link

@xuan-cao-swi xuan-cao-swi left a comment

Choose a reason for hiding this comment

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

👍

@tammy-baylis-swi tammy-baylis-swi merged commit fe10c56 into main Jul 25, 2023
@tammy-baylis-swi tammy-baylis-swi deleted the NH-46327-expose-otel-commenter-options branch July 25, 2023 22:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants