Update OtelLogStorageFactory to use last workflow-api changes#1
Update OtelLogStorageFactory to use last workflow-api changes#1
OtelLogStorageFactory to use last workflow-api changes#1Conversation
| <exclusion> | ||
| <groupId>org.apache.commons</groupId> | ||
| <artifactId>commons-compress</artifactId> | ||
| </exclusion> |
There was a problem hiding this comment.
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.
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.
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.
Useless internal private method
| @PostConstruct | ||
| public void postConstruct() { | ||
| this.tracer = jenkinsControllerOpenTelemetry.getDefaultTracer(); | ||
| } |
There was a problem hiding this comment.
Useless internal private methods.
| @Extension() | ||
| @Symbol("opentelemetry") | ||
| public static final class DescriptorImpl extends LogStorageFactoryDescriptor<OtelLogStorageFactory> { |
There was a problem hiding this comment.
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.
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.
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