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

Add instrumentation for Quartz 2.0 #4017

Merged
merged 5 commits into from
Aug 31, 2021

Conversation

anuraaga
Copy link
Contributor

@anuraaga anuraaga commented Aug 30, 2021

Quartz 2.0 was released 11 years ago so should be a reasonable target - it has significant API changes from 1.x that affect instrumentation, notably getting the job name from a JobDetail.

Fixes #3967

@anuraaga anuraaga force-pushed the quartz-instrumentation branch from 6853697 to 8f7ca03 Compare August 30, 2021 04:54
/**
* Configures the {@link Scheduler} to enable tracing of jobs.
*
* <p><strong>NOTE:</strong> If there are job listeners already registered on the Scheduler that
Copy link
Contributor Author

@anuraaga anuraaga Aug 30, 2021

Choose a reason for hiding this comment

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

Note that unlike something like AWS SDK instrumentation, where a bad executioninterceptor doesn't kill the entire SDK experience, a job listener that throws in the begin listener will cause the job itself to not run. Presumably quartz users or implementations of quartz listeners do know that they cannot throw exceptions or have the scheduler completely broken, not just tracing.

@anuraaga
Copy link
Contributor Author

Build failure is OpenJ9 flake, will wait for comments / potential commits instead of rerunning


@Override
public void configure(Config config, IgnoredTypesBuilder builder) {
// Quartz executes jobs themselves in a synchronous, there's no reason to propagate context
Copy link
Member

Choose a reason for hiding this comment

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

"In a synchronous"? Do you mean that jobs themselves are executed synchronously?


@Override
public void jobExecutionVetoed(JobExecutionContext jobExecutionContext) {
// TODO(anuraaga): Consider adding an attribute for vetoed jobs.
Copy link
Member

Choose a reason for hiding this comment

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

Is a veto similar to cancelling? We have some <someting>.cancelled attributes being added in various instrumentations.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Let me leave this as a todo - I think cancelled is about right but lacking a semantic convention and significant knowledge of quartz will stick with simple for now.

Comment on lines 67 to 70
Throwable userError = error;
while (userError instanceof SchedulerException) {
userError = ((SchedulerException) userError).getUnderlyingException();
}
Copy link
Member

Choose a reason for hiding this comment

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

Should we use an ErrorCauseExtractor for that?

public class QuartzInstrumentationModule extends InstrumentationModule {

public QuartzInstrumentationModule() {
super("quartz", "quartz-1.7");
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't it be 2.0? Same in the package name

Suggested change
super("quartz", "quartz-1.7");
super("quartz", "quartz-2.0");

@anuraaga anuraaga merged commit 10bce56 into open-telemetry:main Aug 31, 2021
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.

Quartz Instrumentation Support
2 participants