Skip to content

Fix agentextension publishing and LocalRootSpan bug in agentextension#218

Merged
JonasKunz merged 1 commit into
elastic:mainfrom
JonasKunz:fix-agentextension
Apr 22, 2024
Merged

Fix agentextension publishing and LocalRootSpan bug in agentextension#218
JonasKunz merged 1 commit into
elastic:mainfrom
JonasKunz:fix-agentextension

Conversation

@JonasKunz

Copy link
Copy Markdown
Contributor

The release currently failed due to a gradle cautionary check, which is a false-positive in this case:

* What went wrong:
Execution failed for task ':agentextension:publishMavenPublicationToSonatypeRepository'.
> Failed to publish publication 'maven' to repository 'sonatype'
   > Artifact elastic-otel-agentextension-0.1.0.jar wasn't produced by this build.

I've fixed the issue by reusing the same logic for publishing a shadow-jar we use for publishing our distro agent.

Also this PR includes two bug-fixes I forgot about which are also included in #215 . Without those, the agent-extension will not work properly.

@Nullable
private static Span resolveRoot(Object span, Object rootSpanVal) {
if (rootSpanVal == LOCAL_ROOT_MARKER) {
return (Span) span;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This cast would cause an exception if the provided span is a MutableSpan. That's why I changed LocalRootSpan to operate on ReadableSpan instead of Span.

Logger logger = Logger.getLogger(SpanValueStorageProvider.class.getName());

static SpanValueStorageProvider get() {
try {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

FieldBackedSpanValueStorageProvider directly references SdkSpan. If they are in different class loaders, this causes an IllegalAccessError here, which we didn't account for yet.

@JonasKunz
JonasKunz requested a review from a team April 22, 2024 10:57
@JonasKunz
JonasKunz merged commit c005dfe into elastic:main Apr 22, 2024
@JonasKunz
JonasKunz deleted the fix-agentextension branch April 22, 2024 11:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants