Skip to content

Cannot use CI Visibility with DogStatsD over Unix Domain Socket #283

@usmonster

Description

@usmonster

I'm using the Datadog plugin on Jenkins with the Datadog Agent and a Unix socket configuration.
This is working fine for metrics reporting, but not for CI Visibility/traces. Looking at Jenkins logs during a pipeline run, I see the plugin is trying to use HTTP instead of the configured DSD, and so it fails (screenshot further below).

I've tried looking at the plugin source code and found no clue, so I'm wondering if there's something I'm missing, but I suspect it's a bug, i.e. that the plugin was not designed with the unix socket configuration in mind (cf. #242). Thanks for any insights you might have!

To Reproduce
Steps to reproduce the behavior:

  1. Set up the plugin using a Unix Socket configuration
  2. Enable CI Visibility (you'll have to set a port to enable Traces collection.. I set 0), and save the configuration
  3. Create a Jenkins logger for Datadog-related classes (see screenshot below)
  4. Launch a Jenkins build and let it run to completion
  5. Check logs for the logger created in step 3
  6. See errors (e.g. "protocol = http host = null")

Expected behavior
The plugin should use the DSD configuration (not HTTP), traces should be sent without error, and Jenkins build data should show up in Datadog's Pipeline Visibility feature.

Screenshots

Here's how the plugin configuration looks in Jenkins:

image

(Note that I have to set 0 for the Traces Collection Port to enable CI Visibility; the "Test traces connection" button fails, but maybe this is expected behavior in this case? I can still save the configuration.)

Here is the Jenkins logger configuration:

image

Here are the logs that show the error:

image

Environment and Versions:

  • Datadog Plugin version 3.5.0
  • Jenkins version: 2.336
  • Jenkins chart version: 3.11.5

Additional context

Jenkins Logs

Here are the same logs as in the previous screenshot (included as text for searches):

Start DatadogBuildListener#onFinalized
Mar 23, 2022 3:38:10 PM FINE org.datadog.jenkins.plugins.datadog.DatadogUtilities
The list of Global Job Tags are: []
Mar 23, 2022 3:38:10 PM FINE org.datadog.jenkins.plugins.datadog.DatadogUtilities
Using unix hostname found via `/bin/hostname -f`. Hostname: jenkins-0.jenkins.ep.svc.cluster.local
Mar 23, 2022 3:38:10 PM FINE org.datadog.jenkins.plugins.datadog.clients.DatadogAgentClient
Finished build trace
Mar 23, 2022 3:38:10 PM FINE org.datadog.jenkins.plugins.datadog.listeners.DatadogBuildListener
End DatadogBuildListener#onFinalized
Mar 23, 2022 3:38:10 PM FINE org.datadog.jenkins.plugins.datadog.DatadogUtilities
Jenkins proxy configuration not found
Mar 23, 2022 3:38:10 PM FINE org.datadog.jenkins.plugins.datadog.DatadogUtilities
Using HttpURLConnection, without proxy
Mar 23, 2022 3:38:10 PM SEVERE org.datadog.jenkins.plugins.datadog.DatadogUtilities severe
protocol = http host = null
Mar 23, 2022 3:38:10 PM FINER org.datadog.jenkins.plugins.datadog.transport.LoggerHttpErrorHandler
protocol = http host = null: java.lang.IllegalArgumentException: protocol = http host = null
	at java.base/sun.net.spi.DefaultProxySelector.select(DefaultProxySelector.java:192)
	at java.base/sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1181)
	at java.base/sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1081)
	at java.base/sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:1015)
	at java.base/sun.net.www.protocol.http.HttpURLConnection.getOutputStream0(HttpURLConnection.java:1367)
	at java.base/sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:1342)
	at org.datadog.jenkins.plugins.datadog.transport.HttpSender.blockingSend(HttpSender.java:77)
	at org.datadog.jenkins.plugins.datadog.transport.HttpSender.run(HttpSender.java:55)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:829)

Mar 23, 2022 3:38:10 PM SEVERE org.datadog.jenkins.plugins.datadog.DatadogUtilities severe
java.lang.IllegalArgumentException: protocol = http host = null
Mar 23, 2022 3:38:10 PM FINE org.datadog.jenkins.plugins.datadog.clients.DatadogAgentClient
Send pipeline traces.
Mar 23, 2022 3:38:10 PM FINER org.datadog.jenkins.plugins.datadog.transport.LoggerHttpErrorHandler
java.lang.IllegalArgumentException: protocol = http host = null: java.lang.RuntimeException: java.lang.IllegalArgumentException: protocol = http host = null
	at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1534)
	at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1520)
	at java.base/sun.net.www.protocol.http.HttpURLConnection.getHeaderField(HttpURLConnection.java:3135)
	at java.base/java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:536)
	at org.datadog.jenkins.plugins.datadog.transport.HttpSender.blockingSend(HttpSender.java:90)
	at org.datadog.jenkins.plugins.datadog.transport.HttpSender.run(HttpSender.java:55)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: java.lang.IllegalArgumentException: protocol = http host = null
	at java.base/sun.net.spi.DefaultProxySelector.select(DefaultProxySelector.java:192)
	at java.base/sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1181)
	at java.base/sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1081)
	at java.base/sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:1015)
	at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1592)
	at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1520)
	at java.base/java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:527)
	... 7 more

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions