newrelic / newrelic-java-agent

The New Relic Java agent
Apache License 2.0
202 stars 143 forks source link

SQS: adds attributes to spans that allow linking to SQS entities #1954

Closed meiao closed 4 months ago

meiao commented 4 months ago

Overview

Adds the following attributes to SQS external spans so they can be linked to the respective SQS entity.

Related Github Issue

1835

Testing

Testing for this feature is a hampered due to a dependency. When that dependency is updated, then the tests in the SQS instrumentation modules can be run.

API changes

There are a few changes to the external API. New attributes and methods were added to MessageProduceParameters and MessageConsumeParameters and their respective builders.

For the parameters the added methods are getters.

For the builders, new methods were added to the Build interface and all return a Build, so they can be concatenated. The new methods being on the Build interface, essentially make them optional (which they are), thus this addition will not break existing use of the API.

Another method that was added was an overload of the existing MessageConsumeParameters#library and MessageProduceParameters#library methods. This new method receives 2 Strings, the first one is the library name used by the agent, this matches the parameter for the existing method. A second String was added to record the name of the library used by OTEL, which in many cases is slightly different from the agent's. Since this is the first method called in the builder process, this also won't break existing use of the API.

Checks

codecov-commenter commented 4 months ago

Codecov Report

Attention: Patch coverage is 4.34783% with 22 lines in your changes missing coverage. Please review.

Project coverage is 70.58%. Comparing base (be49741) to head (e3e5d1b).

Files Patch % Lines
...elic/agent/service/analytics/SpanEventFactory.java 4.34% 20 Missing and 2 partials :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #1954 +/- ## ============================================ - Coverage 70.65% 70.58% -0.08% + Complexity 9861 9859 -2 ============================================ Files 827 827 Lines 39835 39857 +22 Branches 6066 6068 +2 ============================================ - Hits 28147 28134 -13 - Misses 8961 8994 +33 - Partials 2727 2729 +2 ```

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