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

Get rid of pymongo command in pymongo instrumentation span name #1247

Merged
merged 5 commits into from
Sep 9, 2022

Conversation

amitsetty
Copy link
Contributor

@amitsetty amitsetty commented Aug 27, 2022

As others have pointed out
open-telemetry/opentelemetry-java-instrumentation#341
by including the query within the span name we lead to very high cardinality which is too high to be useful and this can also lead to privacy concerns

This pull requests follows the logic found in the java and golang mongo instrumentations and does not include the entire command but the database name and command name within the span name

https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/main/instrumentation/mongo/mongo-3.1/library/src/main/java/io/opentelemetry/instrumentation/mongo/v3_1

https://github.com/open-telemetry/opentelemetry-go-contrib/blob/main/instrumentation/go.mongodb.org/mongo-driver/mongo/otelmongo/mongo.go

Fixes # (issue)

Type of change

Please delete options that are not relevant.

  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • test_pymongo.py

Does This PR Require a Core Repo Change?

  • No.

Checklist:

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

  • Followed the style guidelines of this project
  • Changelogs have been updated

@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Aug 27, 2022

CLA Signed

The committers listed above are authorized under a signed CLA.

@amitsetty amitsetty marked this pull request as ready for review August 27, 2022 10:57
@amitsetty amitsetty requested a review from a team as a code owner August 27, 2022 10:57
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.

While at it could you please check what's the semconv recommendation for this? Also please add some tests.

@amitsetty
Copy link
Contributor Author

Hey I checked the semconv recommendation and it seems like this is more in line with [https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/semantic_conventions/database.md](the conventions)

While being in line with all stated conventions there is an example within the conventions which shows instrumentation for a Mongo database. There is a small diff here where the example instrumentation contains a collection name - however the [https://api.mongodb.com/python/3.1/api/pymongo/monitoring.html](the pymongo library monitoring tool) does not return the collection name

More work could be done here in the future to try to add the collection name. In the meantime it is imperative that the instrumentation is in line with the overall database specification as having a very high cardinality leads the instrumentation to become a lot less useful

@amitsetty
Copy link
Contributor Author

Hey would love if someone could review this

@srikanthccv srikanthccv merged commit ff9651e into open-telemetry:main Sep 9, 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.

None yet

2 participants