Adopt OTel cicd.* semantic conventions incl cicd.* metrics and spans - #1251
Conversation
# Conflicts: # src/main/java/io/jenkins/plugins/opentelemetry/init/JenkinsExecutorMonitoringInitializer.java
# Conflicts: # src/main/java/io/jenkins/plugins/opentelemetry/init/JenkinsExecutorMonitoringInitializer.java # src/main/java/io/jenkins/plugins/opentelemetry/job/MonitoringRunListener.java # src/main/java/io/jenkins/plugins/opentelemetry/job/runhandler/DefaultRunHandler.java # src/main/java/io/jenkins/plugins/opentelemetry/job/runhandler/JobDslRunHandler.java # src/main/java/io/jenkins/plugins/opentelemetry/job/runhandler/MatrixRunHandler.java # src/main/java/io/jenkins/plugins/opentelemetry/semconv/ExtendedJenkinsAttributes.java
…ibutes replace them
kamphaus
left a comment
There was a problem hiding this comment.
I demoed this PR to some OpenTelemetry maintainers.
Here are 2 feedback items I will look into.
| public static LongUpDownCounter newCiCdPipelineRunActiveCounter(Meter meter) { | ||
| LongUpDownCounterBuilder cicdPipelineRunActiveCounterBuilder = meter.upDownCounterBuilder( | ||
| "cicd.pipeline.run.active") | ||
| .setUnit("{run}") | ||
| .setDescription("Number of active pipeline runs grouped by pipeline and state."); |
There was a problem hiding this comment.
Looking into this issue I couldn't reproduce it.
However I did find a type mismatch in CicdMetric: 6835e54
There was a problem hiding this comment.
Pull request overview
This PR advances the plugin’s adoption of OpenTelemetry cicd.* semantic conventions by introducing a global semConvStability switch (Jenkins-only vs OTel-only vs both), updating span/metric attributes accordingly, and adding cardinality protection for pipeline-name metric attributes. It also updates integration/unit tests and JCasC fixtures to cover the new configuration behavior and metrics export strategy.
Changes:
- Added
SemConvStabilityconfiguration (UI + JCasC fixtures) to control emitting legacy Jenkins vs OTel CI/CD semantic conventions (or both). - Implemented/rewired CI/CD metrics and span attribute emission to follow the selected semantic convention stability, with pipeline-name cardinality protection for metrics.
- Updated integration/unit tests and test harness metric export behavior to reduce flakiness and validate emitted metrics/spans.
Reviewed changes
Copilot reviewed 40 out of 40 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| src/test/resources/io/jenkins/plugins/opentelemetry/jcasc/zipkin.yml | Adds semConvStability to JCasC test input. |
| src/test/resources/io/jenkins/plugins/opentelemetry/jcasc/zipkin-expected.yml | Updates expected exported config to include semConvStability. |
| src/test/resources/io/jenkins/plugins/opentelemetry/jcasc/jaeger.yml | Adds semConvStability to JCasC test input. |
| src/test/resources/io/jenkins/plugins/opentelemetry/jcasc/jaeger-expected.yml | Updates expected exported config to include semConvStability. |
| src/test/resources/io/jenkins/plugins/opentelemetry/jcasc/elastic.yml | Adds semConvStability to JCasC test input. |
| src/test/resources/io/jenkins/plugins/opentelemetry/jcasc/elastic-expected.yml | Updates expected exported config to include semConvStability. |
| src/test/resources/io/jenkins/plugins/opentelemetry/jcasc/elastic-logs.yml | Adds semConvStability to JCasC test input (and fixes formatting). |
| src/test/resources/io/jenkins/plugins/opentelemetry/jcasc/elastic-logs-expected.yml | Updates expected exported config to include semConvStability. |
| src/test/resources/io/jenkins/plugins/opentelemetry/jcasc/elastic-logs-exclusive.yml | Adds semConvStability to JCasC test input (exclusive logs backend). |
| src/test/resources/io/jenkins/plugins/opentelemetry/jcasc/elastic-logs-exclusive-expected.yml | Updates expected exported config to include semConvStability. |
| src/test/resources/io/jenkins/plugins/opentelemetry/jcasc/configuration-as-code.yml | Adds semConvStability to JCasC test input. |
| src/test/resources/io/jenkins/plugins/opentelemetry/jcasc/configuration-as-code-expected.yml | Updates expected exported config to include semConvStability. |
| src/test/resources/io/jenkins/plugins/opentelemetry/jcasc/configuration-as-code-default.yml | Adds semConvStability to default JCasC config test input. |
| src/test/resources/io/jenkins/plugins/opentelemetry/jcasc/configuration-as-code-default-expected.yml | Updates expected exported default config to include semConvStability. |
| src/test/java/io/jenkins/plugins/opentelemetry/job/step/GitStepHandlerTest.java | Sets SemConvStability explicitly to keep assertions stable under the new toggle. |
| src/test/java/io/jenkins/plugins/opentelemetry/JenkinsOtelPluginIntegrationTest.java | Restores metrics assertions using explicit force-export and updates integration test setup. |
| src/test/java/io/jenkins/plugins/opentelemetry/JenkinsOpenTelemetryPluginConfigurationIntegrationTest.java | Adds a helper to force metric export after reconfiguration and validates reconfig behavior via metrics. |
| src/test/java/io/jenkins/plugins/opentelemetry/BaseIntegrationTest.java | Adds a shared forceMetricsExport() helper for integration tests. |
| src/main/resources/io/jenkins/plugins/opentelemetry/JenkinsOpenTelemetryPluginConfiguration/help-serviceName.html | Fixes malformed help HTML structure. |
| src/main/resources/io/jenkins/plugins/opentelemetry/JenkinsOpenTelemetryPluginConfiguration/help-semConvStability.html | Adds help text describing semantic convention stability and the restart implication. |
| src/main/resources/io/jenkins/plugins/opentelemetry/JenkinsOpenTelemetryPluginConfiguration/config.jelly | Adds the semConvStability select control to global configuration. |
| src/main/java/io/jenkins/plugins/opentelemetry/semconv/SemConvStability.java | Introduces the enum controlling legacy/OTel emission behavior. |
| src/main/java/io/jenkins/plugins/opentelemetry/semconv/ExtendedJenkinsAttributes.java | Deprecates legacy CI/CD attributes in favor of OTel incubating attributes and clarifies intent. |
| src/main/java/io/jenkins/plugins/opentelemetry/semconv/CicdMetrics.java | Adds OTel cicd.* metric builders and Jenkins→OTel value mapping helpers. |
| src/main/java/io/jenkins/plugins/opentelemetry/OpenTelemetryConfiguration.java | Adjusts test-mode metric export interval to reduce background scraping conflicts. |
| src/main/java/io/jenkins/plugins/opentelemetry/job/step/BuildTriggerStepHandler.java | Emits Jenkins vs OTel CI/CD pipeline-name attributes depending on semConvStability. |
| src/main/java/io/jenkins/plugins/opentelemetry/job/step/AbstractGitStepHandler.java | Emits Jenkins vs OTel VCS attributes depending on semConvStability. |
| src/main/java/io/jenkins/plugins/opentelemetry/job/runhandler/RunHandler.java | Adds getSpanName() to support low-cardinality pipeline naming. |
| src/main/java/io/jenkins/plugins/opentelemetry/job/runhandler/MatrixRunHandler.java | Refactors to use getSpanName() for consistent span naming. |
| src/main/java/io/jenkins/plugins/opentelemetry/job/runhandler/JobDslRunHandler.java | Uses getSpanName() and adjusts JobDSL naming logic. |
| src/main/java/io/jenkins/plugins/opentelemetry/job/runhandler/DefaultRunHandler.java | Implements getSpanName() and simplifies root span builder creation. |
| src/main/java/io/jenkins/plugins/opentelemetry/job/opentelemetry/OtelContextAwareAbstractRunListener.java | Injects and exposes SemConvStability for listeners. |
| src/main/java/io/jenkins/plugins/opentelemetry/job/MonitoringRunListener.java | Adds cicd.* metrics, cardinality protection, and convention-controlled span/metric attribute emission. |
| src/main/java/io/jenkins/plugins/opentelemetry/job/MonitoringPipelineListener.java | Adds convention-controlled step/task span attributes and worker attributes. |
| src/main/java/io/jenkins/plugins/opentelemetry/job/MonitoringBuildStepListener.java | Adds convention-controlled span attributes for freestyle build steps. |
| src/main/java/io/jenkins/plugins/opentelemetry/JenkinsOpenTelemetryPluginConfiguration.java | Persists semConvStability, adds UI fill/check endpoints, and restart warning validation. |
| src/main/java/io/jenkins/plugins/opentelemetry/JenkinsControllerOpenTelemetry.java | Exposes a testing-only metric reader accessor used by tests to force flush. |
| src/main/java/io/jenkins/plugins/opentelemetry/jenkins/OpenTelemetryConfigurerComputerListener.java | Adds convention-controlled worker resource attributes for agents. |
| src/main/java/io/jenkins/plugins/opentelemetry/init/JenkinsExecutorMonitoringInitializer.java | Adds cicd.worker.count emission and reorganizes executor/node metrics callbacks. |
| src/main/java/io/jenkins/plugins/opentelemetry/computer/MonitoringComputerListener.java | Adds convention-controlled worker attributes on controller/agent computers. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
The test works on Windows, hence no need to follow Copilot's suggestion to uncomment.
|
I'm not that familiar with |
|
It looks like these warnings are not really valid to me |

Related to #56
Building on #1096, we
semConvStabilityfor switching between legacy Jenkins semantic conventions, Otel semantic conventions or both. Switching setting displays a warning to restart Jenkins.semConvStabilityTesting done
Submitter checklist