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

Cast PyMongo commands as strings #1015

Closed

Conversation

DrMcTaco
Copy link

Description

Cast the pymongo command as a string when starting spans for pymongo events. When the getMore action is executed the command is an int.

Fixes #1012

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

querying a mongo collection for records when the batch size is less than the total number of records to be returned, e.g:

from pymongo import MongoClient
from opentelemetry import trace
from opentelemetry.trace import TracerProvider
from opentelemetry.instrumentation.pymongo import PymongoInstrumentor

trace.set_tracer_provider(TracerProvider())

PymongoInstrumentor().instrument()
client = MongoClient()
db = client["MongoDB_Database"]
collection = db["MongoDB_Collection"]
collection.find({'batch_size': 1})

Also ran the tox test suite.

Checklist:

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

@DrMcTaco DrMcTaco requested a review from a team as a code owner August 18, 2020 17:49
@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Aug 18, 2020

CLA Check

Copy link
Contributor

@codeboten codeboten left a comment

Choose a reason for hiding this comment

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

Thanks for the fix. It looks like the CLA still needs to be signed. It would be good to add a test validating the TypeError no longer occurs after the change.

@DrMcTaco
Copy link
Author

Thanks for the feedback. I need my CLA manager to approve, but I can write that test in the mean time.

@codeboten
Copy link
Contributor

@DrMcTaco any update on getting the CLA signed?

codeboten pushed a commit that referenced this pull request Sep 22, 2020
@codeboten
Copy link
Contributor

This has been fixed in #1132

@codeboten codeboten closed this Sep 22, 2020
alertedsnake pushed a commit to alertedsnake/opentelemetry-python that referenced this pull request Sep 25, 2020
srikanthccv pushed a commit to srikanthccv/opentelemetry-python that referenced this pull request Nov 1, 2020
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.

TypeError with pymongo getMore operations
2 participants