newrelic / newrelic-java-agent

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

NR-134815 Treat OTel WithSpan annotation as Trace #1841

Closed sdaubin closed 1 month ago

sdaubin commented 1 month ago

NR-134815

Overview

There is a java OpenTelemetry library that contains a WithSpan annotation designed to work the same as our Trace annotation. By adding support for this annotation we increase our adoption of Otel. It allows customers to use this open source annotation instead of our proprietary annotation (in many cases).

I think we can defer suppressing this instrumentation (otel.instrumentation.opentelemetry-instrumentation-annotations.exclude-methods) and adding support for otel.instrumentation.methods.include until later.

Note that OTel properties can be set through environment or system properties, like our agent, and eventually through a config file. We can use our existing otel instrumentation model to get access to the normalized version of the instrumentation settings to include and exclude methods and pass those to the core agent through the bridge.

https://opentelemetry.io/docs/languages/java/automatic/annotations/

Related Github Issue

https://new-relic.atlassian.net/issues/NR-134815

Testing

The agent includes a suite of tests which should be used to verify your changes don't break existing functionality. These tests will run with Github Actions when a pull request is made. More details on running the tests locally can be found here,

Checks

codecov-commenter commented 1 month ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 70.87%. Comparing base (ef98cb6) to head (504507c).

:exclamation: Current head 504507c differs from pull request most recent head da2f302. Consider uploading reports for the commit da2f302 to get more accurate results

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #1841 +/- ## ============================================ + Coverage 70.01% 70.87% +0.85% - Complexity 9874 9972 +98 ============================================ Files 829 829 Lines 39984 39985 +1 Branches 6058 6058 ============================================ + Hits 27995 28338 +343 + Misses 9305 8916 -389 - Partials 2684 2731 +47 ```

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