build.gradle.kts 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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. // exclude our grpc library instrumentation, the ContextStorageOverride contained within it
  32. // breaks the tests
  33. classpath = classpath.filter {
  34. !it.absolutePath.contains("opentelemetry-grpc-1.6")
  35. }
  36. }
  37. }
  38. if (!(findProperty("testLatestDeps") as Boolean)) {
  39. configurations.testRuntimeClasspath {
  40. resolutionStrategy {
  41. eachDependency {
  42. // early versions of grpc are not compatible with netty 4.1.101.Final
  43. if (requested.group == "io.netty") {
  44. useVersion("4.1.100.Final")
  45. }
  46. }
  47. }
  48. }
  49. }