build.gradle.kts 1.5 KB

12345678910111213141516171819202122232425262728293031
  1. plugins {
  2. id("otel.javaagent-instrumentation")
  3. }
  4. dependencies {
  5. // this instrumentation needs to be able to reference both the OpenTelemetry API
  6. // that is shaded in the bootstrap class loader (for sending telemetry to the agent),
  7. // and the OpenTelemetry API that the user brings (in order to capture that telemetry)
  8. //
  9. // since (all) instrumentation already uses OpenTelemetry API for sending telemetry to the agent,
  10. // this instrumentation uses a "temporarily shaded" OpenTelemetry API to represent the
  11. // OpenTelemetry API that the user brings
  12. //
  13. // then later, after the OpenTelemetry API in the bootstrap class loader is shaded,
  14. // the "temporarily shaded" OpenTelemetry API is unshaded, so that it will apply to the
  15. // OpenTelemetry API that the user brings
  16. //
  17. // so in the code "application.io.opentelemetry.*" refers to the (unshaded) OpenTelemetry API that
  18. // the application brings (as those references will be translated during the build to remove the
  19. // "application." prefix)
  20. //
  21. // and in the code "io.opentelemetry.*" refers to the (shaded) OpenTelemetry API that is used by
  22. // the agent (as those references will later be shaded)
  23. compileOnly(project(path = ":opentelemetry-api-shaded-for-instrumenting", configuration = "shadow"))
  24. compileOnly("io.opentelemetry:opentelemetry-api-metrics")
  25. implementation(project(":instrumentation:opentelemetry-api:opentelemetry-api-1.0:javaagent"))
  26. testImplementation("com.google.guava:guava")
  27. testImplementation("io.opentelemetry:opentelemetry-sdk-metrics")
  28. }