-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Scheduler: introduce SPI module and JobInstrumenter
- implement JobInstrumenter in OTel extension - remove the annotation transformer that adds OTel @WithSpan to @scheduled methods
- Loading branch information
Showing
17 changed files
with
235 additions
and
187 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
...n/java/io/quarkus/opentelemetry/deployment/scheduler/OpenTelemetrySchedulerProcessor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package io.quarkus.opentelemetry.deployment.scheduler; | ||
|
||
import io.quarkus.arc.deployment.AdditionalBeanBuildItem; | ||
import io.quarkus.deployment.Capabilities; | ||
import io.quarkus.deployment.Capability; | ||
import io.quarkus.deployment.annotations.BuildProducer; | ||
import io.quarkus.deployment.annotations.BuildStep; | ||
import io.quarkus.opentelemetry.deployment.OpenTelemetryEnabled; | ||
import io.quarkus.opentelemetry.runtime.scheduler.OpenTelemetryJobInstrumenter; | ||
|
||
public class OpenTelemetrySchedulerProcessor { | ||
|
||
@BuildStep(onlyIf = OpenTelemetryEnabled.class) | ||
void registerJobInstrumenter(Capabilities capabilities, BuildProducer<AdditionalBeanBuildItem> beans) { | ||
if (capabilities.isPresent(Capability.SCHEDULER)) { | ||
beans.produce(new AdditionalBeanBuildItem(OpenTelemetryJobInstrumenter.class)); | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
extensions/quartz/runtime/src/main/java/io/quarkus/quartz/runtime/InstrumentedJob.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package io.quarkus.quartz.runtime; | ||
|
||
import java.util.concurrent.CompletableFuture; | ||
import java.util.concurrent.CompletionStage; | ||
|
||
import org.quartz.Job; | ||
import org.quartz.JobExecutionContext; | ||
import org.quartz.JobExecutionException; | ||
import org.quartz.JobKey; | ||
|
||
import io.quarkus.scheduler.spi.JobInstrumenter; | ||
import io.quarkus.scheduler.spi.JobInstrumenter.JobInstrumentationContext; | ||
|
||
/** | ||
* | ||
* @see JobInstrumenter | ||
*/ | ||
class InstrumentedJob implements Job { | ||
|
||
private final Job delegate; | ||
private final JobInstrumenter instrumenter; | ||
|
||
InstrumentedJob(Job delegate, JobInstrumenter instrumenter) { | ||
this.delegate = delegate; | ||
this.instrumenter = instrumenter; | ||
} | ||
|
||
@Override | ||
public void execute(JobExecutionContext context) throws JobExecutionException { | ||
instrumenter.instrument(new JobInstrumentationContext() { | ||
|
||
@Override | ||
public CompletionStage<Void> executeJob() { | ||
try { | ||
delegate.execute(context); | ||
return CompletableFuture.completedFuture(null); | ||
} catch (Exception e) { | ||
return CompletableFuture.failedFuture(e); | ||
} | ||
|
||
} | ||
|
||
@Override | ||
public String getSpanName() { | ||
JobKey key = context.getJobDetail().getKey(); | ||
return key.getGroup() + '.' + key.getName(); | ||
} | ||
}); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 0 additions & 18 deletions
18
...z/runtime/src/main/java/io/quarkus/quartz/runtime/tracing/QuartzCodeAttributesGetter.java
This file was deleted.
Oops, something went wrong.
16 changes: 0 additions & 16 deletions
16
...tz/runtime/src/main/java/io/quarkus/quartz/runtime/tracing/QuartzErrorCauseExtractor.java
This file was deleted.
Oops, something went wrong.
14 changes: 0 additions & 14 deletions
14
...artz/runtime/src/main/java/io/quarkus/quartz/runtime/tracing/QuartzSpanNameExtractor.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.