Uploaded image for project: 'Flink'
  1. Flink
  2. FLINK-9616

DatadogHttpReporter fails to be created due to missing shaded dependency

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Duplicate
    • 1.5.0
    • None
    • Runtime / Metrics
    • None

    Description

      When using the DatadogHttpReporter, it fails to instantiate with the following exception:

      2018-06-19 06:01:19,640 INFO org.apache.flink.runtime.metrics.MetricRegistryImpl - Configuring dghttp with {apikey=<redacted>, tags=<redacted>, class=org.apache.flink.metrics.datadog.DatadogHttpReporter}.
      2018-06-19 06:01:19,642 ERROR org.apache.flink.runtime.metrics.MetricRegistryImpl - Could not instantiate metrics reporter dghttp. Metrics might not be exposed/reported.
      java.lang.NoClassDefFoundError: org/apache/flink/shaded/okhttp3/MediaType
      at org.apache.flink.metrics.datadog.DatadogHttpClient.<clinit>(DatadogHttpClient.java:45)
      at org.apache.flink.metrics.datadog.DatadogHttpReporter.open(DatadogHttpReporter.java:105)
      at org.apache.flink.runtime.metrics.MetricRegistryImpl.<init>(MetricRegistryImpl.java:150)
      at org.apache.flink.runtime.entrypoint.ClusterEntrypoint.createMetricRegistry(ClusterEntrypoint.java:413)
      at org.apache.flink.runtime.entrypoint.ClusterEntrypoint.initializeServices(ClusterEntrypoint.java:274)
      at org.apache.flink.mesos.entrypoint.MesosSessionClusterEntrypoint.initializeServices(MesosSessionClusterEntrypoint.java:92)
      at org.apache.flink.runtime.entrypoint.ClusterEntrypoint.runCluster(ClusterEntrypoint.java:225)
      at org.apache.flink.runtime.entrypoint.ClusterEntrypoint.lambda$startCluster$0(ClusterEntrypoint.java:189)
      at java.security.AccessController.doPrivileged(Native Method)
      at javax.security.auth.Subject.doAs(Subject.java:422)
      at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1889)
      at org.apache.flink.runtime.security.HadoopSecurityContext.runSecured(HadoopSecurityContext.java:41)
      at org.apache.flink.runtime.entrypoint.ClusterEntrypoint.startCluster(ClusterEntrypoint.java:188)
      at org.apache.flink.mesos.entrypoint.MesosSessionClusterEntrypoint.main(MesosSessionClusterEntrypoint.java:181)
      Caused by: java.lang.ClassNotFoundException: org.apache.flink.shaded.okhttp3.MediaType
      at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
      at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
      ... 14 more
      
      

      Looking at the pom.xml for `flink-metrics-datadog` it looks like that dependency is intended to be shaded and included in the jar, however, when we build the jar we see the following lines:

       

      $ mvn package
      [INFO] Scanning for projects...
      [INFO] 
      [INFO] ------------------------------------------------------------------------
      [INFO] Building flink-metrics-datadog 1.5.0
      [INFO] ------------------------------------------------------------------------
      
      ....
      [INFO] --- maven-shade-plugin:3.0.0:shade (shade-flink) @ flink-metrics-datadog ---
      [INFO] Excluding com.squareup.okhttp3:okhttp:jar:3.7.0 from the shaded jar.
      [INFO] Excluding com.squareup.okio:okio:jar:1.12.0 from the shaded jar.
      [INFO] Including org.apache.flink:force-shading:jar:1.5.0 in the shaded jar.
      [INFO] Replacing original artifact with shaded artifact.
      

      And inspecting the built jar:

      $ jar tf flink-metrics-datadog-1.5.0.jar
      META-INF/
      META-INF/MANIFEST.MF
      org/
      org/apache/
      org/apache/flink/
      org/apache/flink/metrics/
      org/apache/flink/metrics/datadog/
      org/apache/flink/metrics/datadog/DatadogHttpClient$EmptyCallback.class
      org/apache/flink/metrics/datadog/DMetric.class
      org/apache/flink/metrics/datadog/DSeries.class
      org/apache/flink/metrics/datadog/DGauge.class
      org/apache/flink/metrics/datadog/DatadogHttpReporter.class
      org/apache/flink/metrics/datadog/DatadogHttpClient.class
      org/apache/flink/metrics/datadog/MetricType.class
      org/apache/flink/metrics/datadog/DatadogHttpReporter$DatadogHttpRequest.class
      org/apache/flink/metrics/datadog/DMeter.class
      org/apache/flink/metrics/datadog/DCounter.class
      META-INF/DEPENDENCIES
      META-INF/maven/
      META-INF/maven/org.apache.flink/
      META-INF/maven/org.apache.flink/flink-metrics-datadog/
      META-INF/maven/org.apache.flink/flink-metrics-datadog/pom.xml
      META-INF/maven/org.apache.flink/flink-metrics-datadog/pom.properties
      META-INF/NOTICE
      

      We don't see the included dependencies

       

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              addisonj@gmail.com Addison Higham
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: