-
Notifications
You must be signed in to change notification settings - Fork 130
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
Inferred spans #1340
Inferred spans #1340
Conversation
AttributeKey.stringKey("code.stacktrace"); | ||
public static final AttributeKey<Boolean> LINK_IS_CHILD = AttributeKey.booleanKey("is_child"); | ||
public static final AttributeKey<Boolean> SPAN_IS_INFERRED = | ||
AttributeKey.booleanKey("is_inferred"); |
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.
is_child
and is_inferred
are feature-specific attributes which I don't see as candidated for SemConv.
Is there a best-practice for namespacing such attributes? E.g. to use the feature name as prefix (inferred_spans.
)?
static final String EXCLUDED_CLASSES_OPTION = "otel.inferred.spans.excluded.classes"; | ||
static final String INTERVAL_OPTION = "otel.inferred.spans.interval"; | ||
static final String DURATION_OPTION = "otel.inferred.spans.duration"; | ||
static final String LIB_DIRECTORY_OPTION = "otel.inferred.spans.lib.directory"; |
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.
Is there any recommended namespace here to use for the config options? Or is otel.inferred.spans
fine?
...c/test/java/io/opentelemetry/contrib/inferredspans/internal/asyncprofiler/JfrParserTest.java
Outdated
Show resolved
Hide resolved
...-spans/src/main/java/io/opentelemetry/contrib/inferredspans/internal/pooling/ObjectPool.java
Outdated
Show resolved
Hide resolved
...pans/src/test/java/io/opentelemetry/contrib/inferredspans/internal/SamplingProfilerTest.java
Outdated
Show resolved
Hide resolved
...pans/src/test/java/io/opentelemetry/contrib/inferredspans/internal/SamplingProfilerTest.java
Outdated
Show resolved
Hide resolved
@JonasKunz sorry, can you resolve new merge conflict? thanks |
# Conflicts: # dependencyManagement/build.gradle.kts
Description:
This PR adds an OpenTelemetry SDK Extension (SpanProcessor) for enriching traces with "inferred" spans derived from profiling data. It internally uses async-profiler 3.0 in wall-clock profiling mode.
This feature was originally added a few years ago to the Elastic APM Agent, we recently ported it to OpenTelemetry in our OpenTelemetry distro and would now like to contribute it to the OpenTelemetry community.
The feature works by keeping track of which spans are activated/deactivated on which threads via the OpenTelemetry context API. A log of these activations/deactivations is spilled to disk, while at the same time async-profiler is enabled to profile threads with active spans. After the profiling session ends (default is 10 seconds), the profiling JFR and the log of span activations is used to generate the synthetic inferred spans. Here is also a blogpost about the feature.
Because this feature was initially written for the classic Elastic APM Agent, it heavily tries to minimize allocations. As a result, the feature is almost allocation free, which unfortunately comes at the cost of a bit more complex code due to pooling.
Testing:
The algorithm for span inference has been ported without changes from the classic Elastic APM Agent and therefore is relatively battle tested. The PR also comes with a large set of test-cases for edge cases of the inference algorithm.
Documentation:
Just the README.MD added on how to use this extension either by manual setup or using SDK auto configuration.
It also documents some limitations of the inference algorithm.