Skip to content
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

Replace inferred-spans extension with upstream contrib extension #370

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

JonasKunz
Copy link
Contributor

Closes #174.
Replaces the inferred-spans extension with the contributed upstream one, but maintains a backwards compatibility layer for the ELASTIC_ options because they are used a lot already in demos.

This PR is also kind of blocked by elastic/apm-data#321. That change did not make it into 8.15. We'll need that change to ship, otherwise the parent-child overriding won't wokr correctly, because the attribute elastic.is_child was renamed to is_child.

@JonasKunz JonasKunz force-pushed the inferred-spans-upstream branch from a874dbb to 8aa033c Compare August 19, 2024 08:19
@JonasKunz JonasKunz mentioned this pull request Aug 19, 2024
10 tasks
# Conflicts:
#	inferred-spans/README.md
#	inferred-spans/src/main/java/co/elastic/otel/profiler/InferredSpansAutoConfig.java
#	inferred-spans/src/test/java/co/elastic/otel/InferredSpansAutoConfigTest.java
#	licenses/more-licences.md
@JonasKunz
Copy link
Contributor Author

Support for is_child without the elastic prefix will be part of the 8.15.1 release.

@JonasKunz
Copy link
Contributor Author

Waiting on open-telemetry/opentelemetry-java-contrib#1533 to implement full backwards compatibility

@JonasKunz
Copy link
Contributor Author

open-telemetry/opentelemetry-java-contrib#1533 is now part of the included contrib version, so this PR is ready for review

@JonasKunz JonasKunz marked this pull request as ready for review January 3, 2025 13:16
@JonasKunz JonasKunz requested a review from a team January 3, 2025 13:16
Copy link
Member

@SylvainJuge SylvainJuge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job and very nice diff karma !

* Marker attribute for inferred spans. Does not have the elastic-prefix anymore because it has
* been contributed upstream
*/
AttributeKey<Boolean> IS_INFERRED = AttributeKey.booleanKey("is_inferred");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[minor] do we have a way to reuse the upstream attribute without duplicating it ?

Comment on lines +97 to +105
private SamplingProfiler extractProfiler(InferredSpansProcessor processor) {
try {
Field profilerField = processor.getClass().getDeclaredField("profiler");
profilerField.setAccessible(true);
return (SamplingProfiler) profilerField.get(processor);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[minor] wouldn't it be better to avoid using reflection and rely on a package-private helper class here ?

Comment on lines +59 to +61
.put("elastic.otel.inferred.spans.enabled", "true")
.put("elastic.otel.inferred.spans.logging.enabled", "false")
.put("elastic.otel.inferred.spans.backup.diagnostic.files", "true")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe it would be worth adding a test to test the priority between legacy and upstream config options, focusing only on a few basic ones (and we can assume the same priority is applied to others).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

Contribute upstream: inferred spans
2 participants