New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OTel span support #1886
Open
sdaubin
wants to merge
15
commits into
main
Choose a base branch
from
saxon/replace-otel-spans2
base: main
Could not load branches
Branch not found: {{ refName }}
Could not load tags
Nothing to show
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
OTel span support #1886
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sdaubin
commented
May 7, 2024
@@ -59,6 +58,10 @@ ExitTracer createTracer(Object invocationTarget, int signatureId, boolean dispat | |||
|
|||
ExitTracer createScalaTxnTracer(); | |||
|
|||
default ExitTracer createTracer(String metricName, int flags) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The createSegment
API still generates an asynchronous tracer, which is not what we want. And from the bridge there's no easy way to register a signature to get a signatureId
. This was the easiest way to get a normal, synchronous tracer.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
The java agent supports auto configuring the OTel SDK to report data to New Relic. Spans that are created with the span api are orphaned from New Relic data structures though. This returns spans backed by NR traces to generate metric and DT data.
This change hooks the
SdkTracerProvider.tracerBuilder
method and returns our tracer builder. When spans are started, we attempt to create a tracer. If successful, we return aSpan
implementation backed by the tracer, otherwise we return a no op span.There is some special logic based on the span kind:
consumer
We start an OtherTransaction for
consumer
span kind.server
We start a transaction for server spans and turn it into a web transaction.
client
For client spans, we either turn it into a database span or an external based on the span attributes.
Configuration
opentelemetry.sdk.spans.enabled
can be use to disable the span behavior.opentelemetry.instrumentation.{instrumentation-scope}.enabled
can be used to disable spans for a specific Opentelemetry libraryRelated Github Issue
Include a link to the related GitHub issue, if applicable
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