Skip to content

Commit 57f760d

Browse files
committed
remove custom context of botocore instrumentation (#372)
specifically, the `service` property clashes with the existing `context.service` property in the Elasticsearch storage backend backport of #367 to 3.x closes #372
1 parent 74aa969 commit 57f760d

File tree

3 files changed

+8
-10
lines changed

3 files changed

+8
-10
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Changelog
22

3+
## v3.0.5
4+
[Check the diff](https://github.com/elastic/apm-agent-python/compare/v3.0.4...v3.0.5)
5+
6+
* backported a quickfix for the boto3/botocore instrumentation (#372)
7+
38
## v3.0.4
49
[Check the diff](https://github.com/elastic/apm-agent-python/compare/v3.0.3...v3.0.4)
510

elasticapm/instrumentation/packages/botocore.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,11 @@ def call(self, module, method, wrapped, instance, args, kwargs):
1717
target_endpoint = instance._endpoint.host
1818
parsed_url = urlparse.urlparse(target_endpoint)
1919
if "." in parsed_url.hostname:
20-
service, region = parsed_url.hostname.split(".", 2)[:2]
20+
service = parsed_url.hostname.split(".", 2)[0]
2121
else:
22-
service, region = parsed_url.hostname, None
22+
service = parsed_url.hostname
2323

2424
signature = "{}:{}".format(service, operation_name)
25-
extra_data = {"service": service, "region": region, "operation": operation_name}
2625

27-
with capture_span(signature, "ext.http.aws", extra_data, leaf=True):
26+
with capture_span(signature, "ext.http.aws", leaf=True):
2827
return wrapped(*args, **kwargs)

tests/instrumentation/botocore_tests.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,6 @@ def test_botocore_instrumentation(mock_make_request, instrument, elasticapm_clie
2424
span = transaction.spans[0]
2525

2626
assert span.name == "ec2:DescribeInstances"
27-
assert span.context["service"] == "ec2"
28-
assert span.context["region"] == "us-west-2"
29-
assert span.context["operation"] == "DescribeInstances"
3027

3128

3229
def test_nonstandard_endpoint_url(instrument, elasticapm_client):
@@ -39,6 +36,3 @@ def test_nonstandard_endpoint_url(instrument, elasticapm_client):
3936
span = transaction.spans[0]
4037

4138
assert span.name == "example:DescribeInstances"
42-
assert span.context["service"] == "example"
43-
assert span.context["region"] is None
44-
assert span.context["operation"] == "DescribeInstances"

0 commit comments

Comments
 (0)