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

Change Spring Scheduling to not capture span for one-time jobs (only repeated jobs) #7760

Merged
merged 14 commits into from
Feb 13, 2023
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import static io.opentelemetry.javaagent.bootstrap.Java8BytecodeBridge.currentContext;
import static io.opentelemetry.javaagent.instrumentation.spring.scheduling.v3_1.SpringSchedulingSingletons.instrumenter;

import io.opentelemetry.api.trace.Span;
import io.opentelemetry.context.Context;
import io.opentelemetry.context.Scope;

Expand All @@ -25,7 +26,11 @@ public void run() {
}

Context parentContext = currentContext();
if (!instrumenter().shouldStart(parentContext, runnable)) {
// Spring scheduling generates lots of InProc dependencies which have a parent associated with
// them. Suppressing these kind of InProc dependencies will reduce data usage and cost for
// customers.
trask marked this conversation as resolved.
Show resolved Hide resolved
if (Span.fromContext(parentContext).getSpanContext().isValid()
|| !instrumenter().shouldStart(parentContext, runnable)) {
runnable.run();
return;
}
Expand Down