title: Spring boot micro meter datadog socket connection error
body: <p>I am working on to create some custom metrics for my spring boot 2 rest api. I have added the required micro meter and datadog dependency. My office machine works behind a proxy. I have setup proxy through spring boot plugin.</p>
  
  <pre><code>-Dhttp.proxyHost=xxxx.proxy.com
  -Dhttp.proxyPort=xxxx
  </code></pre>
  
  <p>below are in my application.properties file. 
      management.metrics.export.datadog.apiKey=mykey</p>
  
  <pre><code>management.metrics.export.datadog.uri=https://app.datadoghq.com
  
  management.metrics.export.datadog.enabled=true
  
  management.metrics.export.datadog.step=10s
  </code></pre>
  
  <p>But I am getting the socket connection timeout. </p>
  
  <pre><code>   [datadog-metrics-publisher] 10 Apr 2020 16:51:39,552 WARN  DatadogMeterRegistry [{}]: java.net.SocketTimeoutException: connect timed out
      at java.net.PlainSocketImpl.socketConnect(Native Method)
      at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
      at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
      at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
      at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
      at java.net.Socket.connect(Socket.java:606)
      at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:666)
      at sun.net.NetworkClient.doConnect(NetworkClient.java:175)
      at sun.net.www.http.HttpClient.openServer(HttpClient.java:463)
      at sun.net.www.http.HttpClient.openServer(HttpClient.java:558)
      at sun.net.www.protocol.https.HttpsClient.&lt;init&gt;(HttpsClient.java:264)
      at sun.net.www.protocol.https.HttpsClient.New(HttpsClient.java:367)
      at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(AbstractDelegateHttpsURLConnection.java:191)
      at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1162)
      at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1056)
      at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:177)
      at sun.net.www.protocol.http.HttpURLConnection.getOutputStream0(HttpURLConnection.java:1340)
      at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:1315)
      at sun.net.www.protocol.https.HttpsURLConnectionImpl.getOutputStream(HttpsURLConnectionImpl.java:264)
      at io.micrometer.core.ipc.http.HttpUrlConnectionSender.send(HttpUrlConnectionSender.java:96)
      at io.micrometer.core.ipc.http.HttpSender$Request$Builder.send(HttpSender.java:284)
      at io.micrometer.datadog.DatadogMeterRegistry.publish(DatadogMeterRegistry.java:141)
      at io.micrometer.core.instrument.push.PushMeterRegistry.publishSafely(PushMeterRegistry.java:48)
      at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
      at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
  </code></pre>
  
  <p>As far as I debugged the io.micrometer.core.ipc.http.HttpUrlConnectionSender.send method is failing and I dont under how the micro meter data dog takes the proxy details. </p>
  
  <p>The micrometer doc says </p>
  
  <pre><code>management.metrics.export.datadog.uri=https://app.datadoghq.com # URI to ship metrics to. If you need to publish metrics to an internal proxy en-route to Datadog, you can define the location of the proxy with this.
  </code></pre>
  
  <p>But I dont understand what it means? should I replace this url with my proxy url or is there any specific uri pattern with the proxy?  I am using spring boot 2.2.4.RELEASE</p>