-
Notifications
You must be signed in to change notification settings - Fork 51
Add SynchronousNonBlockingStepExecution.ExecutorServiceAugmentor extension point
#226
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
base: master
Are you sure you want to change the base?
Add SynchronousNonBlockingStepExecution.ExecutorServiceAugmentor extension point
#226
Conversation
|
I am not sure I follow the use case, and there is no downstream PR. My general recommendation for any code creating an try { // TODO Java 21+
return (ExecutorService) Executors.class.getMethod("newVirtualThreadPerTaskExecutor").invoke(null);
} catch (NoSuchMethodException x) {
return Executors.newCachedThreadPool(/* as before */);
} catch (Exception x) {
throw new AssertionError(x);
}which should probably be made into an API in Jenkins core. |
Just filed the downstream PR: jenkinsci/opentelemetry-plugin#1139 |
My (limited) understanding of the current state with virtual threads was that unless you are running homogenous tasks that you know do not use |
|
FTR @jgreffe if you want to update the PR description here is some extra context:
In order for this to work, plugins need access to an OTel
There may be other ways to accomplish the same use case, but we have not explored them at this time:
|
dwnusbaum
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a comment with some context after thinking about possible alternative approaches. I also added some comments upstream about the fact that the new extension point wouldn't work for dynamic plugin installations, but IDK how important that is.
src/main/java/org/jenkinsci/plugins/workflow/steps/SynchronousNonBlockingStepExecution.java
Show resolved
Hide resolved
src/main/java/org/jenkinsci/plugins/workflow/steps/SynchronousNonBlockingStepExecution.java
Outdated
Show resolved
Hide resolved
Sure, it depends on what the thread is doing. Anyway that is irrelevant to the apparent purpose of this API based on the downstream PR. |
@jglick : then should I apply your suggestion? #226 (comment) |
|
Looking into a similar case in jenkinsci/opentelemetry-plugin#1137, I also thought about instead adding a dependency on I am a little more hesitant about adding dependencies to this plugin than to |
sandeepbarnwal
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
SynchronousNonBlockingStepExecutorServiceAugmentorSynchronousNonBlockingStepExecution.ExecutorServiceAugmentor extension point
I would rather avoid that. |
|
@jglick , @dwnusbaum , could you have a look at the last state? 🙏🏼 |
|
@jgreffe This looks more or less fine to me, but I think we should wait until we have time to discuss with the OTel maintainers in a week or so to make sure we are aligned on the various changes we have been looking into. I don't want to merge this until we are confident that the downstream PR will be accepted. |
|
Moving it to draft then @dwnusbaum |
Signed-off-by: Julien Greffe <jgreffe@cloudbees.com>
Allow the
executorServiceto be augmented.This avoids having to use reflection by dependent plugins.
See jenkinsci/opentelemetry-plugin#1139 for the consumer.
Updated with comment from @dwnusbaum
Testing done
Submitter checklist