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

fix errors in pymongo tests introduced in #1639 #1648

Merged
merged 2 commits into from Oct 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion elasticapm/instrumentation/packages/pymongo.py
Expand Up @@ -132,7 +132,8 @@ def call(self, module, method, wrapped, instance, args, kwargs):
span_type="db",
span_subtype="mongodb",
span_action="query",
extra={"destination": {}},
extra=context,
leaf=True,
) as span:
response = wrapped(*args, **kwargs)
if span.context and instance.address:
Expand Down
4 changes: 2 additions & 2 deletions tests/instrumentation/pymongo_tests.py
Expand Up @@ -99,7 +99,7 @@ def test_collection_count(instrument, elasticapm_client, mongo_database):
assert span["context"]["destination"] == {
"address": os.environ.get("MONGODB_HOST", "localhost"),
"port": int(os.environ.get("MONGODB_PORT", 27017)),
"service": {"name": "", "resource": "mongodb", "type": ""},
"service": {"name": "", "resource": "mongodb/elasticapm_test", "type": ""},
}


Expand Down Expand Up @@ -258,7 +258,7 @@ def test_collection_find(instrument, elasticapm_client, mongo_database):
assert span["context"]["destination"] == {
"address": os.environ.get("MONGODB_HOST", "localhost"),
"port": int(os.environ.get("MONGODB_PORT", 27017)),
"service": {"name": "", "resource/elasticapm_test": "mongodb", "type": ""},
"service": {"name": "", "resource": "mongodb/elasticapm_test", "type": ""},
}


Expand Down