Skip to content

Commit 1b2d6b5

Browse files
kuisathaveratv1v
andauthored
feat: Support 8.18.0/9.0.0 and EDOT (#1081)
* feat: demo EDOT * test: update docker configuration * test: ignore tests * fix: update index patterns * fix: links * fix: retrieve logs * chore: remove deprecated * fix: support APM and EDOT * fix: add demo command and docs * fix: migrate to apache-httpcomponents-client-5-api fix: review ependencies * fix: update test * test: junit5 * test: stop SDK * fix: HttpContext cast * test: ignore IT test for the moment * test: use @disabled from JUnit5 * fix: select transaction type * feat: grafana demo * Apply suggestions from code review Co-authored-by: Victor Martinez <[email protected]> --------- Co-authored-by: Victor Martinez <[email protected]>
1 parent 7a68081 commit 1b2d6b5

File tree

61 files changed

+1562
-1315
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+1562
-1315
lines changed

.editorconfig

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,7 @@ insert_final_newline = true
3131
[*.java]
3232
indent_style = space
3333
trim_trailing_whitespace = true
34+
35+
[Makefile]
36+
indent_style = tab
37+
trim_trailing_whitespace = true

README.md

Lines changed: 25 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,21 @@ Monitor and observe Jenkins with OpenTelemetry.
1313

1414
Visualize jobs and pipelines executions as distributed traces:
1515

16-
<img alt="SpringBootPipeline Execution Trace" width="400px" src="https://raw.githubusercontent.com/jenkinsci/opentelemetry-plugin/master/docs/images/jenkins-maven-execution-trace-jaeger.png" />
17-
<p style="font-size:0.75em; font-style: italic">Example pipeline execution trace of a SpringBoot Maven going application</p>
16+
![SpringBootPipeline Execution Trace](docs/images/jenkins-maven-execution-trace-jaeger.png)
1817

18+
*Example pipeline execution trace of a SpringBoot Maven going application*
1919

2020
Visualize Jenkins and pipeline health indicators:
2121

22-
<img alt="Example Kibana dashboard of the Jenkins and CI jobs health" width="400px" src="https://raw.githubusercontent.com/jenkinsci/opentelemetry-plugin/master/docs/images/kibana_jenkins_overview_dashboard.png" />
23-
<p style="font-size:0.75em; font-style: italic">Example Kibana dashboard of the Jenkins and CI jobs health</p>
22+
![Example Kibana dashboard of the Jenkins and CI jobs health](docs/images/kibana_jenkins_overview_dashboard.png)
23+
24+
*Example Kibana dashboard of the Jenkins and CI jobs health*
2425

2526
Troubleshoot Jenkins performances with distributed tracing of HTTPs requests:
2627

27-
<img alt="Jenkins HTTP request trace with Jaeger" width="400px" src="https://raw.githubusercontent.com/jenkinsci/opentelemetry-plugin/master/docs/images/http-tracing/jenkins-http-request-trace-jaeger.png" />
28-
<p style="font-size:0.75em; font-style: italic">Example Jenkins HTTP trace</p>
28+
![Jenkins HTTP request trace with Jaeger](docs/images/http-tracing/jenkins-http-request-trace-jaeger.png)
29+
30+
*Example Jenkins HTTP trace*
2931

3032
## Architecture
3133

@@ -37,7 +39,7 @@ Here are example architectures with Elastic, Jaeger, and Prometheus:
3739

3840
| CI/CD Observability with Jaeger and Prometheus | CI/CD Observability with Elastic |
3941
|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
40-
| <img alt="Jenkins monitoring with Jaeger and Prometheus" width="400" src="https://raw.githubusercontent.com/jenkinsci/opentelemetry-plugin/master/docs/images/jenkins-opentelemetry-architecture-jaeger-prometheus.png" > | <img alt="Jenkins monitoring with Elastic Observability" width="400" src="https://raw.githubusercontent.com/jenkinsci/opentelemetry-plugin/master/docs/images/jenkins-opentelemetry-architecture-elastic.png" > |
42+
| ![Jenkins monitoring with Jaeger and Prometheus](docs/images/jenkins-opentelemetry-architecture-jaeger-prometheus.png) | ![Jenkins monitoring with Elastic Observability](docs/images/jenkins-opentelemetry-architecture-elastic.png) |
4143

4244
## Getting started
4345

@@ -63,9 +65,9 @@ Here are example architectures with Elastic, Jaeger, and Prometheus:
6365
* Set up Jenkins health dashboards on your OpenTelemetry metrics visualization solution. See details including guidance
6466
for Elastic Kibana [here](https://github.com/jenkinsci/opentelemetry-plugin/blob/master/docs/monitoring-metrics.md).
6567

66-
<img alt="Sample Configuration" width="300px" src="https://raw.githubusercontent.com/jenkinsci/opentelemetry-plugin/master/docs/images/jenkins-opentelemetry-plugin-configuration.png" />
68+
![Sample Configuration](docs/images/jenkins-opentelemetry-plugin-configuration.png)
6769

68-
<p style="font-size:0.75em; font-style: italic">Example Jenkins OpenTelemetry configuration</p>
70+
*Example Jenkins OpenTelemetry configuration*
6971

7072
## Setup and Configuration
7173

@@ -78,33 +80,29 @@ see [Setup and Configuration](https://github.com/jenkinsci/opentelemetry-plugin/
7880
For details on how to explore and troubleshoot jobs and pipelines builds as traces,
7981
see [Traces of Jobs and Pipeline Builds](https://github.com/jenkinsci/opentelemetry-plugin/blob/master/docs/job-traces.md).
8082

81-
<img alt="SpringBootPipeline Execution Trace" width="300px" src="https://raw.githubusercontent.com/jenkinsci/opentelemetry-plugin/master/docs/images/jenkins-maven-execution-trace-jaeger.png" />
82-
<p style="font-size:0.75em; font-style: italic">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</p>
83+
![SpringBootPipeline Execution Trace](docs/images/jenkins-maven-execution-trace-jaeger.png)
84+
85+
*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*
8386

8487
## Troubleshooting pipeline plugins and the execution on the Jenkins build agents
8588

8689
For details on the execution of pipeline plugin steps on the Jenkins build agents,
8790
activate tracing in the Jenkins build agents using:
8891

89-
```
92+
```properties
9093
otel.instrumentation.jenkins.agent.enabled=true
9194
```
9295

9396
To activate detailed traces of the communication from the Jenkins Controller to the Jenkins Agents, activate the
9497
instrumentation of Jenkins remoting with:
9598

96-
```
99+
```properties
97100
otel.instrumentation.jenkins.remoting.enabled=true
98101
```
99102

100103
Note that the instrumentation of Jenkins remoting is not feature complete and may not capture all the communication
101104
between the Jenkins Controller and the Jenkins Agents.
102105

103-
<!--
104-
TODO add once image is merged is the `main` branch
105-
<img alt="Jenkins Remoting instrumentation" width="300px" src="https://raw.githubusercontent.com/jenkinsci/opentelemetry-plugin/master/docs/images/jenkins-remoting-instrumentation.png" />
106-
-->
107-
108106
## Troubleshooting Jenkins Performances Using Tracing on the HTTP Requests of the Jenkins Controller
109107

110108
For details to set up Jenkins with Elastic, Jaeger or Prometheus, to configure the integration including using Jenkins
@@ -123,8 +121,9 @@ attributes [here](https://github.com/jenkinsci/opentelemetry-plugin/blob/master/
123121
For details on how to store Jenkins pipelines build logs in an Observability backend like Elastic or Loki,
124122
see [Storing Jenkins Pipeline Logs in an Observability Backend though OpenTelemetry](https://github.com/jenkinsci/opentelemetry-plugin/blob/master/docs/build-logs.md).
125123

126-
<img alt="Storing Jenkins pipeline logs in Elasticsearch and visualizing logs both in Kibana and through Jenkins GUI" width="300px" src="https://raw.githubusercontent.com/jenkinsci/opentelemetry-plugin/master/docs/images/jenkins-pipeline-logs-elastic-with-visualization-through-jenkins.png" />
127-
<p style="font-size:0.75em; font-style: italic">Storing Jenkins pipeline logs in Elasticsearch and visualizing logs both in Kibana and through Jenkins GUI</p>
124+
![Storing Jenkins pipeline logs in Elasticsearch and visualizing logs both in Kibana and through Jenkins GUI](docs/images/jenkins-pipeline-logs-elastic-with-visualization-through-jenkins.png)
125+
126+
*Storing Jenkins pipeline logs in Elasticsearch and visualizing logs both in Kibana and through Jenkins GUI*
128127

129128
## Other CI/CD Tools supporting OpenTelemetry traces
130129

@@ -182,7 +181,7 @@ node {
182181
Navigate to the Jenkins OpenTelemetry Plugin configuration, in the "Advanced" section, add to the "Configuration
183182
Properties text area the following:
184183

185-
```
184+
```properties
186185
otel.exporter.otlp.protocol=http/protobuf
187186
```
188187

@@ -192,17 +191,17 @@ No test have been done on disabling the Groovy Sandbox and accessing the Jenkins
192191
Jenkins OpenTelemetry Plugin for the following reasons:
193192

194193
* Disabling the Groovy Sandbox is a very advanced use case due to the security implications of doing so
195-
* The surface of Jenkins pipeline logs capabilities exposed by disabling the Groovy sandbox is very broad and goes way
196-
beyond the OpenTelemetyr plugin
194+
* The surface of Jenkins pipeline logs capabilities exposed by disabling the Groovy sandbox is very broad and goes way beyond the OpenTelemetry plugin
197195

198196
If you are limited with the current capabilities of the Jenkins OpenTelemetry Plugin and consider opening up the Groovy
199-
sandbox to workaround these limitations, please prefer to reach out to us creating an enhancement request so we can work
200-
together at productizing the proper secured solution to your problem.
197+
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.
201198

202199
## Learn More
203200

204201
* You can look at this video tutorial to get
205-
started: [![Tracing Your Jenkins Pipelines With OpenTelemetry and Jaeger](https://img.youtube.com/vi/3XzVOxvNpGM/0.jpg)](https://www.youtube.com/watch?v=3XzVOxvNpGM)
202+
started:
203+
204+
[![Tracing Your Jenkins Pipelines With OpenTelemetry and Jaeger](https://img.youtube.com/vi/3XzVOxvNpGM/0.jpg)](https://www.youtube.com/watch?v=3XzVOxvNpGM)
206205
* [DevOpsWorld 2021 - Embracing Observability in Jenkins with OpenTelemetry](https://www.devopsworld.com/agenda/session/581459)
207206

208207
## Demos
@@ -216,5 +215,3 @@ Refer to our [contribution guidelines](https://github.com/jenkinsci/.github/blob
216215
## LICENSE
217216

218217
Licensed under Apache Software License 2, see [LICENSE](LICENSE)
219-
220-

demos/Makefile

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,29 @@
11
.DEFAULT_GOAL := start
22

33
export OTELCOL_IMG?=otel/opentelemetry-collector-contrib-dev:latest
4-
export ELASTIC_STACK_VERSION?=8.18.0
4+
export ELASTIC_STACK_VERSION?=9.0.0
55

66
.PHONY: build
77
build:
8-
@env docker compose --file docker-compose.yml build
8+
@env docker compose --file docker-compose.yml build --no-cache
99

1010
.PHONY: start
1111
start:
1212
@env docker compose --file docker-compose.yml up --detach --no-recreate
1313

14+
.PHONY: start-edot
15+
start-edot: OTEL_EXPORTER_OTLP_ENDPOINT?=http://edot:4317
16+
start-edot:
17+
@env docker compose --file docker-compose.yml up --detach --no-recreate jenkins jenkins-inbound-agent edot elasticsearch kibana
18+
19+
.PHONY: start-grafana
20+
start-grafana:
21+
@env docker compose --file docker-compose-grafana.yml up --detach --no-recreate
22+
1423
.PHONY: stop
1524
stop:
16-
@env docker compose --file docker-compose.yml stop
25+
@env docker compose --file docker-compose.yml --file docker-compose-grafana.yml stop
1726

1827
.PHONY: clean
1928
clean:
20-
@env docker compose --file docker-compose.yml down -v
29+
@env docker compose --file docker-compose.yml --file docker-compose-grafana.yml down -v
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
apiVersion: 1
2+
datasources:
3+
- name: Loki
4+
type: loki
5+
access: proxy
6+
url: http://loki:3100
7+
isDefault: true
8+
- name: prometheus
9+
type: prometheus
10+
access: proxy
11+
url: http://prometheus:9090
12+
- name: Jaeger
13+
type: jaeger
14+
access: proxy
15+
url: http://jaeger-all-in-one:16686
16+

demos/config/hello-world.dsl

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
NAME = 'hello_world'
2+
DSL = """pipeline {
3+
agent any
4+
stages {
5+
stage('hello') {
6+
steps {
7+
echo 'Hello, world!'
8+
}
9+
}
10+
}
11+
}"""
12+
13+
pipelineJob(NAME) {
14+
definition {
15+
cps {
16+
script(DSL.stripIndent())
17+
}
18+
}
19+
}

demos/config/jenkins-elastic.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
jenkins:
2+
systemMessage: "Configured automatically with JCasC plugin"
3+
crumbIssuer:
4+
standard:
5+
excludeClientIPFromCrumb: false
6+
labelString: flyweight
7+
mode: EXCLUSIVE
8+
numExecutors: 5
9+
remotingSecurity:
10+
enabled: false
11+
scmCheckoutRetryCount: 2
12+
nodes:
13+
- permanent:
14+
labelString: "local"
15+
launcher:
16+
inbound:
17+
workDirSettings:
18+
disabled: true
19+
failIfWorkDirIsMissing: false
20+
internalDir: "remoting"
21+
workDirPath: "/tmp"
22+
name: "local"
23+
numExecutors: 2
24+
remoteFS: "/tmp"
25+
retentionStrategy: "always"
26+
credentials:
27+
system:
28+
domainCredentials:
29+
- credentials:
30+
- usernamePassword:
31+
description: "elasticsearch-logs"
32+
id: "elasticsearch-logs"
33+
password: "${ELASTICSEARCH_PASSWORD}"
34+
scope: GLOBAL
35+
username: "${ELASTICSEARCH_USERNAME}"
36+
unclassified:
37+
location:
38+
url: ${JENKINS_URL}
39+
openTelemetry:
40+
authentication: "noAuthentication"
41+
endpoint: ${OTEL_EXPORTER_OTLP_ENDPOINT}
42+
exportOtelConfigurationAsEnvironmentVariables: true # Note that OpenTelemetry credentials, if configured, will be exposed as environment variables
43+
observabilityBackends:
44+
- elastic:
45+
displayKibanaDashboardLink: true
46+
elasticLogsBackend:
47+
elasticLogsBackendWithJenkinsVisualization:
48+
elasticsearchCredentialsId: "elasticsearch-logs"
49+
elasticsearchUrl: ${ELASTICSEARCH_HOST}
50+
kibanaBaseUrl: ${KIBANA_HOST}
51+
name: "Elastic Observability"
52+
enableEDOT: true
53+
jobs:
54+
- file: "/var/jenkins_home/config/ansible.dsl"
55+
- file: "/var/jenkins_home/config/gradle.dsl"
56+
- file: "/var/jenkins_home/config/maven.dsl"
57+
- file: "/var/jenkins_home/config/otel-cli.dsl"
58+
- file: "/var/jenkins_home/config/otel-cli-make.dsl"
59+
- file: "/var/jenkins_home/config/import_dashboard.dsl"
60+
- file: "/var/jenkins_home/config/pytest-otel.dsl"
61+
- file: "/var/jenkins_home/config/hello-world.dsl"

demos/config/jenkins.yml renamed to demos/config/jenkins-grafana.yml

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,25 +30,22 @@ credentials:
3030
- usernamePassword:
3131
description: "elasticsearch-logs"
3232
id: "elasticsearch-logs"
33-
password: "changeme"
33+
password: "${ELASTICSEARCH_PASSWORD}"
3434
scope: GLOBAL
35-
username: "jenkins_logs_user"
35+
username: "${ELASTICSEARCH_USERNAME}"
3636
unclassified:
3737
location:
38-
url: "http://jenkins:8080/"
38+
url: ${JENKINS_URL}
3939
openTelemetry:
4040
authentication: "noAuthentication"
41-
endpoint: "http://otel-collector:4317"
41+
endpoint: ${OTEL_EXPORTER_OTLP_ENDPOINT}
4242
exportOtelConfigurationAsEnvironmentVariables: true # Note that OpenTelemetry credentials, if configured, will be exposed as environment variables
4343
observabilityBackends:
44-
- elastic:
45-
displayKibanaDashboardLink: true
46-
elasticLogsBackend:
47-
elasticLogsBackendWithJenkinsVisualization:
48-
elasticsearchCredentialsId: "elasticsearch-logs"
49-
elasticsearchUrl: "http://elasticsearch:9200"
50-
kibanaBaseUrl: "http://localhost:5601"
51-
name: "Elastic Observability"
44+
- grafana:
45+
grafanaBaseUrl: ${GRAFANA_HOST}
46+
grafanaLogsBackend:
47+
grafanaLogsBackendWithJenkinsVisualization:
48+
lokiUrl: ${LOKI_HOST}
5249
jobs:
5350
- file: "/var/jenkins_home/config/ansible.dsl"
5451
- file: "/var/jenkins_home/config/gradle.dsl"
@@ -57,3 +54,4 @@ jobs:
5754
- file: "/var/jenkins_home/config/otel-cli-make.dsl"
5855
- file: "/var/jenkins_home/config/import_dashboard.dsl"
5956
- file: "/var/jenkins_home/config/pytest-otel.dsl"
57+
- file: "/var/jenkins_home/config/hello-world.dsl"

demos/config/otel-collector-config.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,8 @@ receivers:
33
protocols:
44
grpc:
55
endpoint: 0.0.0.0:4317
6-
http:
6+
http:
77
endpoint: 0.0.0.0:4318
8-
98
exporters:
109
prometheus:
1110
endpoint: "0.0.0.0:8889"
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
---
2+
extensions:
3+
health_check:
4+
pprof:
5+
endpoint: :1888
6+
zpages:
7+
endpoint: :55679
8+
9+
receivers:
10+
otlp:
11+
protocols:
12+
grpc:
13+
endpoint: 0.0.0.0:4317
14+
http:
15+
endpoint: 0.0.0.0:4318
16+
exporters:
17+
prometheus:
18+
endpoint: "0.0.0.0:8889"
19+
namespace: promexample
20+
resource_to_telemetry_conversion:
21+
enabled: true
22+
const_labels:
23+
label1: value1
24+
debug:
25+
verbosity: detailed
26+
sampling_initial: 5
27+
sampling_thereafter: 200
28+
otlphttp:
29+
endpoint: http://loki:3100/otlp
30+
otlp/jaeger:
31+
endpoint: jaeger-all-in-one:4317
32+
tls:
33+
insecure: true
34+
processors:
35+
batch:
36+
37+
service:
38+
extensions: [pprof, zpages, health_check]
39+
pipelines:
40+
logs:
41+
receivers: [otlp]
42+
processors: [batch]
43+
exporters: [debug, otlphttp]
44+
traces:
45+
receivers: [otlp]
46+
processors: [batch]
47+
exporters: [debug, otlp/jaeger]
48+
metrics:
49+
receivers: [otlp]
50+
processors: [batch]
51+
exporters: [debug, prometheus]

demos/config/plugins.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ git
66
filesystem_scm
77
jdk-tool
88
job-dsl
9-
opentelemetry
9+
opentelemetry::https://repo.jenkins-ci.org/incrementals/io/jenkins/plugins/opentelemetry/3.1527.vd26606274117/opentelemetry-3.1527.vd26606274117.hpi
1010
pipeline-model-definition
1111
swarm
1212
workflow-aggregator

0 commit comments

Comments
 (0)