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

Workaround NoClassDefFoundError in @PreDestroy waiting for MNG-7056 #1431

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ public final class OtelLifecycleParticipant extends AbstractMavenLifecyclePartic

private static final Logger logger = LoggerFactory.getLogger(OtelLifecycleParticipant.class);

private final OpenTelemetrySdkService openTelemetrySdkService;

private final OtelExecutionListener otelExecutionListener;

/**
Expand All @@ -30,6 +32,7 @@ public final class OtelLifecycleParticipant extends AbstractMavenLifecyclePartic
@Inject
OtelLifecycleParticipant(
OpenTelemetrySdkService openTelemetrySdkService, SpanRegistry spanRegistry) {
this.openTelemetrySdkService = openTelemetrySdkService;
this.otelExecutionListener = new OtelExecutionListener(spanRegistry, openTelemetrySdkService);
}

Expand All @@ -56,8 +59,16 @@ public void afterProjectsRead(MavenSession session) {
.setExecutionListener(
new ChainedExecutionListener(this.otelExecutionListener, initialExecutionListener));
logger.debug(
"OpenTelemetry: OpenTelemetry extension registered as execution listener. InitialExecutionListener: "
+ initialExecutionListener);
"OpenTelemetry: OpenTelemetry extension registered as execution listener. InitialExecutionListener: {}",
initialExecutionListener);
}
}

@Override
public void afterSessionEnd(MavenSession session) {
// Workaround https://issues.apache.org/jira/browse/MNG-8217
// close OpenTelemetry SDK in `afterSessionEnd()`
logger.debug("OpenTelemetry: After Maven session end, close OpenTelemetry SDK");
openTelemetrySdkService.close();
}
}
Loading