Monitor and observe Jenkins with OpenTelemetry.
Visualize jobs and pipelines executions as distributed traces:
Example pipeline execution trace of a SpringBoot Maven going application
Visualize Jenkins and pipeline health indicators:
Example Kibana dashboard of the Jenkins and CI jobs health
Troubleshoot Jenkins performances with distributed tracing of HTTPs requests:
Example Jenkins HTTP trace
Using the OpenTelemetry Collector, you can use many monitoring backends to monitor Jenkins such as Jaeger, Zipkin, Prometheus, Elastic Observability and many others listed here.
Here are example architectures with Elastic, Jaeger, and Prometheus:
CI/CD Observability with Jaeger and Prometheus | CI/CD Observability with Elastic |
---|---|
Example Jenkins OpenTelemetry configuration
For details to set up Jenkins with Elastic, Jaeger or Prometheus, to configure the integration including using Jenkins Configuration as Code, see Setup and Configuration.
For details on how to explore and troubleshoot jobs and pipelines builds as traces, see Traces of Jobs and Pipeline Builds.
Example pipeline execution trace of a SpringBoot app built with Maven going through security checks with Snyk, deployed on a Maven repository and published as a Docker image
For details on the execution of pipeline plugin steps on the Jenkins build agents, activate tracing in the Jenkins build agents using:
otel.instrumentation.jenkins.agent.enabled=true
To activate detailed traces of the communication from the Jenkins Controller to the Jenkins Agents, activate the instrumentation of Jenkins remoting with:
otel.instrumentation.jenkins.remoting.enabled=true
Note that the instrumentation of Jenkins remoting is not feature complete and may not capture all the communication between the Jenkins Controller and the Jenkins Agents.
For details to set up Jenkins with Elastic, Jaeger or Prometheus, to configure the integration including using Jenkins Configuration as Code, see Setup and Configuration.
Monitor access to Jenkins to detect anomalous behaviours.
For details, see the security logs, metrics, and trace attributes here.
For details on how to store Jenkins pipelines build logs in an Observability backend like Elastic or Loki, see Storing Jenkins Pipeline Logs in an Observability Backend though OpenTelemetry.
Storing Jenkins pipeline logs in Elasticsearch and visualizing logs both in Kibana and through Jenkins GUI
List of other CI/CD tools that support OpenTelemetry traces and integrate with the Jenkins OpenTelemetryPlugin creating a distributed traces providing end to end visibility.
The OpenTelemetry Maven Extension is a Maven extension to instrument with traces steps of Maven builds, including capturing details of the produced artifacts for traceability.
ℹ️ For seamless and turnkey integration of the trace of the Maven builds that use the OpenTelemetry Maven Extension with the Jenkins trace, consider in the Jenkins configuration to enable "Export OpenTelemetry configuration as environment variables".
The OpenTelemetry Ansible Plugin is an Ansible callback to instrument with traces the tasks of Ansible playbooks.
ℹ️ For seamless and turnkey integration of the trace of the Ansible playbooks that use the OpenTelemetry plugin with the Jenkins trace, consider in the Jenkins configuration to enable "Export OpenTelemetry configuration as environment variables".
The PyTest Otel Plugin is a PyTest plugin to report each PyTest test as a span of a trace.
ℹ️ For seamless and turnkey integration of the trace of the PyTest tests that use the OpenTelemetry plugin with the Jenkins trace, consider in the Jenkins configuration to enable "Export OpenTelemetry configuration as environment variables".
The otel-cli
is a command line wrapper to observe the execution of a shell
command as an OpenTelemetry trace.
sh
, bat
, and powershell
steps with meaningful explanation thanks to labelsIf you use Jenkins pipelines in conjunction with the sh
, bat
, powershell
steps, then it's highly recommended using
the label
argument to add a meaningful explanation thanks to step labels. Example:
node {
sh(label: 'Maven verify', script: './mvnw deploy')
}
Navigate to the Jenkins OpenTelemetry Plugin configuration, in the "Advanced" section, add to the "Configuration Properties text area the following:
otel.exporter.otlp.protocol=http/protobuf
No test have been done on disabling the Groovy Sandbox and accessing the Jenkins pipeline logs APIs while enabling the Jenkins OpenTelemetry Plugin for the following reasons:
If you are limited with the current capabilities of the Jenkins OpenTelemetry Plugin and consider opening up the Groovy sandbox to workaround these limitations, please prefer to reach out to us creating an enhancement request so we can work together at productizing the proper secured solution to your problem.
If you'd like to see this plugin in action with some other integrations then refer to the demos.
Refer to our contribution guidelines
Licensed under Apache Software License 2, see LICENSE