Closed JonasKunz closed 1 year ago
LGTM. Should we add a test case for that in https://github.com/elastic/apm/blob/main/tests/agents/json-specs/service_resource_inference.json though?
I gave it a shot and added the following test locally:
{
"span": {
"exit": "true",
"type": "storage",
"subtype": "s3",
"context": {
"service": {
"target": {
"type": "s3",
"name": "bucket-name"
}
}
}
},
"expected_resource": "s3/bucket-name",
"expected_service_target": {
"type": "s3",
"name": "bucket-name"
},
"failure_message": "For s3, the service.resource should follow the common pattern"
}
At least for the Java agent this test doesn't add any value, because it passes successfully without having implemented the new s3/
prefix behaviour. I think the reason is that the special case is not implemented in the inference logic, but inside the s3 instrumentation. Inside the instrumentation we explicitly assign the service.resource
field, therefore the inference doesn't get executed.
@z1c0 if you still see value in adding this test (e.g. for .Net) I can add it. Also please feel free to make any modifications to my suggested test.
You are absolutely right @JonasKunz - the test case does not add any value (same for .NET). Thanks for trying this out though.
This PR is essentially a followup of #683 regarding the second point in this comment:
The reason why this issue came back on the table is that @AlexanderWert encountered it in form of a defect in the UI (see elastic/apm-agent-java#2849).
Even though
context.destination.service.resource
is deprecated, it is likely to stay around for a while and impact UI features. Therefore we need to still fix it imo.To my knowledge, adding the
s3/
would have the following negative consequences:context.destination.service.resource
This list might not be exhaustive, feel free to comment if you come up with additional concerns.
In my opinion these negative consequences are acceptable, because I would classify this change as a bugfix. We should however explicitly highlight this change in the agent changelogs when implementing this spec update.
sanitize_field_names
)CODEOWNERS
)/
schedule YYYY-MM-DD
to the PR description.If this spec adds a new dynamic config option, add it to central config.