build.gradle.kts 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. plugins {
  2. id("otel.javaagent-instrumentation")
  3. }
  4. muzzle {
  5. pass {
  6. group.set("software.amazon.awssdk")
  7. module.set("aws-core")
  8. versions.set("[2.2.0,)")
  9. // Used by all SDK services, the only case it isn't is an SDK extension such as a custom HTTP
  10. // client, which is not target of instrumentation anyways.
  11. extraDependency("software.amazon.awssdk:protocol-core")
  12. excludeInstrumentationName("aws-sdk-2.2-sqs")
  13. excludeInstrumentationName("aws-sdk-2.2-sns")
  14. // several software.amazon.awssdk artifacts are missing for this version
  15. skip("2.17.200")
  16. }
  17. fail {
  18. group.set("software.amazon.awssdk")
  19. module.set("aws-core")
  20. versions.set("[2.2.0,)")
  21. // Used by all SDK services, the only case it isn't is an SDK extension such as a custom HTTP
  22. // client, which is not target of instrumentation anyways.
  23. extraDependency("software.amazon.awssdk:protocol-core")
  24. // "fail" asserts that *all* the instrumentation modules fail to load, but the core one is
  25. // actually expected to succeed, so exclude it from checks.
  26. excludeInstrumentationName("aws-sdk-2.2-core")
  27. // several software.amazon.awssdk artifacts are missing for this version
  28. skip("2.17.200")
  29. }
  30. pass {
  31. group.set("software.amazon.awssdk")
  32. module.set("sqs")
  33. versions.set("[2.2.0,)")
  34. // Used by all SDK services, the only case it isn't is an SDK extension such as a custom HTTP
  35. // client, which is not target of instrumentation anyways.
  36. extraDependency("software.amazon.awssdk:protocol-core")
  37. excludeInstrumentationName("aws-sdk-2.2-sns")
  38. // several software.amazon.awssdk artifacts are missing for this version
  39. skip("2.17.200")
  40. }
  41. pass {
  42. group.set("software.amazon.awssdk")
  43. module.set("sns")
  44. versions.set("[2.2.0,)")
  45. // Used by all SDK services, the only case it isn't is an SDK extension such as a custom HTTP
  46. // client, which is not target of instrumentation anyways.
  47. extraDependency("software.amazon.awssdk:protocol-core")
  48. excludeInstrumentationName("aws-sdk-2.2-sqs")
  49. // several software.amazon.awssdk artifacts are missing for this version
  50. skip("2.17.200")
  51. }
  52. }
  53. dependencies {
  54. implementation(project(":instrumentation:aws-sdk:aws-sdk-2.2:library-autoconfigure"))
  55. implementation(project(":instrumentation:aws-sdk:aws-sdk-2.2:library"))
  56. library("software.amazon.awssdk:aws-core:2.2.0")
  57. library("software.amazon.awssdk:sqs:2.2.0")
  58. testImplementation(project(":instrumentation:aws-sdk:aws-sdk-2.2:testing"))
  59. testImplementation("io.opentelemetry.contrib:opentelemetry-aws-xray-propagator")
  60. // Make sure these don't add HTTP headers
  61. testInstrumentation(project(":instrumentation:apache-httpclient:apache-httpclient-4.0:javaagent"))
  62. testInstrumentation(project(":instrumentation:apache-httpclient:apache-httpclient-5.0:javaagent"))
  63. testInstrumentation(project(":instrumentation:netty:netty-4.1:javaagent"))
  64. testLibrary("software.amazon.awssdk:dynamodb:2.2.0")
  65. testLibrary("software.amazon.awssdk:ec2:2.2.0")
  66. testLibrary("software.amazon.awssdk:kinesis:2.2.0")
  67. testLibrary("software.amazon.awssdk:rds:2.2.0")
  68. testLibrary("software.amazon.awssdk:s3:2.2.0")
  69. testLibrary("software.amazon.awssdk:sqs:2.2.0")
  70. testLibrary("software.amazon.awssdk:sns:2.2.0")
  71. testLibrary("software.amazon.awssdk:ses:2.2.0")
  72. }
  73. val latestDepTest = findProperty("testLatestDeps") as Boolean
  74. testing {
  75. suites {
  76. val s3PresignerTest by registering(JvmTestSuite::class) {
  77. dependencies {
  78. if (latestDepTest) {
  79. implementation("software.amazon.awssdk:s3:+")
  80. } else {
  81. implementation("software.amazon.awssdk:s3:2.10.12")
  82. }
  83. implementation(project(":instrumentation:aws-sdk:aws-sdk-2.2:library"))
  84. }
  85. }
  86. }
  87. }
  88. tasks {
  89. val testExperimentalSqs by registering(Test::class) {
  90. filter {
  91. excludeTestsMatching("Aws2SqsSuppressReceiveSpansTest")
  92. }
  93. systemProperty("otel.instrumentation.aws-sdk.experimental-use-propagator-for-messaging", "true")
  94. systemProperty("otel.instrumentation.messaging.experimental.receive-telemetry.enabled", "true")
  95. }
  96. val testReceiveSpansDisabled by registering(Test::class) {
  97. filter {
  98. includeTestsMatching("Aws2SqsSuppressReceiveSpansTest")
  99. }
  100. include("**/Aws2SqsSuppressReceiveSpansTest.*")
  101. }
  102. test {
  103. filter {
  104. excludeTestsMatching("Aws2SqsSuppressReceiveSpansTest")
  105. }
  106. systemProperty("otel.instrumentation.messaging.experimental.receive-telemetry.enabled", "true")
  107. }
  108. check {
  109. dependsOn(testExperimentalSqs)
  110. dependsOn(testReceiveSpansDisabled)
  111. dependsOn(testing.suites)
  112. }
  113. withType<Test>().configureEach {
  114. // TODO run tests both with and without experimental span attributes
  115. systemProperty("otel.instrumentation.aws-sdk.experimental-span-attributes", "true")
  116. systemProperty("otel.instrumentation.aws-sdk.experimental-record-individual-http-error", "true")
  117. systemProperty("testLatestDeps", findProperty("testLatestDeps") as Boolean)
  118. }
  119. withType<com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar>().configureEach {
  120. mergeServiceFiles {
  121. include("software/amazon/awssdk/global/handlers/execution.interceptors")
  122. }
  123. }
  124. }