diff --git a/conventions/src/main/kotlin/io.opentelemetry.instrumentation.javaagent-instrumentation.gradle.kts b/conventions/src/main/kotlin/io.opentelemetry.instrumentation.javaagent-instrumentation.gradle.kts index bc5b0226042b..166626c2ffb3 100644 --- a/conventions/src/main/kotlin/io.opentelemetry.instrumentation.javaagent-instrumentation.gradle.kts +++ b/conventions/src/main/kotlin/io.opentelemetry.instrumentation.javaagent-instrumentation.gradle.kts @@ -6,6 +6,7 @@ plugins { dependencies { add("muzzleBootstrap", "io.opentelemetry.instrumentation:opentelemetry-instrumentation-api") + add("muzzleBootstrap", "io.opentelemetry.instrumentation:opentelemetry-instrumentation-api-semconv") add("muzzleBootstrap", "io.opentelemetry.instrumentation:opentelemetry-instrumentation-api-annotation-support") add("muzzleBootstrap", "io.opentelemetry.instrumentation:opentelemetry-instrumentation-appender-api-internal") add("muzzleBootstrap", "io.opentelemetry.javaagent:opentelemetry-javaagent-instrumentation-api") diff --git a/conventions/src/main/kotlin/io.opentelemetry.instrumentation.javaagent-testing.gradle.kts b/conventions/src/main/kotlin/io.opentelemetry.instrumentation.javaagent-testing.gradle.kts index f1f16a50e514..89b6e4e500dc 100644 --- a/conventions/src/main/kotlin/io.opentelemetry.instrumentation.javaagent-testing.gradle.kts +++ b/conventions/src/main/kotlin/io.opentelemetry.instrumentation.javaagent-testing.gradle.kts @@ -21,6 +21,7 @@ dependencies { // Integration tests may need to define custom instrumentation modules so we include the standard // instrumentation infrastructure for testing too. compileOnly("io.opentelemetry.instrumentation:opentelemetry-instrumentation-api") + compileOnly("io.opentelemetry.instrumentation:opentelemetry-instrumentation-api-semconv") compileOnly("io.opentelemetry.javaagent:opentelemetry-javaagent-instrumentation-api") compileOnly("io.opentelemetry.javaagent:opentelemetry-javaagent-bootstrap") // Apply common dependencies for instrumentation. diff --git a/conventions/src/main/kotlin/io.opentelemetry.instrumentation.library-instrumentation.gradle.kts b/conventions/src/main/kotlin/io.opentelemetry.instrumentation.library-instrumentation.gradle.kts index 987f41a05d01..87dcdef00350 100644 --- a/conventions/src/main/kotlin/io.opentelemetry.instrumentation.library-instrumentation.gradle.kts +++ b/conventions/src/main/kotlin/io.opentelemetry.instrumentation.library-instrumentation.gradle.kts @@ -4,6 +4,7 @@ plugins { dependencies { api("io.opentelemetry.instrumentation:opentelemetry-instrumentation-api") + api("io.opentelemetry.instrumentation:opentelemetry-instrumentation-api-semconv") api("io.opentelemetry:opentelemetry-api") diff --git a/conventions/src/main/kotlin/otel.java-conventions.gradle.kts b/conventions/src/main/kotlin/otel.java-conventions.gradle.kts index 9bc6e3a7be77..574a25328141 100644 --- a/conventions/src/main/kotlin/otel.java-conventions.gradle.kts +++ b/conventions/src/main/kotlin/otel.java-conventions.gradle.kts @@ -368,6 +368,7 @@ configurations.configureEach { // what modules they add to reference generically. dependencySubstitution { substitute(module("io.opentelemetry.instrumentation:opentelemetry-instrumentation-api")).using(project(":instrumentation-api")) + substitute(module("io.opentelemetry.instrumentation:opentelemetry-instrumentation-api-semconv")).using(project(":instrumentation-api-semconv")) substitute(module("io.opentelemetry.instrumentation:opentelemetry-instrumentation-api-annotation-support")).using(project(":instrumentation-api-annotation-support")) substitute(module("io.opentelemetry.instrumentation:opentelemetry-instrumentation-appender-api-internal")).using(project(":instrumentation-appender-api-internal")) substitute(module("io.opentelemetry.javaagent:opentelemetry-javaagent-instrumentation-api")).using(project(":javaagent-instrumentation-api")) diff --git a/instrumentation-api-semconv/build.gradle.kts b/instrumentation-api-semconv/build.gradle.kts new file mode 100644 index 000000000000..852fed4416e1 --- /dev/null +++ b/instrumentation-api-semconv/build.gradle.kts @@ -0,0 +1,59 @@ +plugins { + id("org.xbib.gradle.plugin.jflex") + + id("otel.java-conventions") + id("otel.animalsniffer-conventions") + id("otel.jacoco-conventions") + id("otel.japicmp-conventions") + id("otel.publish-conventions") +} + +group = "io.opentelemetry.instrumentation" + +dependencies { + api("io.opentelemetry:opentelemetry-semconv") + api(project(":instrumentation-api")) + + compileOnly("com.google.auto.value:auto-value-annotations") + annotationProcessor("com.google.auto.value:auto-value") + + testImplementation(project(":testing-common")) + testImplementation("io.opentelemetry:opentelemetry-sdk-metrics") + testImplementation("io.opentelemetry:opentelemetry-sdk-testing") +} + +tasks { + // exclude auto-generated code + named("checkstyleMain") { + exclude("**/AutoSqlSanitizer.java") + } + + // Work around https://github.com/jflex-de/jflex/issues/762 + compileJava { + with(options) { + compilerArgs.add("-Xlint:-fallthrough") + } + } + + sourcesJar { + dependsOn("generateJflex") + } + + val testStatementSanitizerConfig by registering(Test::class) { + filter { + includeTestsMatching("StatementSanitizationConfigTest") + } + include("**/StatementSanitizationConfigTest.*") + jvmArgs("-Dotel.instrumentation.common.db-statement-sanitizer.enabled=false") + } + + test { + filter { + excludeTestsMatching("StatementSanitizationConfigTest") + } + } + + check { + dependsOn(testStatementSanitizerConfig) + } +} diff --git a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/config/ExperimentalConfig.java b/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/config/ExperimentalConfig.java similarity index 100% rename from instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/config/ExperimentalConfig.java rename to instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/config/ExperimentalConfig.java diff --git a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/db/RedisCommandSanitizer.java b/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/db/RedisCommandSanitizer.java similarity index 100% rename from instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/db/RedisCommandSanitizer.java rename to instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/db/RedisCommandSanitizer.java diff --git a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/db/SqlDialect.java b/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/db/SqlDialect.java similarity index 100% rename from instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/db/SqlDialect.java rename to instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/db/SqlDialect.java diff --git a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/db/SqlStatementInfo.java b/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/db/SqlStatementInfo.java similarity index 100% rename from instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/db/SqlStatementInfo.java rename to instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/db/SqlStatementInfo.java diff --git a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/db/SqlStatementSanitizer.java b/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/db/SqlStatementSanitizer.java similarity index 100% rename from instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/db/SqlStatementSanitizer.java rename to instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/db/SqlStatementSanitizer.java diff --git a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/db/StatementSanitizationConfig.java b/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/db/StatementSanitizationConfig.java similarity index 100% rename from instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/db/StatementSanitizationConfig.java rename to instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/db/StatementSanitizationConfig.java diff --git a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/PeerServiceAttributesExtractor.java b/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/PeerServiceAttributesExtractor.java similarity index 100% rename from instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/PeerServiceAttributesExtractor.java rename to instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/PeerServiceAttributesExtractor.java diff --git a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/SpanNames.java b/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/SpanNames.java similarity index 100% rename from instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/SpanNames.java rename to instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/SpanNames.java diff --git a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/code/CodeAttributesExtractor.java b/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/code/CodeAttributesExtractor.java similarity index 100% rename from instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/code/CodeAttributesExtractor.java rename to instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/code/CodeAttributesExtractor.java diff --git a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/code/CodeAttributesGetter.java b/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/code/CodeAttributesGetter.java similarity index 100% rename from instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/code/CodeAttributesGetter.java rename to instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/code/CodeAttributesGetter.java diff --git a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/code/CodeSpanNameExtractor.java b/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/code/CodeSpanNameExtractor.java similarity index 100% rename from instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/code/CodeSpanNameExtractor.java rename to instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/code/CodeSpanNameExtractor.java diff --git a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/db/DbClientAttributesExtractor.java b/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/db/DbClientAttributesExtractor.java similarity index 100% rename from instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/db/DbClientAttributesExtractor.java rename to instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/db/DbClientAttributesExtractor.java diff --git a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/db/DbClientAttributesGetter.java b/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/db/DbClientAttributesGetter.java similarity index 100% rename from instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/db/DbClientAttributesGetter.java rename to instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/db/DbClientAttributesGetter.java diff --git a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/db/DbClientCommonAttributesExtractor.java b/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/db/DbClientCommonAttributesExtractor.java similarity index 100% rename from instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/db/DbClientCommonAttributesExtractor.java rename to instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/db/DbClientCommonAttributesExtractor.java diff --git a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/db/DbClientCommonAttributesGetter.java b/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/db/DbClientCommonAttributesGetter.java similarity index 100% rename from instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/db/DbClientCommonAttributesGetter.java rename to instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/db/DbClientCommonAttributesGetter.java diff --git a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/db/DbClientSpanNameExtractor.java b/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/db/DbClientSpanNameExtractor.java similarity index 100% rename from instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/db/DbClientSpanNameExtractor.java rename to instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/db/DbClientSpanNameExtractor.java diff --git a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/db/SqlClientAttributesExtractor.java b/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/db/SqlClientAttributesExtractor.java similarity index 100% rename from instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/db/SqlClientAttributesExtractor.java rename to instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/db/SqlClientAttributesExtractor.java diff --git a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/db/SqlClientAttributesExtractorBuilder.java b/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/db/SqlClientAttributesExtractorBuilder.java similarity index 100% rename from instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/db/SqlClientAttributesExtractorBuilder.java rename to instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/db/SqlClientAttributesExtractorBuilder.java diff --git a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/db/SqlClientAttributesGetter.java b/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/db/SqlClientAttributesGetter.java similarity index 100% rename from instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/db/SqlClientAttributesGetter.java rename to instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/db/SqlClientAttributesGetter.java diff --git a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/CapturedHttpHeadersUtil.java b/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/CapturedHttpHeadersUtil.java similarity index 100% rename from instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/CapturedHttpHeadersUtil.java rename to instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/CapturedHttpHeadersUtil.java diff --git a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/ForwardedHeaderParser.java b/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/ForwardedHeaderParser.java similarity index 100% rename from instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/ForwardedHeaderParser.java rename to instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/ForwardedHeaderParser.java diff --git a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpClientAttributesExtractor.java b/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpClientAttributesExtractor.java similarity index 100% rename from instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpClientAttributesExtractor.java rename to instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpClientAttributesExtractor.java diff --git a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpClientAttributesExtractorBuilder.java b/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpClientAttributesExtractorBuilder.java similarity index 100% rename from instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpClientAttributesExtractorBuilder.java rename to instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpClientAttributesExtractorBuilder.java diff --git a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpClientAttributesGetter.java b/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpClientAttributesGetter.java similarity index 100% rename from instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpClientAttributesGetter.java rename to instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpClientAttributesGetter.java diff --git a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpClientMetrics.java b/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpClientMetrics.java similarity index 100% rename from instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpClientMetrics.java rename to instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpClientMetrics.java diff --git a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpCommonAttributesExtractor.java b/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpCommonAttributesExtractor.java similarity index 100% rename from instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpCommonAttributesExtractor.java rename to instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpCommonAttributesExtractor.java diff --git a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpCommonAttributesGetter.java b/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpCommonAttributesGetter.java similarity index 100% rename from instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpCommonAttributesGetter.java rename to instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpCommonAttributesGetter.java diff --git a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpRouteBiGetter.java b/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpRouteBiGetter.java similarity index 100% rename from instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpRouteBiGetter.java rename to instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpRouteBiGetter.java diff --git a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpRouteGetter.java b/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpRouteGetter.java similarity index 100% rename from instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpRouteGetter.java rename to instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpRouteGetter.java diff --git a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpRouteHolder.java b/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpRouteHolder.java similarity index 100% rename from instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpRouteHolder.java rename to instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpRouteHolder.java diff --git a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpRouteSource.java b/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpRouteSource.java similarity index 100% rename from instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpRouteSource.java rename to instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpRouteSource.java diff --git a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpServerAttributesExtractor.java b/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpServerAttributesExtractor.java similarity index 100% rename from instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpServerAttributesExtractor.java rename to instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpServerAttributesExtractor.java diff --git a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpServerAttributesExtractorBuilder.java b/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpServerAttributesExtractorBuilder.java similarity index 100% rename from instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpServerAttributesExtractorBuilder.java rename to instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpServerAttributesExtractorBuilder.java diff --git a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpServerAttributesGetter.java b/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpServerAttributesGetter.java similarity index 100% rename from instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpServerAttributesGetter.java rename to instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpServerAttributesGetter.java diff --git a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpServerMetrics.java b/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpServerMetrics.java similarity index 100% rename from instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpServerMetrics.java rename to instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpServerMetrics.java diff --git a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpSpanNameExtractor.java b/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpSpanNameExtractor.java similarity index 100% rename from instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpSpanNameExtractor.java rename to instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpSpanNameExtractor.java diff --git a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpSpanStatusExtractor.java b/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpSpanStatusExtractor.java similarity index 100% rename from instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpSpanStatusExtractor.java rename to instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpSpanStatusExtractor.java diff --git a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpStatusConverter.java b/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpStatusConverter.java similarity index 100% rename from instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpStatusConverter.java rename to instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpStatusConverter.java diff --git a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/TemporaryMetricsView.java b/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/TemporaryMetricsView.java similarity index 100% rename from instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/TemporaryMetricsView.java rename to instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/TemporaryMetricsView.java diff --git a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/messaging/MessageOperation.java b/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/messaging/MessageOperation.java similarity index 100% rename from instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/messaging/MessageOperation.java rename to instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/messaging/MessageOperation.java diff --git a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/messaging/MessagingAttributesExtractor.java b/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/messaging/MessagingAttributesExtractor.java similarity index 100% rename from instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/messaging/MessagingAttributesExtractor.java rename to instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/messaging/MessagingAttributesExtractor.java diff --git a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/messaging/MessagingAttributesGetter.java b/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/messaging/MessagingAttributesGetter.java similarity index 100% rename from instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/messaging/MessagingAttributesGetter.java rename to instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/messaging/MessagingAttributesGetter.java diff --git a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/messaging/MessagingSpanNameExtractor.java b/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/messaging/MessagingSpanNameExtractor.java similarity index 100% rename from instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/messaging/MessagingSpanNameExtractor.java rename to instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/messaging/MessagingSpanNameExtractor.java diff --git a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/net/InetSocketAddressNetClientAttributesGetter.java b/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/net/InetSocketAddressNetClientAttributesGetter.java similarity index 100% rename from instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/net/InetSocketAddressNetClientAttributesGetter.java rename to instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/net/InetSocketAddressNetClientAttributesGetter.java diff --git a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/net/InetSocketAddressNetServerAttributesGetter.java b/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/net/InetSocketAddressNetServerAttributesGetter.java similarity index 100% rename from instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/net/InetSocketAddressNetServerAttributesGetter.java rename to instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/net/InetSocketAddressNetServerAttributesGetter.java diff --git a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/net/NetClientAttributesExtractor.java b/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/net/NetClientAttributesExtractor.java similarity index 100% rename from instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/net/NetClientAttributesExtractor.java rename to instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/net/NetClientAttributesExtractor.java diff --git a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/net/NetClientAttributesGetter.java b/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/net/NetClientAttributesGetter.java similarity index 100% rename from instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/net/NetClientAttributesGetter.java rename to instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/net/NetClientAttributesGetter.java diff --git a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/net/NetServerAttributesExtractor.java b/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/net/NetServerAttributesExtractor.java similarity index 100% rename from instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/net/NetServerAttributesExtractor.java rename to instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/net/NetServerAttributesExtractor.java diff --git a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/net/NetServerAttributesGetter.java b/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/net/NetServerAttributesGetter.java similarity index 100% rename from instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/net/NetServerAttributesGetter.java rename to instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/net/NetServerAttributesGetter.java diff --git a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/rpc/MetricsView.java b/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/rpc/MetricsView.java similarity index 100% rename from instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/rpc/MetricsView.java rename to instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/rpc/MetricsView.java diff --git a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/rpc/RpcAttributesGetter.java b/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/rpc/RpcAttributesGetter.java similarity index 100% rename from instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/rpc/RpcAttributesGetter.java rename to instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/rpc/RpcAttributesGetter.java diff --git a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/rpc/RpcClientAttributesExtractor.java b/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/rpc/RpcClientAttributesExtractor.java similarity index 100% rename from instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/rpc/RpcClientAttributesExtractor.java rename to instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/rpc/RpcClientAttributesExtractor.java diff --git a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/rpc/RpcClientMetrics.java b/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/rpc/RpcClientMetrics.java similarity index 100% rename from instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/rpc/RpcClientMetrics.java rename to instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/rpc/RpcClientMetrics.java diff --git a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/rpc/RpcCommonAttributesExtractor.java b/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/rpc/RpcCommonAttributesExtractor.java similarity index 100% rename from instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/rpc/RpcCommonAttributesExtractor.java rename to instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/rpc/RpcCommonAttributesExtractor.java diff --git a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/rpc/RpcServerAttributesExtractor.java b/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/rpc/RpcServerAttributesExtractor.java similarity index 100% rename from instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/rpc/RpcServerAttributesExtractor.java rename to instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/rpc/RpcServerAttributesExtractor.java diff --git a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/rpc/RpcServerMetrics.java b/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/rpc/RpcServerMetrics.java similarity index 100% rename from instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/rpc/RpcServerMetrics.java rename to instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/rpc/RpcServerMetrics.java diff --git a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/rpc/RpcSpanNameExtractor.java b/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/rpc/RpcSpanNameExtractor.java similarity index 100% rename from instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/rpc/RpcSpanNameExtractor.java rename to instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/rpc/RpcSpanNameExtractor.java diff --git a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/log/LoggingContextConstants.java b/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/log/LoggingContextConstants.java similarity index 100% rename from instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/log/LoggingContextConstants.java rename to instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/log/LoggingContextConstants.java diff --git a/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/package-info.java b/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/package-info.java new file mode 100644 index 000000000000..7b8ea44d48ce --- /dev/null +++ b/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/package-info.java @@ -0,0 +1,4 @@ +@ParametersAreNonnullByDefault +package io.opentelemetry.instrumentation.api; + +import javax.annotation.ParametersAreNonnullByDefault; diff --git a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/server/ServerSpan.java b/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/server/ServerSpan.java similarity index 100% rename from instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/server/ServerSpan.java rename to instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/server/ServerSpan.java diff --git a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/util/ClassAndMethod.java b/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/util/ClassAndMethod.java similarity index 100% rename from instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/util/ClassAndMethod.java rename to instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/util/ClassAndMethod.java diff --git a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/util/ClassAndMethodAttributesGetter.java b/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/util/ClassAndMethodAttributesGetter.java similarity index 100% rename from instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/util/ClassAndMethodAttributesGetter.java rename to instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/util/ClassAndMethodAttributesGetter.java diff --git a/instrumentation-api/src/main/jflex/SqlSanitizer.jflex b/instrumentation-api-semconv/src/main/jflex/SqlSanitizer.jflex similarity index 100% rename from instrumentation-api/src/main/jflex/SqlSanitizer.jflex rename to instrumentation-api-semconv/src/main/jflex/SqlSanitizer.jflex diff --git a/instrumentation-api/src/test/groovy/io/opentelemetry/instrumentation/api/db/RedisCommandSanitizerTest.groovy b/instrumentation-api-semconv/src/test/groovy/io/opentelemetry/instrumentation/api/db/RedisCommandSanitizerTest.groovy similarity index 100% rename from instrumentation-api/src/test/groovy/io/opentelemetry/instrumentation/api/db/RedisCommandSanitizerTest.groovy rename to instrumentation-api-semconv/src/test/groovy/io/opentelemetry/instrumentation/api/db/RedisCommandSanitizerTest.groovy diff --git a/instrumentation-api/src/test/groovy/io/opentelemetry/instrumentation/api/db/SqlStatementSanitizerTest.groovy b/instrumentation-api-semconv/src/test/groovy/io/opentelemetry/instrumentation/api/db/SqlStatementSanitizerTest.groovy similarity index 100% rename from instrumentation-api/src/test/groovy/io/opentelemetry/instrumentation/api/db/SqlStatementSanitizerTest.groovy rename to instrumentation-api-semconv/src/test/groovy/io/opentelemetry/instrumentation/api/db/SqlStatementSanitizerTest.groovy diff --git a/instrumentation-api/src/test/java/io/opentelemetry/instrumentation/api/db/StatementSanitizationConfigTest.java b/instrumentation-api-semconv/src/test/java/io/opentelemetry/instrumentation/api/db/StatementSanitizationConfigTest.java similarity index 100% rename from instrumentation-api/src/test/java/io/opentelemetry/instrumentation/api/db/StatementSanitizationConfigTest.java rename to instrumentation-api-semconv/src/test/java/io/opentelemetry/instrumentation/api/db/StatementSanitizationConfigTest.java diff --git a/instrumentation-api/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/PeerServiceAttributesExtractorTest.java b/instrumentation-api-semconv/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/PeerServiceAttributesExtractorTest.java similarity index 100% rename from instrumentation-api/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/PeerServiceAttributesExtractorTest.java rename to instrumentation-api-semconv/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/PeerServiceAttributesExtractorTest.java diff --git a/instrumentation-api/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/code/CodeAttributesExtractorTest.java b/instrumentation-api-semconv/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/code/CodeAttributesExtractorTest.java similarity index 100% rename from instrumentation-api/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/code/CodeAttributesExtractorTest.java rename to instrumentation-api-semconv/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/code/CodeAttributesExtractorTest.java diff --git a/instrumentation-api/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/code/CodeSpanNameExtractorTest.java b/instrumentation-api-semconv/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/code/CodeSpanNameExtractorTest.java similarity index 100% rename from instrumentation-api/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/code/CodeSpanNameExtractorTest.java rename to instrumentation-api-semconv/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/code/CodeSpanNameExtractorTest.java diff --git a/instrumentation-api/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/db/DbClientAttributesExtractorTest.java b/instrumentation-api-semconv/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/db/DbClientAttributesExtractorTest.java similarity index 100% rename from instrumentation-api/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/db/DbClientAttributesExtractorTest.java rename to instrumentation-api-semconv/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/db/DbClientAttributesExtractorTest.java diff --git a/instrumentation-api/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/db/DbClientSpanNameExtractorTest.java b/instrumentation-api-semconv/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/db/DbClientSpanNameExtractorTest.java similarity index 100% rename from instrumentation-api/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/db/DbClientSpanNameExtractorTest.java rename to instrumentation-api-semconv/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/db/DbClientSpanNameExtractorTest.java diff --git a/instrumentation-api/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/db/SqlClientAttributesExtractorTest.java b/instrumentation-api-semconv/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/db/SqlClientAttributesExtractorTest.java similarity index 100% rename from instrumentation-api/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/db/SqlClientAttributesExtractorTest.java rename to instrumentation-api-semconv/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/db/SqlClientAttributesExtractorTest.java diff --git a/instrumentation-api/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/http/ForwardedHeaderParserTest.java b/instrumentation-api-semconv/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/http/ForwardedHeaderParserTest.java similarity index 100% rename from instrumentation-api/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/http/ForwardedHeaderParserTest.java rename to instrumentation-api-semconv/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/http/ForwardedHeaderParserTest.java diff --git a/instrumentation-api/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpClientAttributesExtractorTest.java b/instrumentation-api-semconv/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpClientAttributesExtractorTest.java similarity index 100% rename from instrumentation-api/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpClientAttributesExtractorTest.java rename to instrumentation-api-semconv/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpClientAttributesExtractorTest.java diff --git a/instrumentation-api/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpClientMetricsTest.java b/instrumentation-api-semconv/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpClientMetricsTest.java similarity index 100% rename from instrumentation-api/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpClientMetricsTest.java rename to instrumentation-api-semconv/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpClientMetricsTest.java diff --git a/instrumentation-api/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpClientSpanStatusExtractorTest.java b/instrumentation-api-semconv/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpClientSpanStatusExtractorTest.java similarity index 100% rename from instrumentation-api/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpClientSpanStatusExtractorTest.java rename to instrumentation-api-semconv/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpClientSpanStatusExtractorTest.java diff --git a/instrumentation-api/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpClientStatusConverterTest.groovy b/instrumentation-api-semconv/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpClientStatusConverterTest.groovy similarity index 100% rename from instrumentation-api/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpClientStatusConverterTest.groovy rename to instrumentation-api-semconv/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpClientStatusConverterTest.groovy diff --git a/instrumentation-api/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpServerAttributesExtractorTest.java b/instrumentation-api-semconv/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpServerAttributesExtractorTest.java similarity index 100% rename from instrumentation-api/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpServerAttributesExtractorTest.java rename to instrumentation-api-semconv/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpServerAttributesExtractorTest.java diff --git a/instrumentation-api/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpServerMetricsTest.java b/instrumentation-api-semconv/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpServerMetricsTest.java similarity index 100% rename from instrumentation-api/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpServerMetricsTest.java rename to instrumentation-api-semconv/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpServerMetricsTest.java diff --git a/instrumentation-api/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpServerStatusConverterTest.groovy b/instrumentation-api-semconv/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpServerStatusConverterTest.groovy similarity index 100% rename from instrumentation-api/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpServerStatusConverterTest.groovy rename to instrumentation-api-semconv/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpServerStatusConverterTest.groovy diff --git a/instrumentation-api/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpSpanNameExtractorTest.java b/instrumentation-api-semconv/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpSpanNameExtractorTest.java similarity index 100% rename from instrumentation-api/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpSpanNameExtractorTest.java rename to instrumentation-api-semconv/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpSpanNameExtractorTest.java diff --git a/instrumentation-api/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpSpanStatusExtractorTest.java b/instrumentation-api-semconv/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpSpanStatusExtractorTest.java similarity index 100% rename from instrumentation-api/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpSpanStatusExtractorTest.java rename to instrumentation-api-semconv/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpSpanStatusExtractorTest.java diff --git a/instrumentation-api/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/http/TemporaryMetricsViewTest.java b/instrumentation-api-semconv/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/http/TemporaryMetricsViewTest.java similarity index 100% rename from instrumentation-api/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/http/TemporaryMetricsViewTest.java rename to instrumentation-api-semconv/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/http/TemporaryMetricsViewTest.java diff --git a/instrumentation-api/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/messaging/MessagingAttributesExtractorTest.java b/instrumentation-api-semconv/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/messaging/MessagingAttributesExtractorTest.java similarity index 100% rename from instrumentation-api/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/messaging/MessagingAttributesExtractorTest.java rename to instrumentation-api-semconv/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/messaging/MessagingAttributesExtractorTest.java diff --git a/instrumentation-api/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/messaging/MessagingSpanNameExtractorTest.java b/instrumentation-api-semconv/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/messaging/MessagingSpanNameExtractorTest.java similarity index 100% rename from instrumentation-api/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/messaging/MessagingSpanNameExtractorTest.java rename to instrumentation-api-semconv/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/messaging/MessagingSpanNameExtractorTest.java diff --git a/instrumentation-api/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/net/InetSocketAddressNetClientAttributesGetterTest.java b/instrumentation-api-semconv/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/net/InetSocketAddressNetClientAttributesGetterTest.java similarity index 100% rename from instrumentation-api/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/net/InetSocketAddressNetClientAttributesGetterTest.java rename to instrumentation-api-semconv/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/net/InetSocketAddressNetClientAttributesGetterTest.java diff --git a/instrumentation-api/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/net/InetSocketAddressNetServerAttributesGetterTest.java b/instrumentation-api-semconv/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/net/InetSocketAddressNetServerAttributesGetterTest.java similarity index 100% rename from instrumentation-api/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/net/InetSocketAddressNetServerAttributesGetterTest.java rename to instrumentation-api-semconv/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/net/InetSocketAddressNetServerAttributesGetterTest.java diff --git a/instrumentation-api/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/net/NetClientAttributesExtractorTest.java b/instrumentation-api-semconv/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/net/NetClientAttributesExtractorTest.java similarity index 100% rename from instrumentation-api/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/net/NetClientAttributesExtractorTest.java rename to instrumentation-api-semconv/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/net/NetClientAttributesExtractorTest.java diff --git a/instrumentation-api/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/net/NetServerAttributesExtractorTest.java b/instrumentation-api-semconv/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/net/NetServerAttributesExtractorTest.java similarity index 100% rename from instrumentation-api/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/net/NetServerAttributesExtractorTest.java rename to instrumentation-api-semconv/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/net/NetServerAttributesExtractorTest.java diff --git a/instrumentation-api/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/rpc/RpcAttributesExtractorTest.java b/instrumentation-api-semconv/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/rpc/RpcAttributesExtractorTest.java similarity index 100% rename from instrumentation-api/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/rpc/RpcAttributesExtractorTest.java rename to instrumentation-api-semconv/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/rpc/RpcAttributesExtractorTest.java diff --git a/instrumentation-api/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/rpc/RpcClientMetricsTest.java b/instrumentation-api-semconv/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/rpc/RpcClientMetricsTest.java similarity index 100% rename from instrumentation-api/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/rpc/RpcClientMetricsTest.java rename to instrumentation-api-semconv/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/rpc/RpcClientMetricsTest.java diff --git a/instrumentation-api/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/rpc/RpcServerMetricsTest.java b/instrumentation-api-semconv/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/rpc/RpcServerMetricsTest.java similarity index 100% rename from instrumentation-api/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/rpc/RpcServerMetricsTest.java rename to instrumentation-api-semconv/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/rpc/RpcServerMetricsTest.java diff --git a/instrumentation-api/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/rpc/RpcSpanNameExtractorTest.java b/instrumentation-api-semconv/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/rpc/RpcSpanNameExtractorTest.java similarity index 100% rename from instrumentation-api/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/rpc/RpcSpanNameExtractorTest.java rename to instrumentation-api-semconv/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/rpc/RpcSpanNameExtractorTest.java diff --git a/instrumentation-api/build.gradle.kts b/instrumentation-api/build.gradle.kts index 2e329de5aede..aca99db42278 100644 --- a/instrumentation-api/build.gradle.kts +++ b/instrumentation-api/build.gradle.kts @@ -1,8 +1,6 @@ import net.ltgt.gradle.errorprone.errorprone plugins { - id("org.xbib.gradle.plugin.jflex") - id("otel.java-conventions") id("otel.animalsniffer-conventions") id("otel.jacoco-conventions") @@ -15,7 +13,6 @@ group = "io.opentelemetry.instrumentation" dependencies { api("io.opentelemetry:opentelemetry-api") - api("io.opentelemetry:opentelemetry-semconv") compileOnly("com.google.auto.value:auto-value-annotations") annotationProcessor("com.google.auto.value:auto-value") @@ -23,6 +20,8 @@ dependencies { testImplementation(project(":testing-common")) testImplementation("io.opentelemetry:opentelemetry-sdk-metrics") testImplementation("io.opentelemetry:opentelemetry-sdk-testing") + + jmhImplementation(project(":instrumentation-api-semconv")) } tasks { @@ -30,35 +29,6 @@ tasks { exclude("**/concurrentlinkedhashmap/**") } - // Work around https://github.com/jflex-de/jflex/issues/762 - compileJava { - with(options) { - compilerArgs.add("-Xlint:-fallthrough") - } - } - - sourcesJar { - dependsOn("generateJflex") - } - - val testStatementSanitizerConfig by registering(Test::class) { - filter { - includeTestsMatching("StatementSanitizationConfigTest") - } - include("**/StatementSanitizationConfigTest.*") - jvmArgs("-Dotel.instrumentation.common.db-statement-sanitizer.enabled=false") - } - - test { - filter { - excludeTestsMatching("StatementSanitizationConfigTest") - } - } - - check { - dependsOn(testStatementSanitizerConfig) - } - // TODO this should live in jmh-conventions named("jmhCompileGeneratedClasses") { options.errorprone { diff --git a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/AttributesExtractor.java b/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/AttributesExtractor.java index 16b2a8f8808f..2142b3f8adf4 100644 --- a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/AttributesExtractor.java +++ b/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/AttributesExtractor.java @@ -8,9 +8,6 @@ import io.opentelemetry.api.common.AttributeKey; import io.opentelemetry.api.common.AttributesBuilder; import io.opentelemetry.context.Context; -import io.opentelemetry.instrumentation.api.instrumenter.db.DbClientAttributesExtractor; -import io.opentelemetry.instrumentation.api.instrumenter.http.HttpClientAttributesExtractor; -import io.opentelemetry.instrumentation.api.instrumenter.net.NetServerAttributesExtractor; import javax.annotation.Nullable; /** @@ -20,10 +17,6 @@ * Throwable) on end} with both {@link REQUEST} and {@link RESPONSE} to allow populating attributes * at each stage of a request's lifecycle. It is best to populate as much as possible in {@link * #onStart(AttributesBuilder, Context, Object)} to have it available during sampling. - * - * @see DbClientAttributesExtractor - * @see HttpClientAttributesExtractor - * @see NetServerAttributesExtractor */ public interface AttributesExtractor { diff --git a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/InstrumenterBuilder.java b/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/InstrumenterBuilder.java index 76304212b58f..bd9c5d5475b3 100644 --- a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/InstrumenterBuilder.java +++ b/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/InstrumenterBuilder.java @@ -16,10 +16,6 @@ import io.opentelemetry.context.propagation.TextMapSetter; import io.opentelemetry.instrumentation.api.annotations.UnstableApi; import io.opentelemetry.instrumentation.api.config.Config; -import io.opentelemetry.instrumentation.api.instrumenter.db.DbClientAttributesExtractor; -import io.opentelemetry.instrumentation.api.instrumenter.http.HttpClientAttributesExtractor; -import io.opentelemetry.instrumentation.api.instrumenter.messaging.MessageOperation; -import io.opentelemetry.instrumentation.api.instrumenter.rpc.RpcClientAttributesExtractor; import io.opentelemetry.instrumentation.api.internal.SpanKey; import io.opentelemetry.instrumentation.api.internal.SpanKeyProvider; import java.util.ArrayList; @@ -175,10 +171,10 @@ public InstrumenterBuilder setDisabled(boolean disabled) { *

When enabled:. * *

    - *
  • CLIENT nested spans are suppressed depending on their type: {@linkplain - * HttpClientAttributesExtractor HTTP}, {@linkplain RpcClientAttributesExtractor RPC} or - * {@linkplain DbClientAttributesExtractor database} clients. If a span with the same type - * is present in the parent context object, new span of the same type will not be started. + *
  • CLIENT nested spans are suppressed depending on their type: {@code + * HttpClientAttributesExtractor HTTP}, {@code RpcClientAttributesExtractor RPC} or {@code + * DbClientAttributesExtractor database} clients. If a span with the same type is present in + * the parent context object, new span of the same type will not be started. *
* *

When disabled: @@ -192,9 +188,9 @@ public InstrumenterBuilder setDisabled(boolean disabled) { *

    *
  • SERVER nested spans are always suppressed. If a SERVER span is present in the parent * context object, new SERVER span will not be started. - *
  • Messaging (PRODUCER and CONSUMER) nested spans are suppressed depending on their - * {@linkplain MessageOperation operation}. If a span with the same operation is present in - * the parent context object, new span with the same operation will not be started. + *
  • Messaging (PRODUCER and CONSUMER) nested spans are suppressed depending on their {@code + * MessageOperation operation}. If a span with the same operation is present in the parent + * context object, new span with the same operation will not be started. *
  • INTERNAL spans are never suppressed. *
*/ diff --git a/instrumentation-api/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/InstrumenterTest.java b/instrumentation-api/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/InstrumenterTest.java index 3dddb50ad2e7..6efe3219b818 100644 --- a/instrumentation-api/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/InstrumenterTest.java +++ b/instrumentation-api/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/InstrumenterTest.java @@ -24,19 +24,12 @@ import io.opentelemetry.context.ContextKey; import io.opentelemetry.context.propagation.TextMapGetter; import io.opentelemetry.instrumentation.api.InstrumentationVersion; -import io.opentelemetry.instrumentation.api.instrumenter.db.DbClientAttributesExtractor; -import io.opentelemetry.instrumentation.api.instrumenter.http.HttpClientAttributesExtractor; -import io.opentelemetry.instrumentation.api.instrumenter.http.HttpServerAttributesExtractor; -import io.opentelemetry.instrumentation.api.instrumenter.messaging.MessagingAttributesExtractor; -import io.opentelemetry.instrumentation.api.instrumenter.net.NetServerAttributesExtractor; -import io.opentelemetry.instrumentation.api.instrumenter.net.NetServerAttributesGetter; -import io.opentelemetry.instrumentation.api.instrumenter.rpc.RpcClientAttributesExtractor; import io.opentelemetry.instrumentation.api.internal.SpanKey; +import io.opentelemetry.instrumentation.api.internal.SpanKeyProvider; import io.opentelemetry.sdk.common.InstrumentationLibraryInfo; import io.opentelemetry.sdk.testing.junit5.OpenTelemetryExtension; import io.opentelemetry.sdk.trace.data.LinkData; import io.opentelemetry.sdk.trace.data.StatusData; -import io.opentelemetry.semconv.trace.attributes.SemanticAttributes; import java.time.Instant; import java.util.Collections; import java.util.HashMap; @@ -164,19 +157,19 @@ public String get(Map carrier, String key) { @RegisterExtension static final OpenTelemetryExtension otelTesting = OpenTelemetryExtension.create(); - @Mock - HttpClientAttributesExtractor, Map> mockHttpClientAttributes; + @Mock(extraInterfaces = SpanKeyProvider.class) + AttributesExtractor, Map> mockHttpClientAttributes; - @Mock - HttpServerAttributesExtractor, Map> mockHttpServerAttributes; + @Mock(extraInterfaces = SpanKeyProvider.class) + AttributesExtractor, Map> mockDbClientAttributes; - @Mock DbClientAttributesExtractor, Map> mockDbAttributes; + @Mock(extraInterfaces = SpanKeyProvider.class) + AttributesExtractor, Map> mockRpcClientAttributes; - @Mock - MessagingAttributesExtractor, Map> mockMessagingAttributes; + @Mock(extraInterfaces = SpanKeyProvider.class) + AttributesExtractor, Map> mockMessagingProducerAttributes; - @Mock RpcClientAttributesExtractor, Map> mockRpcAttributes; - @Mock NetServerAttributesExtractor, Map> mockNetAttributes; + @Mock AttributesExtractor, Map> mockNetClientAttributes; @Test void server() { @@ -287,41 +280,6 @@ void server_parent() { .hasParentSpanId("090a0b0c0d0e0f00"))); } - @Test - void server_http() { - Instrumenter, Map> instrumenter = - Instrumenter., Map>builder( - otelTesting.getOpenTelemetry(), "test", unused -> "span") - .addAttributesExtractors( - mockHttpServerAttributes, - NetServerAttributesExtractor.create(new ConstantNetPeerIpGetter<>("2.2.2.2")), - new AttributesExtractor1(), - new AttributesExtractor2()) - .addSpanLinksExtractor(new LinksExtractor()) - .newServerInstrumenter(new MapGetter()); - - Context context = instrumenter.start(Context.root(), REQUEST); - SpanContext spanContext = Span.fromContext(context).getSpanContext(); - - assertThat(spanContext.isValid()).isTrue(); - assertThat(SpanKey.SERVER.fromContextOrNull(context).getSpanContext()).isEqualTo(spanContext); - - instrumenter.end(context, REQUEST, RESPONSE, null); - - otelTesting - .assertTraces() - .hasTracesSatisfyingExactly( - trace -> - trace.hasSpansSatisfyingExactly( - span -> - span.hasName("span") - .hasAttributesSatisfying( - attributes -> - assertThat(attributes) - .containsEntry( - SemanticAttributes.NET_PEER_IP, "2.2.2.2")))); - } - @Test void client() { Instrumenter, Map> instrumenter = @@ -578,8 +536,13 @@ void clientNestedSpansSuppressed_whenInstrumentationTypeDisabled() { @Test void clientNestedSpansSuppressed_whenInstrumentationTypeDisabled2() { + when(((SpanKeyProvider) mockHttpClientAttributes).internalGetSpanKey()) + .thenReturn(SpanKey.HTTP_CLIENT); + when(((SpanKeyProvider) mockDbClientAttributes).internalGetSpanKey()) + .thenReturn(SpanKey.DB_CLIENT); + Instrumenter, Map> instrumenterOuter = - getInstrumenterWithType(false, mockDbAttributes); + getInstrumenterWithType(false, mockDbClientAttributes); Instrumenter, Map> instrumenterInner = getInstrumenterWithType(false, mockHttpClientAttributes); @@ -591,12 +554,13 @@ void clientNestedSpansSuppressed_whenInstrumentationTypeDisabled2() { @Test void clientNestedSuppressed_whenSameInstrumentationType() { - when(mockDbAttributes.internalGetSpanKey()).thenCallRealMethod(); + when(((SpanKeyProvider) mockDbClientAttributes).internalGetSpanKey()) + .thenReturn(SpanKey.DB_CLIENT); Instrumenter, Map> instrumenterOuter = - getInstrumenterWithType(true, mockDbAttributes); + getInstrumenterWithType(true, mockDbClientAttributes); Instrumenter, Map> instrumenterInner = - getInstrumenterWithType(true, mockDbAttributes); + getInstrumenterWithType(true, mockDbClientAttributes); Map request = new HashMap<>(REQUEST); @@ -609,8 +573,13 @@ void clientNestedSuppressed_whenSameInstrumentationType() { @Test void clientNestedNotSuppressed_wehnDifferentInstrumentationCategories() { + when(((SpanKeyProvider) mockHttpClientAttributes).internalGetSpanKey()) + .thenReturn(SpanKey.HTTP_CLIENT); + when(((SpanKeyProvider) mockDbClientAttributes).internalGetSpanKey()) + .thenReturn(SpanKey.DB_CLIENT); + Instrumenter, Map> instrumenterOuter = - getInstrumenterWithType(true, mockDbAttributes); + getInstrumenterWithType(true, mockDbClientAttributes); Instrumenter, Map> instrumenterInner = getInstrumenterWithType(true, mockHttpClientAttributes); @@ -649,7 +618,8 @@ void clientNestedGenericSpansNotSuppressed_whenNoExtractors() { @Test void instrumentationTypeDetected_http() { - when(mockHttpClientAttributes.internalGetSpanKey()).thenCallRealMethod(); + when(((SpanKeyProvider) mockHttpClientAttributes).internalGetSpanKey()) + .thenReturn(SpanKey.HTTP_CLIENT); Instrumenter, Map> instrumenter = getInstrumenterWithType(true, mockHttpClientAttributes, new AttributesExtractor1()); @@ -662,10 +632,11 @@ void instrumentationTypeDetected_http() { @Test void instrumentationTypeDetected_db() { - when(mockDbAttributes.internalGetSpanKey()).thenCallRealMethod(); + when(((SpanKeyProvider) mockDbClientAttributes).internalGetSpanKey()) + .thenReturn(SpanKey.DB_CLIENT); Instrumenter, Map> instrumenter = - getInstrumenterWithType(true, mockDbAttributes, new AttributesExtractor2()); + getInstrumenterWithType(true, mockDbClientAttributes, new AttributesExtractor2()); Map request = new HashMap<>(REQUEST); @@ -675,10 +646,11 @@ void instrumentationTypeDetected_db() { @Test void instrumentationTypeDetected_rpc() { - when(mockRpcAttributes.internalGetSpanKey()).thenCallRealMethod(); + when(((SpanKeyProvider) mockRpcClientAttributes).internalGetSpanKey()) + .thenReturn(SpanKey.RPC_CLIENT); Instrumenter, Map> instrumenter = - getInstrumenterWithType(true, mockRpcAttributes); + getInstrumenterWithType(true, mockRpcClientAttributes); Map request = new HashMap<>(REQUEST); @@ -688,10 +660,11 @@ void instrumentationTypeDetected_rpc() { @Test void instrumentationTypeDetected_producer() { - when(mockMessagingAttributes.internalGetSpanKey()).thenReturn(SpanKey.PRODUCER); + when(((SpanKeyProvider) mockMessagingProducerAttributes).internalGetSpanKey()) + .thenReturn(SpanKey.PRODUCER); Instrumenter, Map> instrumenter = - getInstrumenterWithType(true, mockMessagingAttributes); + getInstrumenterWithType(true, mockMessagingProducerAttributes); Map request = new HashMap<>(REQUEST); @@ -701,15 +674,18 @@ void instrumentationTypeDetected_producer() { @Test void instrumentationTypeDetected_mix() { - when(mockMessagingAttributes.internalGetSpanKey()).thenReturn(SpanKey.PRODUCER); + when(((SpanKeyProvider) mockDbClientAttributes).internalGetSpanKey()) + .thenReturn(SpanKey.DB_CLIENT); + when(((SpanKeyProvider) mockMessagingProducerAttributes).internalGetSpanKey()) + .thenReturn(SpanKey.PRODUCER); Instrumenter, Map> instrumenter = getInstrumenterWithType( true, new AttributesExtractor2(), - mockMessagingAttributes, - mockNetAttributes, - mockDbAttributes); + mockMessagingProducerAttributes, + mockNetClientAttributes, + mockDbClientAttributes); Map request = new HashMap<>(REQUEST); @@ -720,7 +696,7 @@ void instrumentationTypeDetected_mix() { @Test void instrumentationTypeDetected_generic() { Instrumenter, Map> instrumenter = - getInstrumenterWithType(true, new AttributesExtractor2(), mockNetAttributes); + getInstrumenterWithType(true, new AttributesExtractor2(), mockNetClientAttributes); Map request = new HashMap<>(REQUEST); @@ -808,29 +784,4 @@ private static LinkData expectedSpanLink() { SpanContext.create( LINK_TRACE_ID, LINK_SPAN_ID, TraceFlags.getSampled(), TraceState.getDefault())); } - - private static final class ConstantNetPeerIpGetter - implements NetServerAttributesGetter { - - private final String peerIp; - - private ConstantNetPeerIpGetter(String peerIp) { - this.peerIp = peerIp; - } - - @Override - public String transport(REQUEST request) { - return null; - } - - @Override - public Integer peerPort(REQUEST request) { - return null; - } - - @Override - public String peerIp(REQUEST request) { - return peerIp; - } - } } diff --git a/instrumentation/apache-camel-2.20/javaagent-unit-tests/build.gradle.kts b/instrumentation/apache-camel-2.20/javaagent-unit-tests/build.gradle.kts index 1c9ad19d3209..d73fe01a88c3 100644 --- a/instrumentation/apache-camel-2.20/javaagent-unit-tests/build.gradle.kts +++ b/instrumentation/apache-camel-2.20/javaagent-unit-tests/build.gradle.kts @@ -4,7 +4,7 @@ plugins { dependencies { testImplementation(project(":instrumentation:apache-camel-2.20:javaagent")) - testImplementation(project(":instrumentation-api")) + testImplementation(project(":instrumentation-api-semconv")) testImplementation("org.apache.camel:camel-core:2.20.1") testImplementation("org.apache.camel:camel-aws:2.20.1") diff --git a/instrumentation/couchbase/couchbase-2-common/javaagent-unit-tests/build.gradle.kts b/instrumentation/couchbase/couchbase-2-common/javaagent-unit-tests/build.gradle.kts index fe5cbf9d2dc6..d91fd2027c67 100644 --- a/instrumentation/couchbase/couchbase-2-common/javaagent-unit-tests/build.gradle.kts +++ b/instrumentation/couchbase/couchbase-2-common/javaagent-unit-tests/build.gradle.kts @@ -6,7 +6,7 @@ dependencies { testImplementation("org.apache.groovy:groovy") testImplementation("org.spockframework:spock-core") - testImplementation(project(":instrumentation-api")) + testImplementation(project(":instrumentation-api-semconv")) testImplementation(project(":instrumentation:couchbase:couchbase-2-common:javaagent")) testImplementation("com.couchbase.client:java-client:2.5.0") } diff --git a/instrumentation/jms-1.1/javaagent-unit-tests/build.gradle.kts b/instrumentation/jms-1.1/javaagent-unit-tests/build.gradle.kts index 66c3980dae6b..5113aad9522d 100644 --- a/instrumentation/jms-1.1/javaagent-unit-tests/build.gradle.kts +++ b/instrumentation/jms-1.1/javaagent-unit-tests/build.gradle.kts @@ -6,4 +6,5 @@ dependencies { testImplementation("javax.jms:jms-api:1.1-rev-1") testImplementation(project(":instrumentation:jms-1.1:javaagent")) testImplementation(project(":instrumentation-api")) + testImplementation(project(":instrumentation-api-semconv")) } diff --git a/instrumentation/opentelemetry-api/opentelemetry-api-1.0/javaagent/build.gradle.kts b/instrumentation/opentelemetry-api/opentelemetry-api-1.0/javaagent/build.gradle.kts index d35e9ab3e218..824e420244b5 100644 --- a/instrumentation/opentelemetry-api/opentelemetry-api-1.0/javaagent/build.gradle.kts +++ b/instrumentation/opentelemetry-api/opentelemetry-api-1.0/javaagent/build.gradle.kts @@ -37,7 +37,7 @@ dependencies { // using OpenTelemetry SDK to make sure that instrumentation doesn't cause // OpenTelemetrySdk.getTracerProvider() to throw ClassCastException testImplementation("io.opentelemetry:opentelemetry-sdk") - testImplementation(project(":instrumentation-api")) + testImplementation(project(":instrumentation-api-semconv")) // @WithSpan annotation is used to generate spans in ContextBridgeTest testImplementation("io.opentelemetry:opentelemetry-extension-annotations") diff --git a/javaagent/build.gradle.kts b/javaagent/build.gradle.kts index 3e74a9a5d801..84ecb3713f4c 100644 --- a/javaagent/build.gradle.kts +++ b/javaagent/build.gradle.kts @@ -46,6 +46,7 @@ val licenseReportDependencies by configurations.creating { dependencies { bootstrapLibs(project(":instrumentation-api")) + bootstrapLibs(project(":instrumentation-api-semconv")) bootstrapLibs(project(":instrumentation-api-annotation-support")) bootstrapLibs(project(":instrumentation-appender-api-internal")) bootstrapLibs(project(":javaagent-bootstrap")) @@ -258,6 +259,7 @@ fun CopySpec.isolateClasses(jars: Iterable) { fun ShadowJar.excludeBootstrapJars() { dependencies { exclude(project(":instrumentation-api")) + exclude(project(":instrumentation-api-semconv")) exclude(project(":instrumentation-api-annotation-support")) exclude(project(":instrumentation-appender-api-internal")) exclude(project(":javaagent-bootstrap")) diff --git a/settings.gradle.kts b/settings.gradle.kts index c2466bead626..b9350f181941 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -98,6 +98,7 @@ include(":javaagent") include(":bom-alpha") include(":instrumentation-api") +include(":instrumentation-api-semconv") include(":instrumentation-appender-api-internal") include(":instrumentation-appender-sdk-internal") include(":javaagent-instrumentation-api")