build.gradle.kts 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  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. // Make sure these don't add HTTP headers
  60. testInstrumentation(project(":instrumentation:apache-httpclient:apache-httpclient-4.0:javaagent"))
  61. testInstrumentation(project(":instrumentation:apache-httpclient:apache-httpclient-5.0:javaagent"))
  62. testInstrumentation(project(":instrumentation:netty:netty-4.1:javaagent"))
  63. testLibrary("software.amazon.awssdk:dynamodb:2.2.0")
  64. testLibrary("software.amazon.awssdk:ec2:2.2.0")
  65. testLibrary("software.amazon.awssdk:kinesis:2.2.0")
  66. testLibrary("software.amazon.awssdk:rds:2.2.0")
  67. testLibrary("software.amazon.awssdk:s3:2.2.0")
  68. testLibrary("software.amazon.awssdk:sqs:2.2.0")
  69. testLibrary("software.amazon.awssdk:sns:2.2.0")
  70. testLibrary("software.amazon.awssdk:ses:2.2.0")
  71. }
  72. val latestDepTest = findProperty("testLatestDeps") as Boolean
  73. testing {
  74. suites {
  75. val s3PresignerTest by registering(JvmTestSuite::class) {
  76. dependencies {
  77. if (latestDepTest) {
  78. implementation("software.amazon.awssdk:s3:+")
  79. } else {
  80. implementation("software.amazon.awssdk:s3:2.10.12")
  81. }
  82. implementation(project(":instrumentation:aws-sdk:aws-sdk-2.2:library"))
  83. }
  84. }
  85. }
  86. }
  87. tasks {
  88. val testExperimentalSqs by registering(Test::class) {
  89. filter {
  90. excludeTestsMatching("Aws2SqsSuppressReceiveSpansTest")
  91. }
  92. systemProperty("otel.instrumentation.aws-sdk.experimental-use-propagator-for-messaging", "true")
  93. systemProperty("otel.instrumentation.messaging.experimental.receive-telemetry.enabled", "true")
  94. }
  95. val testReceiveSpansDisabled by registering(Test::class) {
  96. filter {
  97. includeTestsMatching("Aws2SqsSuppressReceiveSpansTest")
  98. }
  99. include("**/Aws2SqsSuppressReceiveSpansTest.*")
  100. }
  101. test {
  102. filter {
  103. excludeTestsMatching("Aws2SqsSuppressReceiveSpansTest")
  104. }
  105. systemProperty("otel.instrumentation.messaging.experimental.receive-telemetry.enabled", "true")
  106. }
  107. check {
  108. dependsOn(testExperimentalSqs)
  109. dependsOn(testReceiveSpansDisabled)
  110. dependsOn(testing.suites)
  111. }
  112. withType<Test>().configureEach {
  113. // TODO run tests both with and without experimental span attributes
  114. systemProperty("otel.instrumentation.aws-sdk.experimental-span-attributes", "true")
  115. systemProperty("otel.instrumentation.aws-sdk.experimental-record-individual-http-error", "true")
  116. systemProperty("testLatestDeps", findProperty("testLatestDeps") as Boolean)
  117. }
  118. withType<com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar>().configureEach {
  119. mergeServiceFiles {
  120. include("software/amazon/awssdk/global/handlers/execution.interceptors")
  121. }
  122. }
  123. }