Skip to content

Commit 24cc3e2

Browse files
committed
Add "s3/"-prefix to S3 destination.service.resource
closes #1717
1 parent a78f764 commit 24cc3e2

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

CHANGELOG.asciidoc

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,14 @@ endif::[]
4343
* Fix spans being dropped if they don't have a name {pull}1770[#1770]
4444
* Fix AWS Lambda support when `event` is not a dict {pull}1775[#1775]
4545
* Fix deprecation warning with urllib3 2.0.0 pre-release versions {pull}1778[#1778]
46-
46+
* Fix span.context.destination.service.resource for S3 spans to have an "s3/" prefix. {pull}x[#x]
47+
+
48+
*Note*: While this is considered a bugfix, it can potentially be a breaking
49+
change in the Kibana APM app: It can break the history of the S3-Spans / metrics
50+
for users relying on `context.destination.service.resource`. If users happen to
51+
run agents both with and without this fix (for same or different languages), the
52+
same S3-buckets can appear twice in the service map (with and without
53+
s3-prefix).
4754
4855
4956
[[release-notes-6.x]]

elasticapm/instrumentation/packages/botocore.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ def handle_s3(operation_name, service, instance, args, kwargs, context):
123123
bucket = ""
124124
signature = f"S3 {operation_name} {bucket}"
125125

126-
context["destination"]["service"] = {"name": span_subtype, "resource": bucket, "type": span_type}
126+
context["destination"]["service"] = {"name": span_subtype, "resource": f"s3/{bucket}", "type": span_type}
127127

128128
return HandlerInfo(signature, span_type, span_subtype, span_action, context)
129129

tests/instrumentation/botocore_tests.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ def test_s3(instrument, elasticapm_client):
116116
assert span["context"]["destination"]["port"] == LOCALSTACK_ENDPOINT_URL.port
117117
assert span["context"]["destination"]["cloud"]["region"] == "us-east-1"
118118
assert span["context"]["destination"]["service"]["name"] == "s3"
119-
assert span["context"]["destination"]["service"]["resource"] == "xyz"
119+
assert span["context"]["destination"]["service"]["resource"] == "s3/xyz"
120120
assert span["context"]["destination"]["service"]["type"] == "storage"
121121
assert span["context"]["http"]["request"]["id"]
122122
assert spans[0]["name"] == "S3 CreateBucket xyz"

0 commit comments

Comments
 (0)