Skip to content

Commit

Permalink
Split out instrumentation-api-semconv (#5721)
Browse files Browse the repository at this point in the history
* Split out instrumentation-api-semconv

* fix tests

* Moved LoggingContextConstants to semconv module too
  • Loading branch information
Mateusz Rzeszutek committed Apr 1, 2022
1 parent da1dc66 commit 5fb2261
Show file tree
Hide file tree
Showing 108 changed files with 128 additions and 147 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
Expand Down
59 changes: 59 additions & 0 deletions instrumentation-api-semconv/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -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<Checkstyle>("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)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@ParametersAreNonnullByDefault
package io.opentelemetry.instrumentation.api;

import javax.annotation.ParametersAreNonnullByDefault;
34 changes: 2 additions & 32 deletions instrumentation-api/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -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")
Expand All @@ -15,50 +13,22 @@ 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")

testImplementation(project(":testing-common"))
testImplementation("io.opentelemetry:opentelemetry-sdk-metrics")
testImplementation("io.opentelemetry:opentelemetry-sdk-testing")

jmhImplementation(project(":instrumentation-api-semconv"))
}

tasks {
named<Checkstyle>("checkstyleMain") {
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<JavaCompile>("jmhCompileGeneratedClasses") {
options.errorprone {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand All @@ -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<REQUEST, RESPONSE> {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -175,10 +171,10 @@ public InstrumenterBuilder<REQUEST, RESPONSE> setDisabled(boolean disabled) {
* <p><strong>When enabled:</strong>.
*
* <ul>
* <li>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.
* <li>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.
* </ul>
*
* <p><strong>When disabled:</strong>
Expand All @@ -192,9 +188,9 @@ public InstrumenterBuilder<REQUEST, RESPONSE> setDisabled(boolean disabled) {
* <ul>
* <li>SERVER nested spans are always suppressed. If a SERVER span is present in the parent
* context object, new SERVER span will not be started.
* <li>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.
* <li>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.
* <li>INTERNAL spans are never suppressed.
* </ul>
*/
Expand Down
Loading

0 comments on commit 5fb2261

Please sign in to comment.