Skip to content

Commit

Permalink
fix errors in pymongo tests introduced in #1639 (#1648)
Browse files Browse the repository at this point in the history
* fix errors in pymongo tests introduced in #1639

* fix cursor refresh destination tracking
  • Loading branch information
beniwohli authored Oct 3, 2022
1 parent 21980d8 commit 5447d49
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion elasticapm/instrumentation/packages/pymongo.py
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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

0 comments on commit 5447d49

Please sign in to comment.