newrelic / newrelic-java-agent

The New Relic Java agent
Apache License 2.0
192 stars 140 forks source link

Linking DynamoDB queries to infra's entities #1868

Open meiao opened 3 weeks ago

meiao commented 3 weeks ago

Overview

This PR adds the ability to specify a cloud resource id to some externals. Having a cloud resource id in a span allows the queried infra entity to be linked to the APM entity.

Note that simply adding the cloud resource id is not enough to make the link. The type of entity must also be supported and instrumented.

To add the cloud resource id, use the new methods cloudResourceId(String) available in the builders for DatastoreParameters, MessageConsumeParameters and MessageProduceParameters.

This PR also populates this field for DynamoDB externals.

Related Github Issue

Fixes #1802

Testing

Instrumentation tests were already disabled because they were flaky in GHA. Furthermore, while trying to run the tests, an issue was found with some dependencies. So for now the instrumentation tests are on hold.

A new agent integration test was added to test the DynamoDB instrumentation.

Checks

codecov-commenter commented 3 weeks ago

Codecov Report

Attention: Patch coverage is 70.17544% with 17 lines in your changes are missing coverage. Please review.

Project coverage is 70.68%. Comparing base (f1e9c8c) to head (592a01d).

Files Patch % Lines
...java/com/newrelic/agent/tracers/DefaultTracer.java 46.66% 7 Missing and 1 partial :warning:
...om/newrelic/agent/util/AgentCollectionFactory.java 0.00% 5 Missing :warning:
...ewrelic/agent/bridge/DefaultCollectionFactory.java 60.00% 1 Missing and 1 partial :warning:
...n/java/com/newrelic/agent/util/AwsAccountUtil.java 90.47% 0 Missing and 2 partials :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #1868 +/- ## ========================================= Coverage 70.68% 70.68% - Complexity 9877 9893 +16 ========================================= Files 828 829 +1 Lines 39848 39897 +49 Branches 6064 6073 +9 ========================================= + Hits 28167 28203 +36 - Misses 8954 8962 +8 - Partials 2727 2732 +5 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.