-
Notifications
You must be signed in to change notification settings - Fork 77
Update OtelLogStorageFactory to use last workflow-api changes
#1176
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
Conversation
| <jenkins.baseline>2.504</jenkins.baseline> | ||
| <jenkins.version>${jenkins.baseline}.1</jenkins.version> |
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.
This bump is required due to the workflow-api bump.
We can file this bump as a separate PR if requested.
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.
Seems it's already been filed: #1168
| <exclusion> | ||
| <!-- provided by org.jenkins-ci.plugins:jackson2-api --> | ||
| <groupId>com.fasterxml.jackson.core</groupId> | ||
| <artifactId>jackson-core</artifactId> | ||
| </exclusion> | ||
| <exclusion> | ||
| <!-- provided by org.jenkins-ci.plugins:jackson2-api --> | ||
| <groupId>com.fasterxml.jackson.core</groupId> | ||
| <artifactId>jackson-databind</artifactId> | ||
| </exclusion> |
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.
Fix some "require upper bounds" maven issues.
pom.xml
Outdated
| <exclusion> | ||
| <groupId>org.apache.commons</groupId> | ||
| <artifactId>commons-compress</artifactId> | ||
| </exclusion> |
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.
Need to remove this exclusion due to https://issues.jenkins.io/browse/JENKINS-73355.
This dependency is mandatory for testcontainers.
This library has a test scope and is not bundled in the final HPI.
| * <p> | ||
| * See <a href="https://github.com/jenkinsci/pipeline-cloudwatch-logs-plugin/blob/pipeline-cloudwatch-logs-0.2/src/main/java/io/jenkins/plugins/pipeline_cloudwatch_logs/PipelineBridge.java">Pipeline Cloudwatch Logs - PipelineBridge</a> | ||
| */ | ||
| @Extension |
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.
With the Describable/Descriptor pattern, the @Extension is not supported anymore on the factory.
| System.setProperty("org.jenkinsci.plugins.workflow.steps.durable_task.DurableTaskStep.USE_WATCHING", "true"); | ||
| } | ||
|
|
||
| @Inject |
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.
We can't inject anymore with the @Extension removal.
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.
We use @Inject ~30 times in this plugin, is there a problem now with @Inject?
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.
It was only a problem here because LogStorageFactory is no longer an ExtensionPoint after the upstream changes and so the implementations are no longer singleton @Extensions and so dependency injection doesn't work. In other contexts, @Inject is fine.
| @PostConstruct | ||
| public void postConstruct() { | ||
| this.tracer = jenkinsControllerOpenTelemetry.getDefaultTracer(); |
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.
Useless with the @Extension removal.
| } | ||
|
|
||
| @Extension() | ||
| @Symbol("openTelemetry") |
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.
Describable/Descriptor pattern, the symbol "openTelemetry" is used for CasC configuration.
| @NonNull | ||
| @Override | ||
| public String getDisplayName() { | ||
| return "OpenTelemetry"; |
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.
Displayed in the new "Pipeline logging" global UI configuration, see jenkinsci/workflow-api-plugin#417
| static OtelLogStorageFactory get() { | ||
| return ExtensionList.lookupSingleton(OtelLogStorageFactory.class); | ||
| } |
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.
Unused method.
| System.setProperty("org.jenkinsci.plugins.workflow.steps.durable_task.DurableTaskStep.USE_WATCHING", "true"); | ||
| } | ||
|
|
||
| @Inject |
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.
We use @Inject ~30 times in this plugin, is there a problem now with @Inject?
|
@kuisathaverat Cyrille took a look at this and seems to be ok with it, but what do you think? Are you ok with the general idea of the API changes? Are you interested in having us help clean up all of the |
With great pleasure, thanks for the offer. |
|
@cyrille-leclerc Ok, does that mean you're planning on merging and releasing this PR? We'll need a coordinated release of this PR soon after jenkinsci/workflow-api-plugin#417 is released to avoid widespread breakage. We can mention the incompatibility in release notes and tell people not to update, but we'd want the release of this PR to go out roughly the same day as the upstream PR, or at least the next day. Let us know how you'd prefer to coordinate that. |
kuisathaverat
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.
this is a breaking change in the log API, I want to test it manually to verify any configuration is affected.
|
Hello @kuisathaverat , did you have the chance to check the changes? 🙏🏼 |
jenkinsci/workflow-api-plugin#417 changes the
LogStorageFactoryAPI in an incompatible way, see that PR for details and justification.This PR adapts to the upstream changes, and will need to be released roughly at the same time as that PR.
We are opening this draft PR to make sure the maintainers here are ok with the general idea and to help coordinate the release.
This PR applies the following changes:
OtelLogStorageFactoryto use theDescribable/Descriptorpattern, which requires some minor changes due toOtelLogStorageFactoryno longer being a singleton@Extensionpom.xmlas required by theworkflow-apiupdate, which requires some changes to fix dependency issues and upper bounds conflicts. We can file these updates as a standalone PR if desired.As the upstream changes allow users to configure functionality equivalent to
otel.logs.mirror_to_disk=truemechanism in a generic way (other than the caveat of no longer being able to print a link to the observability platform into the logs dynamically), the current plugin won't need theTee*classes anymore and the logging code can be simplified if desired. We can handle this simplification in a followup PR if you are interested.Testing done
Submitter checklist