You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/en/continuous_integration/setup_pipelines/jenkins.md
+91-62Lines changed: 91 additions & 62 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,59 +16,42 @@ Install the [Datadog Agent][1] on the Jenkins controller instance.
16
16
17
17
## Install the Datadog Jenkins plugin
18
18
19
-
Install and enable the [Datadog Jenkins plugin][2]v2.1.1 or newer:
19
+
Install and enable the [Datadog Jenkins plugin][2]v3.0.0 or newer:
20
20
21
21
1. In your Jenkins instance web interface, go to **Manage Jenkins > Manage Plugins**.
22
22
2. In the [Update Center][3] on the **Available** tab, search for `Datadog Plugin`.
23
23
3. Select the checkbox next to the plugin, and install using one of the two install buttons at the bottom of the screen.
24
-
4. To configure the plugin, go to **Manage Jenkins > Configure System**, and find the Datadog Plugin section.
25
-
5. In the Datadog section, select the `Datadog Agent` mode.
26
-
6. Restart Jenkins to enable the plugin.
27
-
28
-
When the configuration is correct, the Jenkins log shows lines similar to this after the restart:
29
-
30
-
{{< code-block lang="text" >}}
31
-
INFO datadog.trace.core.CoreTracer#<init>: New instance: DDTracer-62fcf62{ ... }
32
-
INFO datadog.trace.core.StatusLogger#logStatus: DATADOG TRACER CONFIGURATION { ... }
33
-
{{< /code-block >}}
34
-
35
-
**Note**: Enabling the collection of traces using the Jenkins plugin is incompatible with running the Java APM tracer as a Java agent when launching Jenkins.
36
-
24
+
4. To verify that the plugin is installed, search for `Datadog Plugin` on the **Installed** tab.
37
25
38
26
## Enabling CI Visibility on the plugin
39
27
40
-
While in beta, the UI to activate CI Visibility is hidden and needs to be manually configured following these steps:
41
-
42
-
1. Open the file: `$JENKINS_HOME\org.datadog.jenkins.plugins.datadog.DatadogGlobalConfiguration.xml`
**Note**: Enabling CI Visibility using the Jenkins plugin is not compatible with running the Java APM tracer as a Java agent when launching Jenkins.
45
+
46
+
{{< img src="ci/ci-jenkins-plugin-config.png" alt="Datadog Plugin configuration for Jenkins" style="width:100%;">}}
64
47
65
48
## Enable job log collection on the Agent
66
49
67
50
Enable log collection in the Agent:
68
51
69
52
1. Add `logs_enabled: true` to your Agent configuration file `datadog.yaml`, or set the `DD_LOGS_ENABLED=true` environment variable.
70
53
71
-
2. Create a file at `/etc/datadog-agent/conf.d/jenkins.d/conf.yaml` (for Linux; [check here for other operating systems][4]) with the following contents. Make sure that `service` matches the `traceServiceName` provided earlier:
54
+
2. Create a file at `/etc/datadog-agent/conf.d/jenkins.d/conf.yaml` (for Linux; [check here for other operating systems][4]) with the following contents. Make sure that `service` matches the CI Instance name provided earlier:
72
55
73
56
{{< code-block lang="yaml" >}}
74
57
logs:
@@ -84,21 +67,16 @@ With this setup, the Agent listens in port `10518` for logs.
84
67
85
68
## Enable job log collection in the plugin
86
69
87
-
Configure the Jenkins plugin to send job logs to the Agent:
88
-
89
-
1. Open the file: `$JENKINS_HOME\org.datadog.jenkins.plugins.datadog.DatadogGlobalConfiguration.xml`
**Global tags** (`globalTags`): A comma-separated list of tags to apply to all metrics, traces, events, and service checks. Tags can include environment variables that are defined in the Jenkins controller instance.
141
+
1. In the web interface of your Jenkins instance, go to **Manage Jenkins > Configure System**.
142
+
2. Go to the `Datadog Plugin` section, scrolling down the configuration screen.
143
+
3. Click on the `Advanced` button.
144
+
4. Configure the `Global Tags`.
145
+
5. Configure the `Global Job Tags`.
146
+
6. Save your configuration.
171
147
172
-
**Global job tags** (`globalJobTags`): A comma-separated list of regex to match a job and a list of tags to apply to that job. Tags can include environment variables that are defined in the Jenkins controller instance. Tags can reference match groups in the regex using the `$` symbol.
148
+
**Global tags** (`globalTags`): A comma-separated list of tags to apply to all metrics, traces, events, and service checks. Tags can include environment variables that are defined in the Jenkins controller instance: `global_tag:global_value,global_tag2:${SOME_ENVVAR},${OTHER_ENVVAR}:global_tagvalue`
173
149
174
-
3. Restart Jenkins for the changes to take effect.
175
-
176
-
**Note**: Do not use the Jenkins GUI to configure global tags, as trace collection might be disabled when saving settings using the GUI.
150
+
**Global job tags** (`globalJobTags`): A comma-separated list of regexes to match a job and a list of tags to apply to that job. Tags can include environment variables that are defined in the Jenkins controller instance. Tags can reference match groups in the regex using the `$` symbol: `(.*?)_job_(*?)_release:someValue`
177
151
178
152
## Visualize pipeline data in Datadog
179
153
180
154
Once the integration is successfully configured, both [Pipelines][6] and [Pipeline Executions][7] pages will start populating with data after pipelines finish.
181
155
182
156
**Note**: The Pipelines page shows data for only the default branch of each repository.
183
157
158
+
## Troubleshooting
159
+
160
+
### Enable DEBUG log level for the Datadog Plugin
161
+
162
+
If you have any issues with the Datadog Plugin, you can set the logs for the plugin in a `DEBUG` log level. Using this level, you are able to check the exception stacktrace if an issue arises.
163
+
164
+
1. In your Jenkins instance web interface, go to **Manage Jenkins > System log**.
165
+
2. Click on `Add new log recorder` button.
166
+
3. Type the log recorder name. E.g: **Datadog Plugin Logs**.
You may also want to split the loggers into different log recorders.
176
+
177
+
Once the log recorders are successfully configured, you can check the logs in the `DEBUG` mode by accessing the desired log recorder through **Manage Jenkins > System log**.
178
+
179
+
If you trigger a Jenkins pipeline, you can search for the message `Send pipeline traces` in the **Datadog Plugin Logs**. This message indicates that the plugin is sending **CI Visibility** data to the **Datadog Agent**.
180
+
181
+
{{< code-block lang="text" >}}
182
+
Send pipeline traces.
183
+
...
184
+
Send pipeline traces.
185
+
...
186
+
{{< /code-block >}}
187
+
188
+
### The Datadog Plugin section does not appear in the Jenkins configuration
189
+
190
+
If the Datadog Plugin section does not appear in Jenkins configuration section, make sure that the plugin is enabled. To do so:
191
+
192
+
1. In your Jenkins instance web interface, go to **Manage Jenkins > Manage Plugins**.
193
+
2. Search for `Datadog Plugin` in the **Installed** tab.
194
+
3. Check that the `Enabled` checkbox is marked.
195
+
4. If you enable the plugin here, restart your Jenkins instance using the `/safeRestart` URL path.
196
+
197
+
### The Plugin Tracer failed to initialized due to APM Java Tracer is used to instrument Jenkins.
198
+
199
+
If this error message appears in the **Jenkins Log**, make sure that you are not using the APM Java Tracer to instrument your Jenkins instance.
200
+
201
+
{{< code-block lang="text" >}}
202
+
Failed to reinitialize Datadog-Plugin Tracer, Cannot enable traces collection via plugin if the Datadog Java Tracer is being used as javaagent in the Jenkins startup command. This error will not affect your pipelines executions.
203
+
{{< /code-block >}}
204
+
205
+
1. Access your Jenkins controller instance machine using the console.
206
+
2. Check the Java startup line for the Jenkins process.
207
+
{{< code-block lang="shell" >}}
208
+
$> ps -ef | grep jenkins
209
+
{{< /code-block >}}
210
+
3. Ensure you are not using the APM Java Tracer as `-javaagent`.
211
+
212
+
**Note**: Enabling CI Visibility using the Jenkins plugin is not compatible with running the Java APM tracer as a Java agent when launching Jenkins.
0 commit comments