-
Notifications
You must be signed in to change notification settings - Fork 0
Update OtelLogStorageFactory to use last workflow-api changes
#1
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
| <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.
| * <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 needed anymore on the factory.
| jenkinsControllerOpenTelemetry = JenkinsControllerOpenTelemetry.get(); | ||
| otelTraceService = OtelTraceService.get(); | ||
| 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.
Let's instantiate everything once in the constructor without @Inject.
No NPE issue as everything comes from @Extension singleton instances.
| /** | ||
| * Workaround dependency injection problem. @Inject doesn't work here | ||
| */ | ||
| @NonNull | ||
| private JenkinsControllerOpenTelemetry getJenkinsControllerOpenTelemetry() { | ||
| if (jenkinsControllerOpenTelemetry == null) { | ||
| jenkinsControllerOpenTelemetry = JenkinsControllerOpenTelemetry.get(); | ||
| @Extension() | ||
| @Symbol("opentelemetry") | ||
| public static final class DescriptorImpl extends LogStorageFactoryDescriptor<OtelLogStorageFactory> { | ||
| @NonNull | ||
| @Override | ||
| public String getDisplayName() { | ||
| return "Open Telemetry"; | ||
| } | ||
| return jenkinsControllerOpenTelemetry; | ||
| } |
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 internal private method
| @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 internal private methods.
| @Extension() | ||
| @Symbol("opentelemetry") | ||
| public static final class DescriptorImpl extends LogStorageFactoryDescriptor<OtelLogStorageFactory> { |
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 "Open Telemetry"; |
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
| <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.
Update plugin due to upstream jenkinsci/workflow-api-plugin#417 changes.
OtelLogStorageFactoryto use theDescribable/Descriptorpattern, some cleanup of useless code