build.gradle.kts 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. plugins {
  2. id("otel.javaagent-instrumentation")
  3. }
  4. muzzle {
  5. pass {
  6. group.set("io.grpc")
  7. module.set("grpc-core")
  8. versions.set("[1.6.0,)")
  9. assertInverse.set(true)
  10. }
  11. }
  12. val grpcVersion = "1.6.0"
  13. dependencies {
  14. implementation(project(":instrumentation:grpc-1.6:library"))
  15. library("io.grpc:grpc-core:$grpcVersion")
  16. testInstrumentation(project(":instrumentation:netty:netty-4.1:javaagent"))
  17. testLibrary("io.grpc:grpc-netty:$grpcVersion")
  18. testLibrary("io.grpc:grpc-protobuf:$grpcVersion")
  19. testLibrary("io.grpc:grpc-services:$grpcVersion")
  20. testLibrary("io.grpc:grpc-stub:$grpcVersion")
  21. testImplementation(project(":instrumentation:grpc-1.6:testing"))
  22. }
  23. tasks {
  24. test {
  25. systemProperty("testLatestDeps", findProperty("testLatestDeps") as Boolean)
  26. // The agent context debug mechanism isn't compatible with the bridge approach which may add a
  27. // gRPC context to the root.
  28. jvmArgs("-Dotel.javaagent.experimental.thread-propagation-debugger.enabled=false")
  29. jvmArgs("-Dotel.instrumentation.grpc.capture-metadata.client.request=some-client-key")
  30. jvmArgs("-Dotel.instrumentation.grpc.capture-metadata.server.request=some-server-key")
  31. jvmArgs("-Dotel.instrumentation.common.experimental.controller-telemetry.enabled=true")
  32. // latest dep test occasionally fails because network type is ipv6 instead of the expected ipv4
  33. // and peer address is 0:0:0:0:0:0:0:1 instead of 127.0.0.1
  34. jvmArgs("-Djava.net.preferIPv4Stack=true")
  35. // exclude our grpc library instrumentation, the ContextStorageOverride contained within it
  36. // breaks the tests
  37. classpath = classpath.filter {
  38. !it.absolutePath.contains("opentelemetry-grpc-1.6")
  39. }
  40. }
  41. }
  42. if (!(findProperty("testLatestDeps") as Boolean)) {
  43. configurations.testRuntimeClasspath {
  44. resolutionStrategy {
  45. eachDependency {
  46. // early versions of grpc are not compatible with netty 4.1.101.Final
  47. if (requested.group == "io.netty") {
  48. useVersion("4.1.100.Final")
  49. }
  50. }
  51. }
  52. }
  53. }