diff --git a/benchmark-integration/jetty-perftest/src/main/java/io/opentelemetry/perftest/Worker.java b/benchmark-integration/jetty-perftest/src/main/java/io/opentelemetry/perftest/Worker.java index 3db94dc80bc4..13352bbaf055 100644 --- a/benchmark-integration/jetty-perftest/src/main/java/io/opentelemetry/perftest/Worker.java +++ b/benchmark-integration/jetty-perftest/src/main/java/io/opentelemetry/perftest/Worker.java @@ -5,7 +5,7 @@ package io.opentelemetry.perftest; -import io.opentelemetry.api.OpenTelemetry; +import io.opentelemetry.api.GlobalOpenTelemetry; import io.opentelemetry.api.trace.Span; import io.opentelemetry.api.trace.Tracer; import io.opentelemetry.context.Scope; @@ -13,7 +13,7 @@ public class Worker { - private static final Tracer tracer = OpenTelemetry.getGlobalTracer("io.opentelemetry.auto"); + private static final Tracer tracer = GlobalOpenTelemetry.getTracer("io.opentelemetry.auto"); /** Simulate work for the give number of milliseconds. */ public static void doWork(long workTimeMillis) { diff --git a/benchmark-integration/jetty-perftest/src/main/java/io/opentelemetry/perftest/jetty/JettyPerftest.java b/benchmark-integration/jetty-perftest/src/main/java/io/opentelemetry/perftest/jetty/JettyPerftest.java index 5fe320b43e6c..1a5602b0a78b 100644 --- a/benchmark-integration/jetty-perftest/src/main/java/io/opentelemetry/perftest/jetty/JettyPerftest.java +++ b/benchmark-integration/jetty-perftest/src/main/java/io/opentelemetry/perftest/jetty/JettyPerftest.java @@ -5,7 +5,7 @@ package io.opentelemetry.perftest.jetty; -import io.opentelemetry.api.OpenTelemetry; +import io.opentelemetry.api.GlobalOpenTelemetry; import io.opentelemetry.api.trace.Span; import io.opentelemetry.api.trace.Tracer; import io.opentelemetry.context.Scope; @@ -25,7 +25,7 @@ public class JettyPerftest { private static final Server jettyServer = new Server(PORT); private static final ServletContextHandler servletContext = new ServletContextHandler(); - private static final Tracer tracer = OpenTelemetry.getGlobalTracer("io.opentelemetry.auto"); + private static final Tracer tracer = GlobalOpenTelemetry.getTracer("io.opentelemetry.auto"); public static void main(String[] args) throws Exception { servletContext.addServlet(PerfServlet.class, PATH); diff --git a/benchmark/src/jmh/java/io/opentelemetry/benchmark/classes/TracedClass.java b/benchmark/src/jmh/java/io/opentelemetry/benchmark/classes/TracedClass.java index 2a7b0c49fd48..b5f1d28e34c9 100644 --- a/benchmark/src/jmh/java/io/opentelemetry/benchmark/classes/TracedClass.java +++ b/benchmark/src/jmh/java/io/opentelemetry/benchmark/classes/TracedClass.java @@ -5,11 +5,11 @@ package io.opentelemetry.benchmark.classes; -import io.opentelemetry.api.OpenTelemetry; +import io.opentelemetry.api.GlobalOpenTelemetry; import io.opentelemetry.api.trace.Tracer; public class TracedClass extends UntracedClass { - private static final Tracer tracer = OpenTelemetry.getGlobalTracer("io.opentelemetry.auto"); + private static final Tracer tracer = GlobalOpenTelemetry.getTracer("io.opentelemetry.auto"); @Override public void f() { diff --git a/gradle/dependencies.gradle b/gradle/dependencies.gradle index 5177575f1837..67f4488dd0d5 100644 --- a/gradle/dependencies.gradle +++ b/gradle/dependencies.gradle @@ -8,8 +8,8 @@ configurations.all { ext { versions = [ - opentelemetry : '0.13.1', - opentelemetryAlpha: "0.13.1-alpha", + opentelemetry : '0.14.1', + opentelemetryAlpha: "0.14.1-alpha", slf4j : "1.7.30", guava : "20.0", // Last version to support Java 7 @@ -35,6 +35,7 @@ ext { deps = [ // OpenTelemetry opentelemetryApi : dependencies.create(group: 'io.opentelemetry', name: 'opentelemetry-api', version: versions.opentelemetry), + opentelemetryApiMetrics : dependencies.create(group: 'io.opentelemetry', name: 'opentelemetry-api-metrics', version: versions.opentelemetryAlpha), opentelemetryExtAnnotations: dependencies.create(group: 'io.opentelemetry', name: 'opentelemetry-extension-annotations', version: versions.opentelemetry), opentelemetryContext : dependencies.create(group: 'io.opentelemetry', name: 'opentelemetry-context', version: versions.opentelemetry), opentelemetryKotlin : dependencies.create(group: 'io.opentelemetry', name: 'opentelemetry-extension-kotlin', version: versions.opentelemetry), @@ -46,11 +47,12 @@ ext { opentelemetryOtlp : dependencies.create(group: 'io.opentelemetry', name: 'opentelemetry-exporter-otlp', version: versions.opentelemetry), opentelemetryOtlpMetrics : dependencies.create(group: 'io.opentelemetry', name: 'opentelemetry-exporter-otlp-metrics', version: versions.opentelemetryAlpha), opentelemetryZipkin : dependencies.create(group: 'io.opentelemetry', name: 'opentelemetry-exporter-zipkin', version: versions.opentelemetry), - opentelemetryPrometheus : dependencies.create(group: 'io.opentelemetry', name: 'opentelemetry-exporter-prometheus', version: versions.opentelemetry), + opentelemetryPrometheus : dependencies.create(group: 'io.opentelemetry', name: 'opentelemetry-exporter-prometheus', version: versions.opentelemetryAlpha), opentelemetryLogging : dependencies.create(group: 'io.opentelemetry', name: 'opentelemetry-exporter-logging', version: versions.opentelemetry), opentelemetryProto : dependencies.create(group: 'io.opentelemetry', name: 'opentelemetry-proto', version: versions.opentelemetry), opentelemetryResources : dependencies.create(group: 'io.opentelemetry', name: 'opentelemetry-sdk-extension-resources', version: versions.opentelemetry), opentelemetrySdkTesting : dependencies.create(group: 'io.opentelemetry', name: 'opentelemetry-sdk-testing', version: versions.opentelemetry), + opentelemetrySemConv : dependencies.create(group: 'io.opentelemetry', name: 'opentelemetry-semconv', version: versions.opentelemetry), // General slf4j : "org.slf4j:slf4j-api:${versions.slf4j}", diff --git a/gradle/instrumentation.gradle b/gradle/instrumentation.gradle index aa9b1e12dcda..15eb63ca30ed 100644 --- a/gradle/instrumentation.gradle +++ b/gradle/instrumentation.gradle @@ -75,6 +75,7 @@ shadowJar { // relocate OpenTelemetry API usage relocate "io.opentelemetry.api", "io.opentelemetry.javaagent.shaded.io.opentelemetry.api" + relocate "io.opentelemetry.semconv", "io.opentelemetry.javaagent.shaded.io.opentelemetry.semconv" relocate "io.opentelemetry.spi", "io.opentelemetry.javaagent.shaded.io.opentelemetry.spi" relocate "io.opentelemetry.context", "io.opentelemetry.javaagent.shaded.io.opentelemetry.context" diff --git a/instrumentation-api/instrumentation-api.gradle b/instrumentation-api/instrumentation-api.gradle index f7c27d1a60a3..db1b3ca94594 100644 --- a/instrumentation-api/instrumentation-api.gradle +++ b/instrumentation-api/instrumentation-api.gradle @@ -6,6 +6,7 @@ apply from: "$rootDir/gradle/publish.gradle" dependencies { api deps.opentelemetryApi api deps.opentelemetryContext + api deps.opentelemetrySemConv implementation deps.slf4j compileOnly deps.autoValueAnnotations diff --git a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/tracer/BaseTracer.java b/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/tracer/BaseTracer.java index c4afa2e7ac8d..39639b624e60 100644 --- a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/tracer/BaseTracer.java +++ b/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/tracer/BaseTracer.java @@ -5,9 +5,7 @@ package io.opentelemetry.instrumentation.api.tracer; -import static io.opentelemetry.api.OpenTelemetry.getGlobalPropagators; - -import io.opentelemetry.api.OpenTelemetry; +import io.opentelemetry.api.GlobalOpenTelemetry; import io.opentelemetry.api.trace.Span; import io.opentelemetry.api.trace.Span.Kind; import io.opentelemetry.api.trace.StatusCode; @@ -46,7 +44,7 @@ public abstract class BaseTracer { protected final Tracer tracer; public BaseTracer() { - tracer = OpenTelemetry.getGlobalTracer(getInstrumentationName(), getVersion()); + tracer = GlobalOpenTelemetry.getTracer(getInstrumentationName(), getVersion()); } public BaseTracer(Tracer tracer) { @@ -173,7 +171,9 @@ public static Context extract(C carrier, TextMapPropagator.Getter getter) // Using Context.ROOT here may be quite unexpected, but the reason is simple. // We want either span context extracted from the carrier or invalid one. // We DO NOT want any span context potentially lingering in the current context. - return getGlobalPropagators().getTextMapPropagator().extract(Context.root(), carrier, getter); + return GlobalOpenTelemetry.getPropagators() + .getTextMapPropagator() + .extract(Context.root(), carrier, getter); } private static void debugContextLeak() { diff --git a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/tracer/DatabaseClientTracer.java b/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/tracer/DatabaseClientTracer.java index ef79b2de0a24..a290f035174d 100644 --- a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/tracer/DatabaseClientTracer.java +++ b/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/tracer/DatabaseClientTracer.java @@ -7,13 +7,13 @@ import static io.opentelemetry.api.trace.Span.Kind.CLIENT; -import io.opentelemetry.api.OpenTelemetry; +import io.opentelemetry.api.GlobalOpenTelemetry; import io.opentelemetry.api.trace.Span; import io.opentelemetry.api.trace.StatusCode; import io.opentelemetry.api.trace.Tracer; -import io.opentelemetry.api.trace.attributes.SemanticAttributes; import io.opentelemetry.context.Context; import io.opentelemetry.instrumentation.api.tracer.utils.NetPeerUtils; +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes; import java.net.InetSocketAddress; import java.util.concurrent.ExecutionException; @@ -24,7 +24,7 @@ public abstract class DatabaseClientTracer extends BaseTracer protected final Tracer tracer; public DatabaseClientTracer() { - tracer = OpenTelemetry.getGlobalTracer(getInstrumentationName(), getVersion()); + tracer = GlobalOpenTelemetry.getTracer(getInstrumentationName(), getVersion()); } public boolean shouldStartSpan(Context parentContext) { diff --git a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/tracer/HttpClientTracer.java b/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/tracer/HttpClientTracer.java index e33953f6fdf8..896a22045066 100644 --- a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/tracer/HttpClientTracer.java +++ b/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/tracer/HttpClientTracer.java @@ -5,16 +5,16 @@ package io.opentelemetry.instrumentation.api.tracer; -import io.opentelemetry.api.OpenTelemetry; +import io.opentelemetry.api.GlobalOpenTelemetry; import io.opentelemetry.api.trace.Span; import io.opentelemetry.api.trace.Span.Kind; import io.opentelemetry.api.trace.SpanBuilder; import io.opentelemetry.api.trace.Tracer; -import io.opentelemetry.api.trace.attributes.SemanticAttributes; import io.opentelemetry.context.Context; import io.opentelemetry.context.propagation.TextMapPropagator; import io.opentelemetry.context.propagation.TextMapPropagator.Setter; import io.opentelemetry.instrumentation.api.tracer.utils.NetPeerUtils; +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes; import java.net.URI; import java.net.URISyntaxException; import java.util.concurrent.TimeUnit; @@ -82,7 +82,7 @@ private void inject(Context context, CARRIER carrier) { throw new IllegalStateException( "getSetter() not defined but calling startScope(), either getSetter must be implemented or the scope should be setup manually"); } - OpenTelemetry.getGlobalPropagators().getTextMapPropagator().inject(context, carrier, setter); + GlobalOpenTelemetry.getPropagators().getTextMapPropagator().inject(context, carrier, setter); } public void end(Context context, RESPONSE response) { diff --git a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/tracer/HttpServerTracer.java b/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/tracer/HttpServerTracer.java index 38aca6db4686..266152eb1b70 100644 --- a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/tracer/HttpServerTracer.java +++ b/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/tracer/HttpServerTracer.java @@ -10,9 +10,9 @@ import io.opentelemetry.api.trace.Span; import io.opentelemetry.api.trace.SpanBuilder; import io.opentelemetry.api.trace.Tracer; -import io.opentelemetry.api.trace.attributes.SemanticAttributes; import io.opentelemetry.context.Context; import io.opentelemetry.context.propagation.TextMapPropagator; +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes; import java.lang.reflect.Method; import java.util.concurrent.TimeUnit; import org.checkerframework.checker.nullness.qual.Nullable; diff --git a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/tracer/utils/NetPeerUtils.java b/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/tracer/utils/NetPeerUtils.java index b8dc5d5a2d76..1860b899be65 100644 --- a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/tracer/utils/NetPeerUtils.java +++ b/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/tracer/utils/NetPeerUtils.java @@ -8,8 +8,8 @@ import io.opentelemetry.api.common.AttributeKey; import io.opentelemetry.api.trace.Span; import io.opentelemetry.api.trace.SpanBuilder; -import io.opentelemetry.api.trace.attributes.SemanticAttributes; import io.opentelemetry.instrumentation.api.config.Config; +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes; import java.net.InetAddress; import java.net.InetSocketAddress; import java.util.Collections; diff --git a/instrumentation-api/src/test/groovy/io/opentelemetry/instrumentation/api/tracer/HttpClientTracerTest.groovy b/instrumentation-api/src/test/groovy/io/opentelemetry/instrumentation/api/tracer/HttpClientTracerTest.groovy index 765520bf32a8..aad7386d5822 100644 --- a/instrumentation-api/src/test/groovy/io/opentelemetry/instrumentation/api/tracer/HttpClientTracerTest.groovy +++ b/instrumentation-api/src/test/groovy/io/opentelemetry/instrumentation/api/tracer/HttpClientTracerTest.groovy @@ -6,7 +6,7 @@ package io.opentelemetry.instrumentation.api.tracer import io.opentelemetry.api.trace.Span -import io.opentelemetry.api.trace.attributes.SemanticAttributes +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes import io.opentelemetry.context.propagation.TextMapPropagator import io.opentelemetry.instrumentation.api.config.Config import io.opentelemetry.instrumentation.api.config.ConfigBuilder diff --git a/instrumentation-api/src/test/groovy/io/opentelemetry/instrumentation/api/tracer/utils/NetPeerUtilsTest.groovy b/instrumentation-api/src/test/groovy/io/opentelemetry/instrumentation/api/tracer/utils/NetPeerUtilsTest.groovy index f27c6d8a1b65..dfbc9a2c8848 100644 --- a/instrumentation-api/src/test/groovy/io/opentelemetry/instrumentation/api/tracer/utils/NetPeerUtilsTest.groovy +++ b/instrumentation-api/src/test/groovy/io/opentelemetry/instrumentation/api/tracer/utils/NetPeerUtilsTest.groovy @@ -5,7 +5,7 @@ package io.opentelemetry.instrumentation.api.tracer.utils -import io.opentelemetry.api.trace.attributes.SemanticAttributes +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes import io.opentelemetry.instrumentation.api.config.Config import io.opentelemetry.instrumentation.api.config.ConfigBuilder import io.opentelemetry.instrumentation.api.tracer.BaseTracerTest diff --git a/instrumentation-core/reactor-3.1/src/test/groovy/io/opentelemetry/instrumentation/reactor/ReactorCoreTest.groovy b/instrumentation-core/reactor-3.1/src/test/groovy/io/opentelemetry/instrumentation/reactor/ReactorCoreTest.groovy index 531b53311e3e..dc367c4d7df2 100644 --- a/instrumentation-core/reactor-3.1/src/test/groovy/io/opentelemetry/instrumentation/reactor/ReactorCoreTest.groovy +++ b/instrumentation-core/reactor-3.1/src/test/groovy/io/opentelemetry/instrumentation/reactor/ReactorCoreTest.groovy @@ -7,6 +7,7 @@ package io.opentelemetry.instrumentation.reactor import static io.opentelemetry.instrumentation.test.utils.TraceUtils.basicSpan +import io.opentelemetry.api.GlobalOpenTelemetry import io.opentelemetry.api.OpenTelemetry import io.opentelemetry.api.trace.Tracer import io.opentelemetry.context.Context @@ -25,7 +26,7 @@ class ReactorCoreTest extends InstrumentationTestRunner { public static final String EXCEPTION_MESSAGE = "test exception" private static final Tracer testTracer = - OpenTelemetry.getGlobalTracer("io.opentelemetry.auto.reactor") + GlobalOpenTelemetry.getTracer("io.opentelemetry.auto.reactor") def setupSpec() { TracingOperator.registerOnEachOperator() @@ -234,7 +235,7 @@ class ReactorCoreTest extends InstrumentationTestRunner { // The "add one" operations in the publisher created here should be children of the publisher-parent Publisher publisher = publisherSupplier() - def tracer = OpenTelemetry.getGlobalTracer("test") + def tracer = GlobalOpenTelemetry.getTracer("test") def intermediate = tracer.spanBuilder("intermediate").startSpan() // After this activation, the "add two" operations below should be children of this span def scope = Context.current().with(intermediate).makeCurrent() @@ -273,7 +274,7 @@ class ReactorCoreTest extends InstrumentationTestRunner { def runUnderTrace(def publisherSupplier) { TraceUtils.runUnderTrace("trace-parent") { - def tracer = OpenTelemetry.getGlobalTracer("test") + def tracer = GlobalOpenTelemetry.getTracer("test") def span = tracer.spanBuilder("publisher-parent").startSpan() def scope = Context.current().with(span).makeCurrent() try { @@ -295,7 +296,7 @@ class ReactorCoreTest extends InstrumentationTestRunner { def cancelUnderTrace(def publisherSupplier) { TraceUtils.runUnderTrace("trace-parent") { - def tracer = OpenTelemetry.getGlobalTracer("test") + def tracer = GlobalOpenTelemetry.getTracer("test") def span = tracer.spanBuilder("publisher-parent").startSpan() def scope = Context.current().with(span).makeCurrent() diff --git a/instrumentation-core/servlet-2.2/src/main/java/io/opentelemetry/instrumentation/servlet/ServletHttpServerTracer.java b/instrumentation-core/servlet-2.2/src/main/java/io/opentelemetry/instrumentation/servlet/ServletHttpServerTracer.java index e1c441bcce95..94df7011b137 100644 --- a/instrumentation-core/servlet-2.2/src/main/java/io/opentelemetry/instrumentation/servlet/ServletHttpServerTracer.java +++ b/instrumentation-core/servlet-2.2/src/main/java/io/opentelemetry/instrumentation/servlet/ServletHttpServerTracer.java @@ -6,12 +6,12 @@ package io.opentelemetry.instrumentation.servlet; import io.opentelemetry.api.trace.Span; -import io.opentelemetry.api.trace.attributes.SemanticAttributes; import io.opentelemetry.context.Context; import io.opentelemetry.context.propagation.TextMapPropagator.Getter; import io.opentelemetry.instrumentation.api.servlet.AppServerBridge; import io.opentelemetry.instrumentation.api.servlet.ServletContextPath; import io.opentelemetry.instrumentation.api.tracer.HttpServerTracer; +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes; import java.net.URI; import java.net.URISyntaxException; import java.security.Principal; diff --git a/instrumentation/akka-actor-2.5/javaagent/src/test/scala/AkkaAsyncChild.java b/instrumentation/akka-actor-2.5/javaagent/src/test/scala/AkkaAsyncChild.java index 33098dd58e96..f4b1a507ad39 100644 --- a/instrumentation/akka-actor-2.5/javaagent/src/test/scala/AkkaAsyncChild.java +++ b/instrumentation/akka-actor-2.5/javaagent/src/test/scala/AkkaAsyncChild.java @@ -4,14 +4,14 @@ */ import akka.dispatch.forkjoin.ForkJoinTask; -import io.opentelemetry.api.OpenTelemetry; +import io.opentelemetry.api.GlobalOpenTelemetry; import io.opentelemetry.api.trace.Tracer; import java.util.concurrent.Callable; import java.util.concurrent.CountDownLatch; import java.util.concurrent.atomic.AtomicBoolean; public class AkkaAsyncChild extends ForkJoinTask implements Runnable, Callable { - private static final Tracer tracer = OpenTelemetry.getGlobalTracer("io.opentelemetry.auto"); + private static final Tracer tracer = GlobalOpenTelemetry.getTracer("io.opentelemetry.auto"); private final AtomicBoolean blockThread; private final boolean doTraceableWork; diff --git a/instrumentation/apache-camel-2.20/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachecamel/CamelPropagationUtil.java b/instrumentation/apache-camel-2.20/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachecamel/CamelPropagationUtil.java index a65c553ddec5..77e58675b251 100644 --- a/instrumentation/apache-camel-2.20/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachecamel/CamelPropagationUtil.java +++ b/instrumentation/apache-camel-2.20/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachecamel/CamelPropagationUtil.java @@ -5,7 +5,7 @@ package io.opentelemetry.javaagent.instrumentation.apachecamel; -import io.opentelemetry.api.OpenTelemetry; +import io.opentelemetry.api.GlobalOpenTelemetry; import io.opentelemetry.context.Context; import io.opentelemetry.context.propagation.TextMapPropagator.Getter; import io.opentelemetry.context.propagation.TextMapPropagator.Setter; @@ -16,13 +16,13 @@ final class CamelPropagationUtil { private CamelPropagationUtil() {} static Context extractParent(final Map exchangeHeaders) { - return OpenTelemetry.getGlobalPropagators() + return GlobalOpenTelemetry.getPropagators() .getTextMapPropagator() .extract(Context.current(), exchangeHeaders, MapGetter.INSTANCE); } static void injectParent(Context context, final Map exchangeHeaders) { - OpenTelemetry.getGlobalPropagators() + GlobalOpenTelemetry.getPropagators() .getTextMapPropagator() .inject(context, exchangeHeaders, MapSetter.INSTANCE); } diff --git a/instrumentation/apache-camel-2.20/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachecamel/decorators/DbSpanDecorator.java b/instrumentation/apache-camel-2.20/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachecamel/decorators/DbSpanDecorator.java index 51c4a5a23f4d..cf43f5caf67e 100644 --- a/instrumentation/apache-camel-2.20/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachecamel/decorators/DbSpanDecorator.java +++ b/instrumentation/apache-camel-2.20/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachecamel/decorators/DbSpanDecorator.java @@ -24,8 +24,8 @@ package io.opentelemetry.javaagent.instrumentation.apachecamel.decorators; import io.opentelemetry.api.trace.Span; -import io.opentelemetry.api.trace.attributes.SemanticAttributes; import io.opentelemetry.javaagent.instrumentation.apachecamel.CamelDirection; +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes; import java.net.URI; import java.util.Map; import org.apache.camel.Endpoint; diff --git a/instrumentation/apache-camel-2.20/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachecamel/decorators/DecoratorRegistry.java b/instrumentation/apache-camel-2.20/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachecamel/decorators/DecoratorRegistry.java index 5f7b0cf44e1d..7774594713f2 100644 --- a/instrumentation/apache-camel-2.20/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachecamel/decorators/DecoratorRegistry.java +++ b/instrumentation/apache-camel-2.20/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachecamel/decorators/DecoratorRegistry.java @@ -5,8 +5,8 @@ package io.opentelemetry.javaagent.instrumentation.apachecamel.decorators; -import io.opentelemetry.api.trace.attributes.SemanticAttributes.DbSystemValues; import io.opentelemetry.javaagent.instrumentation.apachecamel.SpanDecorator; +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes.DbSystemValues; import java.util.HashMap; import java.util.Map; diff --git a/instrumentation/apache-camel-2.20/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachecamel/decorators/HttpSpanDecorator.java b/instrumentation/apache-camel-2.20/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachecamel/decorators/HttpSpanDecorator.java index 58cd91ba149b..10f08d44368b 100644 --- a/instrumentation/apache-camel-2.20/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachecamel/decorators/HttpSpanDecorator.java +++ b/instrumentation/apache-camel-2.20/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachecamel/decorators/HttpSpanDecorator.java @@ -24,10 +24,10 @@ package io.opentelemetry.javaagent.instrumentation.apachecamel.decorators; import io.opentelemetry.api.trace.Span; -import io.opentelemetry.api.trace.attributes.SemanticAttributes; import io.opentelemetry.context.Context; import io.opentelemetry.instrumentation.api.tracer.BaseTracer; import io.opentelemetry.javaagent.instrumentation.apachecamel.CamelDirection; +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes; import java.net.MalformedURLException; import java.net.URL; import org.apache.camel.Endpoint; diff --git a/instrumentation/apache-camel-2.20/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachecamel/decorators/KafkaSpanDecorator.java b/instrumentation/apache-camel-2.20/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachecamel/decorators/KafkaSpanDecorator.java index 7a4ef59c2199..159a00d565cb 100644 --- a/instrumentation/apache-camel-2.20/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachecamel/decorators/KafkaSpanDecorator.java +++ b/instrumentation/apache-camel-2.20/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachecamel/decorators/KafkaSpanDecorator.java @@ -24,8 +24,8 @@ package io.opentelemetry.javaagent.instrumentation.apachecamel.decorators; import io.opentelemetry.api.trace.Span; -import io.opentelemetry.api.trace.attributes.SemanticAttributes; import io.opentelemetry.javaagent.instrumentation.apachecamel.CamelDirection; +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes; import java.util.Map; import org.apache.camel.Endpoint; import org.apache.camel.Exchange; diff --git a/instrumentation/apache-camel-2.20/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachecamel/decorators/MessagingSpanDecorator.java b/instrumentation/apache-camel-2.20/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachecamel/decorators/MessagingSpanDecorator.java index e13fa578c004..45da1e540489 100644 --- a/instrumentation/apache-camel-2.20/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachecamel/decorators/MessagingSpanDecorator.java +++ b/instrumentation/apache-camel-2.20/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachecamel/decorators/MessagingSpanDecorator.java @@ -25,8 +25,8 @@ import io.opentelemetry.api.trace.Span; import io.opentelemetry.api.trace.Span.Kind; -import io.opentelemetry.api.trace.attributes.SemanticAttributes; import io.opentelemetry.javaagent.instrumentation.apachecamel.CamelDirection; +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes; import java.net.URI; import java.util.Map; import org.apache.camel.Endpoint; diff --git a/instrumentation/apache-camel-2.20/javaagent/src/test/groovy/test/RestCamelTest.groovy b/instrumentation/apache-camel-2.20/javaagent/src/test/groovy/test/RestCamelTest.groovy index 8b9f9dff89f6..95a616a20eac 100644 --- a/instrumentation/apache-camel-2.20/javaagent/src/test/groovy/test/RestCamelTest.groovy +++ b/instrumentation/apache-camel-2.20/javaagent/src/test/groovy/test/RestCamelTest.groovy @@ -10,7 +10,7 @@ import static io.opentelemetry.api.trace.Span.Kind.INTERNAL import static io.opentelemetry.api.trace.Span.Kind.SERVER import com.google.common.collect.ImmutableMap -import io.opentelemetry.api.trace.attributes.SemanticAttributes +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes import io.opentelemetry.instrumentation.test.AgentTestRunner import io.opentelemetry.instrumentation.test.utils.PortUtils import org.apache.camel.CamelContext diff --git a/instrumentation/apache-camel-2.20/javaagent/src/test/groovy/test/SingleServiceCamelTest.groovy b/instrumentation/apache-camel-2.20/javaagent/src/test/groovy/test/SingleServiceCamelTest.groovy index ef66488df310..68cf18857d48 100644 --- a/instrumentation/apache-camel-2.20/javaagent/src/test/groovy/test/SingleServiceCamelTest.groovy +++ b/instrumentation/apache-camel-2.20/javaagent/src/test/groovy/test/SingleServiceCamelTest.groovy @@ -8,7 +8,7 @@ package test import static io.opentelemetry.api.trace.Span.Kind.SERVER import com.google.common.collect.ImmutableMap -import io.opentelemetry.api.trace.attributes.SemanticAttributes +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes import io.opentelemetry.instrumentation.test.AgentTestRunner import io.opentelemetry.instrumentation.test.utils.OkHttpUtils import io.opentelemetry.instrumentation.test.utils.PortUtils diff --git a/instrumentation/apache-camel-2.20/javaagent/src/test/groovy/test/TwoServicesWithDirectClientCamelTest.groovy b/instrumentation/apache-camel-2.20/javaagent/src/test/groovy/test/TwoServicesWithDirectClientCamelTest.groovy index a699b442a4bf..b3357aef3c4f 100644 --- a/instrumentation/apache-camel-2.20/javaagent/src/test/groovy/test/TwoServicesWithDirectClientCamelTest.groovy +++ b/instrumentation/apache-camel-2.20/javaagent/src/test/groovy/test/TwoServicesWithDirectClientCamelTest.groovy @@ -10,7 +10,7 @@ import static io.opentelemetry.api.trace.Span.Kind.INTERNAL import static io.opentelemetry.api.trace.Span.Kind.SERVER import com.google.common.collect.ImmutableMap -import io.opentelemetry.api.trace.attributes.SemanticAttributes +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes import io.opentelemetry.instrumentation.test.AgentTestRunner import io.opentelemetry.instrumentation.test.utils.PortUtils import org.apache.camel.CamelContext diff --git a/instrumentation/apache-httpasyncclient-4.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachehttpasyncclient/ApacheHttpAsyncClientInstrumentation.java b/instrumentation/apache-httpasyncclient-4.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachehttpasyncclient/ApacheHttpAsyncClientInstrumentation.java index 86334ea1ba1e..5e9b30e58c8c 100644 --- a/instrumentation/apache-httpasyncclient-4.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachehttpasyncclient/ApacheHttpAsyncClientInstrumentation.java +++ b/instrumentation/apache-httpasyncclient-4.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachehttpasyncclient/ApacheHttpAsyncClientInstrumentation.java @@ -15,7 +15,7 @@ import static net.bytebuddy.matcher.ElementMatchers.takesArgument; import static net.bytebuddy.matcher.ElementMatchers.takesArguments; -import io.opentelemetry.api.OpenTelemetry; +import io.opentelemetry.api.GlobalOpenTelemetry; import io.opentelemetry.api.trace.Span; import io.opentelemetry.context.Context; import io.opentelemetry.context.Scope; @@ -111,7 +111,7 @@ public HttpHost getTarget() { @Override public HttpRequest generateRequest() throws IOException, HttpException { HttpRequest request = delegate.generateRequest(); - OpenTelemetry.getGlobalPropagators() + GlobalOpenTelemetry.getPropagators() .getTextMapPropagator() .inject(context, request, tracer().getSetter()); Span span = Span.fromContext(context); diff --git a/instrumentation/armeria-1.3/testing/src/main/groovy/io/opentelemetry/instrumentation/armeria/v1_3/AbstractArmeriaTest.groovy b/instrumentation/armeria-1.3/testing/src/main/groovy/io/opentelemetry/instrumentation/armeria/v1_3/AbstractArmeriaTest.groovy index 4416dd423f0a..cf2be1c61ea7 100644 --- a/instrumentation/armeria-1.3/testing/src/main/groovy/io/opentelemetry/instrumentation/armeria/v1_3/AbstractArmeriaTest.groovy +++ b/instrumentation/armeria-1.3/testing/src/main/groovy/io/opentelemetry/instrumentation/armeria/v1_3/AbstractArmeriaTest.groovy @@ -20,7 +20,7 @@ import com.linecorp.armeria.server.ServerBuilder import com.linecorp.armeria.server.ServiceRequestContext import com.linecorp.armeria.testing.junit4.server.ServerRule import io.opentelemetry.api.trace.Span -import io.opentelemetry.api.trace.attributes.SemanticAttributes +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes import io.opentelemetry.instrumentation.test.InstrumentationSpecification import java.util.function.Function import spock.lang.Shared diff --git a/instrumentation/aws-lambda-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/awslambda/v1_0/AwsLambdaInstrumentationModule.java b/instrumentation/aws-lambda-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/awslambda/v1_0/AwsLambdaInstrumentationModule.java index 460563accfe0..0773ae15da12 100644 --- a/instrumentation/aws-lambda-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/awslambda/v1_0/AwsLambdaInstrumentationModule.java +++ b/instrumentation/aws-lambda-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/awslambda/v1_0/AwsLambdaInstrumentationModule.java @@ -20,7 +20,7 @@ public AwsLambdaInstrumentationModule() { @Override public String[] additionalHelperClassNames() { - return new String[] {"io.opentelemetry.extension.trace.propagation.AwsXRayPropagator"}; + return new String[] {"io.opentelemetry.extension.trace.propagation.AwsXrayPropagator"}; } @Override diff --git a/instrumentation/aws-lambda-1.0/library/src/main/java/io/opentelemetry/instrumentation/awslambda/v1_0/ApiGatewayProxyRequest.java b/instrumentation/aws-lambda-1.0/library/src/main/java/io/opentelemetry/instrumentation/awslambda/v1_0/ApiGatewayProxyRequest.java index 5b6bc6e2956a..45553c252e2f 100644 --- a/instrumentation/aws-lambda-1.0/library/src/main/java/io/opentelemetry/instrumentation/awslambda/v1_0/ApiGatewayProxyRequest.java +++ b/instrumentation/aws-lambda-1.0/library/src/main/java/io/opentelemetry/instrumentation/awslambda/v1_0/ApiGatewayProxyRequest.java @@ -7,7 +7,7 @@ import static io.opentelemetry.instrumentation.awslambda.v1_0.HeadersFactory.ofStream; -import io.opentelemetry.api.OpenTelemetry; +import io.opentelemetry.api.GlobalOpenTelemetry; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; @@ -24,7 +24,7 @@ abstract class ApiGatewayProxyRequest { // for every request. private static boolean noHttpPropagationNeeded() { Collection fields = - OpenTelemetry.getGlobalPropagators().getTextMapPropagator().fields(); + GlobalOpenTelemetry.getPropagators().getTextMapPropagator().fields(); return fields.isEmpty() || xrayPropagationFieldsOnly(fields); } diff --git a/instrumentation/aws-lambda-1.0/library/src/main/java/io/opentelemetry/instrumentation/awslambda/v1_0/AwsLambdaMessageTracer.java b/instrumentation/aws-lambda-1.0/library/src/main/java/io/opentelemetry/instrumentation/awslambda/v1_0/AwsLambdaMessageTracer.java index 997e3b8deae7..fd1550d2da89 100644 --- a/instrumentation/aws-lambda-1.0/library/src/main/java/io/opentelemetry/instrumentation/awslambda/v1_0/AwsLambdaMessageTracer.java +++ b/instrumentation/aws-lambda-1.0/library/src/main/java/io/opentelemetry/instrumentation/awslambda/v1_0/AwsLambdaMessageTracer.java @@ -12,9 +12,9 @@ import io.opentelemetry.api.trace.SpanBuilder; import io.opentelemetry.api.trace.SpanContext; import io.opentelemetry.api.trace.Tracer; -import io.opentelemetry.api.trace.attributes.SemanticAttributes; import io.opentelemetry.context.Scope; import io.opentelemetry.instrumentation.api.tracer.BaseTracer; +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes; public class AwsLambdaMessageTracer extends BaseTracer { diff --git a/instrumentation/aws-lambda-1.0/library/src/main/java/io/opentelemetry/instrumentation/awslambda/v1_0/AwsLambdaTracer.java b/instrumentation/aws-lambda-1.0/library/src/main/java/io/opentelemetry/instrumentation/awslambda/v1_0/AwsLambdaTracer.java index 02e961172f0c..24be18f8bdd3 100644 --- a/instrumentation/aws-lambda-1.0/library/src/main/java/io/opentelemetry/instrumentation/awslambda/v1_0/AwsLambdaTracer.java +++ b/instrumentation/aws-lambda-1.0/library/src/main/java/io/opentelemetry/instrumentation/awslambda/v1_0/AwsLambdaTracer.java @@ -5,10 +5,10 @@ package io.opentelemetry.instrumentation.awslambda.v1_0; -import static io.opentelemetry.api.trace.attributes.SemanticAttributes.CLOUD_ACCOUNT_ID; -import static io.opentelemetry.api.trace.attributes.SemanticAttributes.FAAS_EXECUTION; -import static io.opentelemetry.api.trace.attributes.SemanticAttributes.FAAS_ID; -import static io.opentelemetry.api.trace.attributes.SemanticAttributes.FAAS_TRIGGER; +import static io.opentelemetry.semconv.trace.attributes.SemanticAttributes.CLOUD_ACCOUNT_ID; +import static io.opentelemetry.semconv.trace.attributes.SemanticAttributes.FAAS_EXECUTION; +import static io.opentelemetry.semconv.trace.attributes.SemanticAttributes.FAAS_ID; +import static io.opentelemetry.semconv.trace.attributes.SemanticAttributes.FAAS_TRIGGER; import com.amazonaws.services.lambda.runtime.Context; import com.amazonaws.services.lambda.runtime.events.APIGatewayProxyRequestEvent; @@ -18,9 +18,9 @@ import io.opentelemetry.api.trace.SpanBuilder; import io.opentelemetry.api.trace.SpanContext; import io.opentelemetry.api.trace.Tracer; -import io.opentelemetry.api.trace.attributes.SemanticAttributes.FaasTriggerValues; import io.opentelemetry.context.Scope; import io.opentelemetry.instrumentation.api.tracer.BaseTracer; +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes.FaasTriggerValues; import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodHandles; import java.lang.invoke.MethodType; diff --git a/instrumentation/aws-lambda-1.0/library/src/main/java/io/opentelemetry/instrumentation/awslambda/v1_0/HttpSpanAttributes.java b/instrumentation/aws-lambda-1.0/library/src/main/java/io/opentelemetry/instrumentation/awslambda/v1_0/HttpSpanAttributes.java index a0f7cda8585b..2bfa0765929c 100644 --- a/instrumentation/aws-lambda-1.0/library/src/main/java/io/opentelemetry/instrumentation/awslambda/v1_0/HttpSpanAttributes.java +++ b/instrumentation/aws-lambda-1.0/library/src/main/java/io/opentelemetry/instrumentation/awslambda/v1_0/HttpSpanAttributes.java @@ -5,12 +5,12 @@ package io.opentelemetry.instrumentation.awslambda.v1_0; -import static io.opentelemetry.api.trace.attributes.SemanticAttributes.HTTP_METHOD; -import static io.opentelemetry.api.trace.attributes.SemanticAttributes.HTTP_STATUS_CODE; -import static io.opentelemetry.api.trace.attributes.SemanticAttributes.HTTP_URL; -import static io.opentelemetry.api.trace.attributes.SemanticAttributes.HTTP_USER_AGENT; import static io.opentelemetry.instrumentation.awslambda.v1_0.MapUtils.emptyIfNull; import static io.opentelemetry.instrumentation.awslambda.v1_0.MapUtils.lowercaseMap; +import static io.opentelemetry.semconv.trace.attributes.SemanticAttributes.HTTP_METHOD; +import static io.opentelemetry.semconv.trace.attributes.SemanticAttributes.HTTP_STATUS_CODE; +import static io.opentelemetry.semconv.trace.attributes.SemanticAttributes.HTTP_URL; +import static io.opentelemetry.semconv.trace.attributes.SemanticAttributes.HTTP_USER_AGENT; import com.amazonaws.services.lambda.runtime.events.APIGatewayProxyRequestEvent; import com.amazonaws.services.lambda.runtime.events.APIGatewayProxyResponseEvent; diff --git a/instrumentation/aws-lambda-1.0/library/src/main/java/io/opentelemetry/instrumentation/awslambda/v1_0/ParentContextExtractor.java b/instrumentation/aws-lambda-1.0/library/src/main/java/io/opentelemetry/instrumentation/awslambda/v1_0/ParentContextExtractor.java index b70f8e224ba8..0ca3d3a9dbe6 100644 --- a/instrumentation/aws-lambda-1.0/library/src/main/java/io/opentelemetry/instrumentation/awslambda/v1_0/ParentContextExtractor.java +++ b/instrumentation/aws-lambda-1.0/library/src/main/java/io/opentelemetry/instrumentation/awslambda/v1_0/ParentContextExtractor.java @@ -7,17 +7,17 @@ import static io.opentelemetry.instrumentation.awslambda.v1_0.MapUtils.lowercaseMap; -import io.opentelemetry.api.OpenTelemetry; +import io.opentelemetry.api.GlobalOpenTelemetry; import io.opentelemetry.context.Context; import io.opentelemetry.context.propagation.TextMapPropagator; -import io.opentelemetry.extension.trace.propagation.AwsXRayPropagator; +import io.opentelemetry.extension.trace.propagation.AwsXrayPropagator; import java.util.Collections; import java.util.Map; public class ParentContextExtractor { static Context fromHttpHeaders(Map headers) { - return OpenTelemetry.getGlobalPropagators() + return GlobalOpenTelemetry.getPropagators() .getTextMapPropagator() .extract( io.opentelemetry.context.Context.current(), lowercaseMap(headers), MapGetter.INSTANCE); @@ -27,7 +27,7 @@ static Context fromHttpHeaders(Map headers) { static final String AWS_TRACE_HEADER_PROPAGATOR_KEY = "x-amzn-trace-id"; static Context fromXRayHeader(String parentHeader) { - return AwsXRayPropagator.getInstance() + return AwsXrayPropagator.getInstance() .extract( Context.current(), Collections.singletonMap(AWS_TRACE_HEADER_PROPAGATOR_KEY, parentHeader), diff --git a/instrumentation/aws-lambda-1.0/library/src/test/groovy/io/opentelemetry/instrumentation/awslambda/v1_0/TracingRequestWrapperTest.groovy b/instrumentation/aws-lambda-1.0/library/src/test/groovy/io/opentelemetry/instrumentation/awslambda/v1_0/TracingRequestWrapperTest.groovy index c84f2ef0792f..da30651a7a9b 100644 --- a/instrumentation/aws-lambda-1.0/library/src/test/groovy/io/opentelemetry/instrumentation/awslambda/v1_0/TracingRequestWrapperTest.groovy +++ b/instrumentation/aws-lambda-1.0/library/src/test/groovy/io/opentelemetry/instrumentation/awslambda/v1_0/TracingRequestWrapperTest.groovy @@ -9,7 +9,7 @@ import static io.opentelemetry.api.trace.Span.Kind.SERVER import com.amazonaws.services.lambda.runtime.Context import com.amazonaws.services.lambda.runtime.RequestHandler -import io.opentelemetry.api.trace.attributes.SemanticAttributes +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes class TracingRequestWrapperTest extends TracingRequestWrapperTestBase { diff --git a/instrumentation/aws-lambda-1.0/library/src/test/java/io/opentelemetry/instrumentation/awslambda/v1_0/ApiGatewayProxyRequestTest.java b/instrumentation/aws-lambda-1.0/library/src/test/java/io/opentelemetry/instrumentation/awslambda/v1_0/ApiGatewayProxyRequestTest.java index d9616679b39a..194641fc2d19 100644 --- a/instrumentation/aws-lambda-1.0/library/src/test/java/io/opentelemetry/instrumentation/awslambda/v1_0/ApiGatewayProxyRequestTest.java +++ b/instrumentation/aws-lambda-1.0/library/src/test/java/io/opentelemetry/instrumentation/awslambda/v1_0/ApiGatewayProxyRequestTest.java @@ -14,9 +14,9 @@ import static org.mockito.Mockito.never; import io.opentelemetry.api.DefaultOpenTelemetry; -import io.opentelemetry.api.OpenTelemetry; +import io.opentelemetry.api.GlobalOpenTelemetry; import io.opentelemetry.context.propagation.ContextPropagators; -import io.opentelemetry.extension.trace.propagation.AwsXRayPropagator; +import io.opentelemetry.extension.trace.propagation.AwsXrayPropagator; import io.opentelemetry.extension.trace.propagation.B3Propagator; import io.opentelemetry.sdk.OpenTelemetrySdk; import java.io.ByteArrayInputStream; @@ -29,14 +29,14 @@ class ApiGatewayProxyRequestTest { @AfterEach void resetOpenTelemetry() { - OpenTelemetry.set(OpenTelemetrySdk.builder().build()); + GlobalOpenTelemetry.set(OpenTelemetrySdk.builder().build()); } @Test public void shouldCreateNoopRequestIfNoPropagatorsSet() throws IOException { // given InputStream mock = mock(InputStream.class); - OpenTelemetry.set( + GlobalOpenTelemetry.set( DefaultOpenTelemetry.builder().setPropagators(ContextPropagators.noop()).build()); // when ApiGatewayProxyRequest created = ApiGatewayProxyRequest.forStream(mock); @@ -49,9 +49,9 @@ public void shouldCreateNoopRequestIfNoPropagatorsSet() throws IOException { public void shouldCreateNoopRequestIfXRayPropagatorsSet() throws IOException { // given InputStream mock = mock(InputStream.class); - OpenTelemetry.set( + GlobalOpenTelemetry.set( DefaultOpenTelemetry.builder() - .setPropagators(ContextPropagators.create(AwsXRayPropagator.getInstance())) + .setPropagators(ContextPropagators.create(AwsXrayPropagator.getInstance())) .build()); // when ApiGatewayProxyRequest created = ApiGatewayProxyRequest.forStream(mock); @@ -65,7 +65,7 @@ public void shouldUseStreamMarkingIfHttpPropagatorsSet() throws IOException { // given InputStream mock = mock(InputStream.class); given(mock.markSupported()).willReturn(true); - OpenTelemetry.set( + GlobalOpenTelemetry.set( DefaultOpenTelemetry.builder() .setPropagators(ContextPropagators.create(B3Propagator.getInstance())) .build()); @@ -83,7 +83,7 @@ public void shouldUseCopyIfMarkingNotAvailableAndHttpPropagatorsSet() throws IOE InputStream mock = mock(InputStream.class); given(mock.markSupported()).willReturn(false); given(mock.read(any(byte[].class))).willReturn(-1); - OpenTelemetry.set( + GlobalOpenTelemetry.set( DefaultOpenTelemetry.builder() .setPropagators(ContextPropagators.create(B3Propagator.getInstance())) .build()); diff --git a/instrumentation/aws-lambda-1.0/library/src/test/java/io/opentelemetry/instrumentation/awslambda/v1_0/ParentContextExtractorTest.java b/instrumentation/aws-lambda-1.0/library/src/test/java/io/opentelemetry/instrumentation/awslambda/v1_0/ParentContextExtractorTest.java index a11ded0f46e2..cd51aed8157f 100644 --- a/instrumentation/aws-lambda-1.0/library/src/test/java/io/opentelemetry/instrumentation/awslambda/v1_0/ParentContextExtractorTest.java +++ b/instrumentation/aws-lambda-1.0/library/src/test/java/io/opentelemetry/instrumentation/awslambda/v1_0/ParentContextExtractorTest.java @@ -9,7 +9,7 @@ import com.google.common.collect.ImmutableMap; import io.opentelemetry.api.DefaultOpenTelemetry; -import io.opentelemetry.api.OpenTelemetry; +import io.opentelemetry.api.GlobalOpenTelemetry; import io.opentelemetry.api.trace.Span; import io.opentelemetry.api.trace.SpanContext; import io.opentelemetry.context.Context; @@ -24,7 +24,7 @@ class ParentContextExtractorTest { @AfterEach void resetOpenTelemetry() { - OpenTelemetry.set(OpenTelemetrySdk.builder().build()); + GlobalOpenTelemetry.set(OpenTelemetrySdk.builder().build()); } @Test @@ -38,7 +38,7 @@ public void shouldExtractCaseInsensitiveHeaders() { "0000000000000456", "X-B3-Sampled", "true"); - OpenTelemetry.set( + GlobalOpenTelemetry.set( DefaultOpenTelemetry.builder() .setPropagators(ContextPropagators.create(B3Propagator.getInstance())) .build()); diff --git a/instrumentation/aws-lambda-1.0/testing/src/main/groovy/io/opentelemetry/instrumentation/awslambda/v1_0/AbstractAwsLambdaRequestHandlerTest.groovy b/instrumentation/aws-lambda-1.0/testing/src/main/groovy/io/opentelemetry/instrumentation/awslambda/v1_0/AbstractAwsLambdaRequestHandlerTest.groovy index cb509eaeefa1..7199e15e60b6 100644 --- a/instrumentation/aws-lambda-1.0/testing/src/main/groovy/io/opentelemetry/instrumentation/awslambda/v1_0/AbstractAwsLambdaRequestHandlerTest.groovy +++ b/instrumentation/aws-lambda-1.0/testing/src/main/groovy/io/opentelemetry/instrumentation/awslambda/v1_0/AbstractAwsLambdaRequestHandlerTest.groovy @@ -10,7 +10,7 @@ import static io.opentelemetry.api.trace.Span.Kind.SERVER import com.amazonaws.services.lambda.runtime.Context import com.amazonaws.services.lambda.runtime.RequestHandler import com.github.stefanbirkner.systemlambda.SystemLambda -import io.opentelemetry.api.trace.attributes.SemanticAttributes +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes import io.opentelemetry.instrumentation.test.InstrumentationSpecification abstract class AbstractAwsLambdaRequestHandlerTest extends InstrumentationSpecification { diff --git a/instrumentation/aws-lambda-1.0/testing/src/main/groovy/io/opentelemetry/instrumentation/awslambda/v1_0/AbstractAwsLambdaSqsHandlerTest.groovy b/instrumentation/aws-lambda-1.0/testing/src/main/groovy/io/opentelemetry/instrumentation/awslambda/v1_0/AbstractAwsLambdaSqsHandlerTest.groovy index 6aa996938526..3a697d3d9d6f 100644 --- a/instrumentation/aws-lambda-1.0/testing/src/main/groovy/io/opentelemetry/instrumentation/awslambda/v1_0/AbstractAwsLambdaSqsHandlerTest.groovy +++ b/instrumentation/aws-lambda-1.0/testing/src/main/groovy/io/opentelemetry/instrumentation/awslambda/v1_0/AbstractAwsLambdaSqsHandlerTest.groovy @@ -11,7 +11,7 @@ import static io.opentelemetry.api.trace.Span.Kind.SERVER import com.amazonaws.services.lambda.runtime.Context import com.amazonaws.services.lambda.runtime.RequestHandler import com.amazonaws.services.lambda.runtime.events.SQSEvent -import io.opentelemetry.api.trace.attributes.SemanticAttributes +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes import io.opentelemetry.instrumentation.test.InstrumentationSpecification abstract class AbstractAwsLambdaSqsHandlerTest extends InstrumentationSpecification { diff --git a/instrumentation/aws-sdk/aws-sdk-1.11/javaagent/src/test/groovy/Aws1ClientTest.groovy b/instrumentation/aws-sdk/aws-sdk-1.11/javaagent/src/test/groovy/Aws1ClientTest.groovy index e92b3f5e65b6..a5f9f39265a7 100644 --- a/instrumentation/aws-sdk/aws-sdk-1.11/javaagent/src/test/groovy/Aws1ClientTest.groovy +++ b/instrumentation/aws-sdk/aws-sdk-1.11/javaagent/src/test/groovy/Aws1ClientTest.groovy @@ -38,7 +38,7 @@ import com.amazonaws.services.sqs.AmazonSQSClientBuilder import com.amazonaws.services.sqs.model.CreateQueueRequest import com.amazonaws.services.sqs.model.SendMessageRequest import io.opentelemetry.api.trace.Span -import io.opentelemetry.api.trace.attributes.SemanticAttributes +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes import io.opentelemetry.instrumentation.test.AgentTestRunner import java.util.concurrent.atomic.AtomicReference import spock.lang.AutoCleanup diff --git a/instrumentation/aws-sdk/aws-sdk-1.11/javaagent/src/test_before_1_11_106/groovy/Aws0ClientTest.groovy b/instrumentation/aws-sdk/aws-sdk-1.11/javaagent/src/test_before_1_11_106/groovy/Aws0ClientTest.groovy index d12f8794a93c..0939ae2a7fc4 100644 --- a/instrumentation/aws-sdk/aws-sdk-1.11/javaagent/src/test_before_1_11_106/groovy/Aws0ClientTest.groovy +++ b/instrumentation/aws-sdk/aws-sdk-1.11/javaagent/src/test_before_1_11_106/groovy/Aws0ClientTest.groovy @@ -25,7 +25,7 @@ import com.amazonaws.services.rds.model.DeleteOptionGroupRequest import com.amazonaws.services.s3.AmazonS3Client import com.amazonaws.services.s3.S3ClientOptions import io.opentelemetry.api.trace.Span -import io.opentelemetry.api.trace.attributes.SemanticAttributes +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes import io.opentelemetry.instrumentation.test.AgentTestRunner import java.util.concurrent.atomic.AtomicReference import spock.lang.AutoCleanup diff --git a/instrumentation/aws-sdk/aws-sdk-2.2/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/awssdk/v2_2/AwsSdkInstrumentationModule.java b/instrumentation/aws-sdk/aws-sdk-2.2/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/awssdk/v2_2/AwsSdkInstrumentationModule.java index 600d7180c06c..fa2f991b1bac 100644 --- a/instrumentation/aws-sdk/aws-sdk-2.2/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/awssdk/v2_2/AwsSdkInstrumentationModule.java +++ b/instrumentation/aws-sdk/aws-sdk-2.2/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/awssdk/v2_2/AwsSdkInstrumentationModule.java @@ -22,7 +22,7 @@ public AwsSdkInstrumentationModule() { @Override public String[] additionalHelperClassNames() { - return new String[] {"io.opentelemetry.extension.trace.propagation.AwsXRayPropagator"}; + return new String[] {"io.opentelemetry.extension.trace.propagation.AwsXrayPropagator"}; } /** diff --git a/instrumentation/aws-sdk/aws-sdk-2.2/library/src/main/java/io/opentelemetry/instrumentation/awssdk/v2_2/AwsSdk.java b/instrumentation/aws-sdk/aws-sdk-2.2/library/src/main/java/io/opentelemetry/instrumentation/awssdk/v2_2/AwsSdk.java index 9bfd07d8da2c..8a75851b8de3 100644 --- a/instrumentation/aws-sdk/aws-sdk-2.2/library/src/main/java/io/opentelemetry/instrumentation/awssdk/v2_2/AwsSdk.java +++ b/instrumentation/aws-sdk/aws-sdk-2.2/library/src/main/java/io/opentelemetry/instrumentation/awssdk/v2_2/AwsSdk.java @@ -7,7 +7,7 @@ import static io.opentelemetry.instrumentation.awssdk.v2_2.TracingExecutionInterceptor.CONTEXT_ATTRIBUTE; -import io.opentelemetry.api.OpenTelemetry; +import io.opentelemetry.api.GlobalOpenTelemetry; import io.opentelemetry.api.trace.Tracer; import io.opentelemetry.context.Context; import software.amazon.awssdk.core.interceptor.ExecutionAttributes; @@ -29,7 +29,7 @@ public class AwsSdk { private static final Tracer tracer = - OpenTelemetry.getGlobalTracer(AwsSdkHttpClientTracer.tracer().getInstrumentationName()); + GlobalOpenTelemetry.getTracer(AwsSdkHttpClientTracer.tracer().getInstrumentationName()); /** Returns the {@link Tracer} used to instrument the AWS SDK. */ public static Tracer tracer() { diff --git a/instrumentation/aws-sdk/aws-sdk-2.2/library/src/main/java/io/opentelemetry/instrumentation/awssdk/v2_2/AwsSdkHttpClientTracer.java b/instrumentation/aws-sdk/aws-sdk-2.2/library/src/main/java/io/opentelemetry/instrumentation/awssdk/v2_2/AwsSdkHttpClientTracer.java index f49de3efe22f..110934316895 100644 --- a/instrumentation/aws-sdk/aws-sdk-2.2/library/src/main/java/io/opentelemetry/instrumentation/awssdk/v2_2/AwsSdkHttpClientTracer.java +++ b/instrumentation/aws-sdk/aws-sdk-2.2/library/src/main/java/io/opentelemetry/instrumentation/awssdk/v2_2/AwsSdkHttpClientTracer.java @@ -10,7 +10,7 @@ import io.opentelemetry.api.trace.Span; import io.opentelemetry.context.Context; import io.opentelemetry.context.propagation.TextMapPropagator; -import io.opentelemetry.extension.trace.propagation.AwsXRayPropagator; +import io.opentelemetry.extension.trace.propagation.AwsXrayPropagator; import io.opentelemetry.instrumentation.api.tracer.HttpClientTracer; import java.net.URI; import software.amazon.awssdk.core.interceptor.ExecutionAttributes; @@ -36,7 +36,7 @@ public Context startSpan(Context parentContext, ExecutionAttributes attributes) } public void inject(Context context, SdkHttpRequest.Builder builder) { - AwsXRayPropagator.getInstance().inject(context, builder, getSetter()); + AwsXrayPropagator.getInstance().inject(context, builder, getSetter()); } @Override diff --git a/instrumentation/aws-sdk/aws-sdk-2.2/library/src/main/java/io/opentelemetry/instrumentation/awssdk/v2_2/DbRequestDecorator.java b/instrumentation/aws-sdk/aws-sdk-2.2/library/src/main/java/io/opentelemetry/instrumentation/awssdk/v2_2/DbRequestDecorator.java index 6e60ffe64b7f..027d2fe22877 100644 --- a/instrumentation/aws-sdk/aws-sdk-2.2/library/src/main/java/io/opentelemetry/instrumentation/awssdk/v2_2/DbRequestDecorator.java +++ b/instrumentation/aws-sdk/aws-sdk-2.2/library/src/main/java/io/opentelemetry/instrumentation/awssdk/v2_2/DbRequestDecorator.java @@ -6,7 +6,7 @@ package io.opentelemetry.instrumentation.awssdk.v2_2; import io.opentelemetry.api.trace.Span; -import io.opentelemetry.api.trace.attributes.SemanticAttributes; +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes; import software.amazon.awssdk.core.SdkRequest; import software.amazon.awssdk.core.interceptor.ExecutionAttributes; import software.amazon.awssdk.core.interceptor.SdkExecutionAttribute; diff --git a/instrumentation/aws-sdk/aws-sdk-2.2/library/src/main/java/io/opentelemetry/instrumentation/awssdk/v2_2/TracingExecutionInterceptor.java b/instrumentation/aws-sdk/aws-sdk-2.2/library/src/main/java/io/opentelemetry/instrumentation/awssdk/v2_2/TracingExecutionInterceptor.java index cea010393530..dd36f1033646 100644 --- a/instrumentation/aws-sdk/aws-sdk-2.2/library/src/main/java/io/opentelemetry/instrumentation/awssdk/v2_2/TracingExecutionInterceptor.java +++ b/instrumentation/aws-sdk/aws-sdk-2.2/library/src/main/java/io/opentelemetry/instrumentation/awssdk/v2_2/TracingExecutionInterceptor.java @@ -10,8 +10,8 @@ import static io.opentelemetry.instrumentation.awssdk.v2_2.RequestType.ofSdkRequest; import io.opentelemetry.api.trace.Span; -import io.opentelemetry.api.trace.attributes.SemanticAttributes; import io.opentelemetry.context.Scope; +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes; import java.util.EnumMap; import java.util.HashMap; import java.util.Map; diff --git a/instrumentation/aws-sdk/aws-sdk-2.2/testing/src/main/groovy/io/opentelemetry/instrumentation/awssdk/v2_2/AbstractAws2ClientTest.groovy b/instrumentation/aws-sdk/aws-sdk-2.2/testing/src/main/groovy/io/opentelemetry/instrumentation/awssdk/v2_2/AbstractAws2ClientTest.groovy index 8c34121d2fa2..ccfc4b5a82d9 100644 --- a/instrumentation/aws-sdk/aws-sdk-2.2/testing/src/main/groovy/io/opentelemetry/instrumentation/awssdk/v2_2/AbstractAws2ClientTest.groovy +++ b/instrumentation/aws-sdk/aws-sdk-2.2/testing/src/main/groovy/io/opentelemetry/instrumentation/awssdk/v2_2/AbstractAws2ClientTest.groovy @@ -9,7 +9,7 @@ import static com.google.common.collect.ImmutableMap.of import static io.opentelemetry.api.trace.Span.Kind.CLIENT import static io.opentelemetry.instrumentation.test.server.http.TestHttpServer.httpServer -import io.opentelemetry.api.trace.attributes.SemanticAttributes +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes import io.opentelemetry.instrumentation.test.InstrumentationSpecification import java.time.Duration import java.util.concurrent.Future diff --git a/instrumentation/cassandra/cassandra-3.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/cassandra/v3_0/CassandraDatabaseClientTracer.java b/instrumentation/cassandra/cassandra-3.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/cassandra/v3_0/CassandraDatabaseClientTracer.java index 8cd5d2a6e8ed..77cc8ae9063e 100644 --- a/instrumentation/cassandra/cassandra-3.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/cassandra/v3_0/CassandraDatabaseClientTracer.java +++ b/instrumentation/cassandra/cassandra-3.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/cassandra/v3_0/CassandraDatabaseClientTracer.java @@ -9,11 +9,11 @@ import com.datastax.driver.core.Host; import com.datastax.driver.core.Session; import io.opentelemetry.api.trace.Span; -import io.opentelemetry.api.trace.attributes.SemanticAttributes; -import io.opentelemetry.api.trace.attributes.SemanticAttributes.DbSystemValues; import io.opentelemetry.context.Context; import io.opentelemetry.instrumentation.api.tracer.DatabaseClientTracer; import io.opentelemetry.instrumentation.api.tracer.utils.NetPeerUtils; +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes; +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes.DbSystemValues; import java.net.InetSocketAddress; public class CassandraDatabaseClientTracer extends DatabaseClientTracer { diff --git a/instrumentation/cassandra/cassandra-3.0/javaagent/src/test/groovy/CassandraClientTest.groovy b/instrumentation/cassandra/cassandra-3.0/javaagent/src/test/groovy/CassandraClientTest.groovy index 9772b53aaf16..b1d8c04d1c06 100644 --- a/instrumentation/cassandra/cassandra-3.0/javaagent/src/test/groovy/CassandraClientTest.groovy +++ b/instrumentation/cassandra/cassandra-3.0/javaagent/src/test/groovy/CassandraClientTest.groovy @@ -9,7 +9,7 @@ import static io.opentelemetry.instrumentation.test.utils.TraceUtils.runUnderTra import com.datastax.driver.core.Cluster import com.datastax.driver.core.Session -import io.opentelemetry.api.trace.attributes.SemanticAttributes +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes import io.opentelemetry.instrumentation.test.AgentTestRunner import io.opentelemetry.instrumentation.test.asserts.TraceAssert import io.opentelemetry.sdk.trace.data.SpanData diff --git a/instrumentation/cassandra/cassandra-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/cassandra/v4_0/CassandraDatabaseClientTracer.java b/instrumentation/cassandra/cassandra-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/cassandra/v4_0/CassandraDatabaseClientTracer.java index c16f77d6bcbd..f3767828240f 100644 --- a/instrumentation/cassandra/cassandra-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/cassandra/v4_0/CassandraDatabaseClientTracer.java +++ b/instrumentation/cassandra/cassandra-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/cassandra/v4_0/CassandraDatabaseClientTracer.java @@ -10,10 +10,10 @@ import com.datastax.oss.driver.api.core.cql.ExecutionInfo; import com.datastax.oss.driver.api.core.metadata.Node; import io.opentelemetry.api.trace.Span; -import io.opentelemetry.api.trace.attributes.SemanticAttributes.DbSystemValues; import io.opentelemetry.context.Context; import io.opentelemetry.instrumentation.api.tracer.DatabaseClientTracer; import io.opentelemetry.instrumentation.api.tracer.utils.NetPeerUtils; +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes.DbSystemValues; import java.net.InetSocketAddress; import java.net.SocketAddress; diff --git a/instrumentation/cassandra/cassandra-4.0/javaagent/src/test/groovy/CassandraClientTest.groovy b/instrumentation/cassandra/cassandra-4.0/javaagent/src/test/groovy/CassandraClientTest.groovy index c974c238e368..6998b0b1c0e4 100644 --- a/instrumentation/cassandra/cassandra-4.0/javaagent/src/test/groovy/CassandraClientTest.groovy +++ b/instrumentation/cassandra/cassandra-4.0/javaagent/src/test/groovy/CassandraClientTest.groovy @@ -11,7 +11,7 @@ import com.datastax.oss.driver.api.core.CqlSession import com.datastax.oss.driver.api.core.config.DefaultDriverOption import com.datastax.oss.driver.api.core.config.DriverConfigLoader import com.datastax.oss.driver.internal.core.config.typesafe.DefaultDriverConfigLoader -import io.opentelemetry.api.trace.attributes.SemanticAttributes +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes import io.opentelemetry.instrumentation.test.AgentTestRunner import io.opentelemetry.instrumentation.test.asserts.TraceAssert import io.opentelemetry.sdk.trace.data.SpanData diff --git a/instrumentation/couchbase/couchbase-2.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/couchbase/v2_0/CouchbaseClientTracer.java b/instrumentation/couchbase/couchbase-2.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/couchbase/v2_0/CouchbaseClientTracer.java index e9c1c6594dcd..5710ed4b165a 100644 --- a/instrumentation/couchbase/couchbase-2.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/couchbase/v2_0/CouchbaseClientTracer.java +++ b/instrumentation/couchbase/couchbase-2.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/couchbase/v2_0/CouchbaseClientTracer.java @@ -5,8 +5,8 @@ package io.opentelemetry.javaagent.instrumentation.couchbase.v2_0; -import io.opentelemetry.api.trace.attributes.SemanticAttributes.DbSystemValues; import io.opentelemetry.instrumentation.api.tracer.DatabaseClientTracer; +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes.DbSystemValues; import java.lang.reflect.Method; import java.net.InetSocketAddress; diff --git a/instrumentation/couchbase/couchbase-2.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/couchbase/v2_0/CouchbaseOnSubscribe.java b/instrumentation/couchbase/couchbase-2.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/couchbase/v2_0/CouchbaseOnSubscribe.java index 341aa296e2b5..5c368662b4d7 100644 --- a/instrumentation/couchbase/couchbase-2.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/couchbase/v2_0/CouchbaseOnSubscribe.java +++ b/instrumentation/couchbase/couchbase-2.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/couchbase/v2_0/CouchbaseOnSubscribe.java @@ -9,9 +9,9 @@ import static io.opentelemetry.javaagent.instrumentation.couchbase.v2_0.CouchbaseClientTracer.tracer; import io.opentelemetry.api.trace.Span; -import io.opentelemetry.api.trace.attributes.SemanticAttributes; -import io.opentelemetry.api.trace.attributes.SemanticAttributes.DbSystemValues; import io.opentelemetry.instrumentation.rxjava.TracedOnSubscribe; +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes; +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes.DbSystemValues; import java.lang.reflect.Method; import rx.Observable; diff --git a/instrumentation/couchbase/couchbase-2.6/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/couchbase/v2_6/CouchbaseNetworkInstrumentation.java b/instrumentation/couchbase/couchbase-2.6/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/couchbase/v2_6/CouchbaseNetworkInstrumentation.java index 240a41aa7ab2..d96e8f8bc036 100644 --- a/instrumentation/couchbase/couchbase-2.6/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/couchbase/v2_6/CouchbaseNetworkInstrumentation.java +++ b/instrumentation/couchbase/couchbase-2.6/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/couchbase/v2_6/CouchbaseNetworkInstrumentation.java @@ -16,11 +16,11 @@ import com.couchbase.client.core.message.CouchbaseRequest; import io.opentelemetry.api.trace.Span; -import io.opentelemetry.api.trace.attributes.SemanticAttributes; import io.opentelemetry.instrumentation.api.tracer.utils.NetPeerUtils; import io.opentelemetry.javaagent.instrumentation.api.ContextStore; import io.opentelemetry.javaagent.instrumentation.api.InstrumentationContext; import io.opentelemetry.javaagent.tooling.TypeInstrumentation; +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes; import java.util.Map; import net.bytebuddy.asm.Advice; import net.bytebuddy.description.method.MethodDescription; diff --git a/instrumentation/couchbase/couchbase-2.6/javaagent/src/test/groovy/CouchbaseSpanUtil.groovy b/instrumentation/couchbase/couchbase-2.6/javaagent/src/test/groovy/CouchbaseSpanUtil.groovy index 1b0937812882..695494fe7742 100644 --- a/instrumentation/couchbase/couchbase-2.6/javaagent/src/test/groovy/CouchbaseSpanUtil.groovy +++ b/instrumentation/couchbase/couchbase-2.6/javaagent/src/test/groovy/CouchbaseSpanUtil.groovy @@ -5,7 +5,7 @@ import static io.opentelemetry.api.trace.Span.Kind.CLIENT -import io.opentelemetry.api.trace.attributes.SemanticAttributes +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes import io.opentelemetry.instrumentation.test.asserts.TraceAssert import io.opentelemetry.sdk.trace.data.SpanData diff --git a/instrumentation/couchbase/couchbase-testing/src/main/groovy/util/AbstractCouchbaseTest.groovy b/instrumentation/couchbase/couchbase-testing/src/main/groovy/util/AbstractCouchbaseTest.groovy index 2addc46b0f3e..608c1bf32b4b 100644 --- a/instrumentation/couchbase/couchbase-testing/src/main/groovy/util/AbstractCouchbaseTest.groovy +++ b/instrumentation/couchbase/couchbase-testing/src/main/groovy/util/AbstractCouchbaseTest.groovy @@ -17,7 +17,7 @@ import com.couchbase.mock.Bucket import com.couchbase.mock.BucketConfiguration import com.couchbase.mock.CouchbaseMock import com.couchbase.mock.http.query.QueryServer -import io.opentelemetry.api.trace.attributes.SemanticAttributes +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes import io.opentelemetry.instrumentation.test.AgentTestRunner import io.opentelemetry.instrumentation.test.asserts.TraceAssert import io.opentelemetry.instrumentation.test.utils.PortUtils diff --git a/instrumentation/dropwizard-testing/src/test/groovy/DropwizardTest.groovy b/instrumentation/dropwizard-testing/src/test/groovy/DropwizardTest.groovy index 76619b2f7698..dc2da8dbe586 100644 --- a/instrumentation/dropwizard-testing/src/test/groovy/DropwizardTest.groovy +++ b/instrumentation/dropwizard-testing/src/test/groovy/DropwizardTest.groovy @@ -18,7 +18,7 @@ import io.dropwizard.setup.Bootstrap import io.dropwizard.setup.Environment import io.dropwizard.testing.ConfigOverride import io.dropwizard.testing.DropwizardTestSupport -import io.opentelemetry.api.trace.attributes.SemanticAttributes +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes import io.opentelemetry.instrumentation.test.asserts.TraceAssert import io.opentelemetry.instrumentation.test.base.HttpServerTest import io.opentelemetry.instrumentation.test.utils.PortUtils diff --git a/instrumentation/elasticsearch/elasticsearch-rest-5.0/javaagent/src/latestDepTest/groovy/Elasticsearch6RestClientTest.groovy b/instrumentation/elasticsearch/elasticsearch-rest-5.0/javaagent/src/latestDepTest/groovy/Elasticsearch6RestClientTest.groovy index f4406e8aa20f..520fcf4c2dad 100644 --- a/instrumentation/elasticsearch/elasticsearch-rest-5.0/javaagent/src/latestDepTest/groovy/Elasticsearch6RestClientTest.groovy +++ b/instrumentation/elasticsearch/elasticsearch-rest-5.0/javaagent/src/latestDepTest/groovy/Elasticsearch6RestClientTest.groovy @@ -6,7 +6,7 @@ import static io.opentelemetry.api.trace.Span.Kind.CLIENT import groovy.json.JsonSlurper -import io.opentelemetry.api.trace.attributes.SemanticAttributes +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes import io.opentelemetry.instrumentation.test.AgentTestRunner import org.apache.http.HttpHost import org.apache.http.client.config.RequestConfig diff --git a/instrumentation/elasticsearch/elasticsearch-rest-5.0/javaagent/src/test/groovy/Elasticsearch5RestClientTest.groovy b/instrumentation/elasticsearch/elasticsearch-rest-5.0/javaagent/src/test/groovy/Elasticsearch5RestClientTest.groovy index b382503fadae..8d0510b63fb6 100644 --- a/instrumentation/elasticsearch/elasticsearch-rest-5.0/javaagent/src/test/groovy/Elasticsearch5RestClientTest.groovy +++ b/instrumentation/elasticsearch/elasticsearch-rest-5.0/javaagent/src/test/groovy/Elasticsearch5RestClientTest.groovy @@ -7,7 +7,7 @@ import static io.opentelemetry.api.trace.Span.Kind.CLIENT import static org.elasticsearch.cluster.ClusterName.CLUSTER_NAME_SETTING import groovy.json.JsonSlurper -import io.opentelemetry.api.trace.attributes.SemanticAttributes +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes import io.opentelemetry.instrumentation.test.AgentTestRunner import org.apache.http.HttpHost import org.apache.http.client.config.RequestConfig diff --git a/instrumentation/elasticsearch/elasticsearch-rest-6.4/javaagent/src/latestDepTest/groovy/Elasticsearch6RestClientTest.groovy b/instrumentation/elasticsearch/elasticsearch-rest-6.4/javaagent/src/latestDepTest/groovy/Elasticsearch6RestClientTest.groovy index a01b333a2194..fadbb18d579d 100644 --- a/instrumentation/elasticsearch/elasticsearch-rest-6.4/javaagent/src/latestDepTest/groovy/Elasticsearch6RestClientTest.groovy +++ b/instrumentation/elasticsearch/elasticsearch-rest-6.4/javaagent/src/latestDepTest/groovy/Elasticsearch6RestClientTest.groovy @@ -6,7 +6,7 @@ import static io.opentelemetry.api.trace.Span.Kind.CLIENT import groovy.json.JsonSlurper -import io.opentelemetry.api.trace.attributes.SemanticAttributes +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes import io.opentelemetry.instrumentation.test.AgentTestRunner import org.apache.http.HttpHost import org.apache.http.client.config.RequestConfig diff --git a/instrumentation/elasticsearch/elasticsearch-rest-6.4/javaagent/src/test/groovy/Elasticsearch6RestClientTest.groovy b/instrumentation/elasticsearch/elasticsearch-rest-6.4/javaagent/src/test/groovy/Elasticsearch6RestClientTest.groovy index f4406e8aa20f..520fcf4c2dad 100644 --- a/instrumentation/elasticsearch/elasticsearch-rest-6.4/javaagent/src/test/groovy/Elasticsearch6RestClientTest.groovy +++ b/instrumentation/elasticsearch/elasticsearch-rest-6.4/javaagent/src/test/groovy/Elasticsearch6RestClientTest.groovy @@ -6,7 +6,7 @@ import static io.opentelemetry.api.trace.Span.Kind.CLIENT import groovy.json.JsonSlurper -import io.opentelemetry.api.trace.attributes.SemanticAttributes +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes import io.opentelemetry.instrumentation.test.AgentTestRunner import org.apache.http.HttpHost import org.apache.http.client.config.RequestConfig diff --git a/instrumentation/elasticsearch/elasticsearch-rest-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/elasticsearch/rest/ElasticsearchRestClientTracer.java b/instrumentation/elasticsearch/elasticsearch-rest-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/elasticsearch/rest/ElasticsearchRestClientTracer.java index c267124dffe6..e19bd0fafdbf 100644 --- a/instrumentation/elasticsearch/elasticsearch-rest-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/elasticsearch/rest/ElasticsearchRestClientTracer.java +++ b/instrumentation/elasticsearch/elasticsearch-rest-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/elasticsearch/rest/ElasticsearchRestClientTracer.java @@ -6,10 +6,10 @@ package io.opentelemetry.javaagent.instrumentation.elasticsearch.rest; import io.opentelemetry.api.trace.Span; -import io.opentelemetry.api.trace.attributes.SemanticAttributes; import io.opentelemetry.context.Context; import io.opentelemetry.instrumentation.api.tracer.DatabaseClientTracer; import io.opentelemetry.instrumentation.api.tracer.utils.NetPeerUtils; +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes; import java.net.InetSocketAddress; import org.elasticsearch.client.Response; diff --git a/instrumentation/elasticsearch/elasticsearch-transport-5.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/elasticsearch/transport/v5_0/TransportActionListener.java b/instrumentation/elasticsearch/elasticsearch-transport-5.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/elasticsearch/transport/v5_0/TransportActionListener.java index a1897f6cd534..d57d7f8a3825 100644 --- a/instrumentation/elasticsearch/elasticsearch-transport-5.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/elasticsearch/transport/v5_0/TransportActionListener.java +++ b/instrumentation/elasticsearch/elasticsearch-transport-5.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/elasticsearch/transport/v5_0/TransportActionListener.java @@ -8,9 +8,9 @@ import static io.opentelemetry.javaagent.instrumentation.elasticsearch.transport.ElasticsearchTransportClientTracer.tracer; import io.opentelemetry.api.trace.Span; -import io.opentelemetry.api.trace.attributes.SemanticAttributes; import io.opentelemetry.context.Context; import io.opentelemetry.instrumentation.api.tracer.utils.NetPeerUtils; +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes; import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.ActionRequest; import org.elasticsearch.action.ActionResponse; diff --git a/instrumentation/elasticsearch/elasticsearch-transport-5.0/javaagent/src/test/groovy/Elasticsearch5NodeClientTest.groovy b/instrumentation/elasticsearch/elasticsearch-transport-5.0/javaagent/src/test/groovy/Elasticsearch5NodeClientTest.groovy index 3ee50e61dec5..cb975aea486e 100644 --- a/instrumentation/elasticsearch/elasticsearch-transport-5.0/javaagent/src/test/groovy/Elasticsearch5NodeClientTest.groovy +++ b/instrumentation/elasticsearch/elasticsearch-transport-5.0/javaagent/src/test/groovy/Elasticsearch5NodeClientTest.groovy @@ -7,7 +7,7 @@ import static io.opentelemetry.api.trace.Span.Kind.CLIENT import static io.opentelemetry.instrumentation.test.utils.TraceUtils.runUnderTrace import static org.elasticsearch.cluster.ClusterName.CLUSTER_NAME_SETTING -import io.opentelemetry.api.trace.attributes.SemanticAttributes +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes import io.opentelemetry.instrumentation.test.AgentTestRunner import org.elasticsearch.action.admin.cluster.health.ClusterHealthRequest import org.elasticsearch.common.io.FileSystemUtils diff --git a/instrumentation/elasticsearch/elasticsearch-transport-5.0/javaagent/src/test/groovy/Elasticsearch5TransportClientTest.groovy b/instrumentation/elasticsearch/elasticsearch-transport-5.0/javaagent/src/test/groovy/Elasticsearch5TransportClientTest.groovy index aadfb890d5c2..2f3211f497cc 100644 --- a/instrumentation/elasticsearch/elasticsearch-transport-5.0/javaagent/src/test/groovy/Elasticsearch5TransportClientTest.groovy +++ b/instrumentation/elasticsearch/elasticsearch-transport-5.0/javaagent/src/test/groovy/Elasticsearch5TransportClientTest.groovy @@ -7,7 +7,7 @@ import static io.opentelemetry.api.trace.Span.Kind.CLIENT import static io.opentelemetry.instrumentation.test.utils.TraceUtils.runUnderTrace import static org.elasticsearch.cluster.ClusterName.CLUSTER_NAME_SETTING -import io.opentelemetry.api.trace.attributes.SemanticAttributes +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes import io.opentelemetry.instrumentation.test.AgentTestRunner import org.elasticsearch.action.admin.cluster.health.ClusterHealthRequest import org.elasticsearch.client.transport.TransportClient diff --git a/instrumentation/elasticsearch/elasticsearch-transport-5.3/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/elasticsearch/transport/v5_3/TransportActionListener.java b/instrumentation/elasticsearch/elasticsearch-transport-5.3/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/elasticsearch/transport/v5_3/TransportActionListener.java index 2cdddcad5905..605993157aec 100644 --- a/instrumentation/elasticsearch/elasticsearch-transport-5.3/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/elasticsearch/transport/v5_3/TransportActionListener.java +++ b/instrumentation/elasticsearch/elasticsearch-transport-5.3/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/elasticsearch/transport/v5_3/TransportActionListener.java @@ -8,9 +8,9 @@ import static io.opentelemetry.javaagent.instrumentation.elasticsearch.transport.ElasticsearchTransportClientTracer.tracer; import io.opentelemetry.api.trace.Span; -import io.opentelemetry.api.trace.attributes.SemanticAttributes; import io.opentelemetry.context.Context; import io.opentelemetry.instrumentation.api.tracer.utils.NetPeerUtils; +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes; import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.ActionRequest; import org.elasticsearch.action.ActionResponse; diff --git a/instrumentation/elasticsearch/elasticsearch-transport-5.3/javaagent/src/test/groovy/Elasticsearch53NodeClientTest.groovy b/instrumentation/elasticsearch/elasticsearch-transport-5.3/javaagent/src/test/groovy/Elasticsearch53NodeClientTest.groovy index 0e66895e4d6e..171872b60ded 100644 --- a/instrumentation/elasticsearch/elasticsearch-transport-5.3/javaagent/src/test/groovy/Elasticsearch53NodeClientTest.groovy +++ b/instrumentation/elasticsearch/elasticsearch-transport-5.3/javaagent/src/test/groovy/Elasticsearch53NodeClientTest.groovy @@ -7,7 +7,7 @@ import static io.opentelemetry.api.trace.Span.Kind.CLIENT import static io.opentelemetry.instrumentation.test.utils.TraceUtils.runUnderTrace import static org.elasticsearch.cluster.ClusterName.CLUSTER_NAME_SETTING -import io.opentelemetry.api.trace.attributes.SemanticAttributes +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes import io.opentelemetry.instrumentation.test.AgentTestRunner import org.elasticsearch.action.admin.cluster.health.ClusterHealthRequest import org.elasticsearch.common.io.FileSystemUtils diff --git a/instrumentation/elasticsearch/elasticsearch-transport-5.3/javaagent/src/test/groovy/Elasticsearch53TransportClientTest.groovy b/instrumentation/elasticsearch/elasticsearch-transport-5.3/javaagent/src/test/groovy/Elasticsearch53TransportClientTest.groovy index d3603b166d2b..61f774707e1a 100644 --- a/instrumentation/elasticsearch/elasticsearch-transport-5.3/javaagent/src/test/groovy/Elasticsearch53TransportClientTest.groovy +++ b/instrumentation/elasticsearch/elasticsearch-transport-5.3/javaagent/src/test/groovy/Elasticsearch53TransportClientTest.groovy @@ -7,7 +7,7 @@ import static io.opentelemetry.api.trace.Span.Kind.CLIENT import static io.opentelemetry.instrumentation.test.utils.TraceUtils.runUnderTrace import static org.elasticsearch.cluster.ClusterName.CLUSTER_NAME_SETTING -import io.opentelemetry.api.trace.attributes.SemanticAttributes +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes import io.opentelemetry.instrumentation.test.AgentTestRunner import org.elasticsearch.action.admin.cluster.health.ClusterHealthRequest import org.elasticsearch.client.transport.TransportClient diff --git a/instrumentation/elasticsearch/elasticsearch-transport-5.3/javaagent/src/test/groovy/springdata/Elasticsearch53SpringRepositoryTest.groovy b/instrumentation/elasticsearch/elasticsearch-transport-5.3/javaagent/src/test/groovy/springdata/Elasticsearch53SpringRepositoryTest.groovy index 8325bb0d9784..6bd31b5521ef 100644 --- a/instrumentation/elasticsearch/elasticsearch-transport-5.3/javaagent/src/test/groovy/springdata/Elasticsearch53SpringRepositoryTest.groovy +++ b/instrumentation/elasticsearch/elasticsearch-transport-5.3/javaagent/src/test/groovy/springdata/Elasticsearch53SpringRepositoryTest.groovy @@ -9,7 +9,7 @@ import static io.opentelemetry.api.trace.Span.Kind.CLIENT import static io.opentelemetry.api.trace.Span.Kind.INTERNAL import static io.opentelemetry.instrumentation.test.utils.TraceUtils.runUnderTrace -import io.opentelemetry.api.trace.attributes.SemanticAttributes +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes import io.opentelemetry.instrumentation.test.AgentTestRunner import java.lang.reflect.InvocationHandler import java.lang.reflect.Method diff --git a/instrumentation/elasticsearch/elasticsearch-transport-5.3/javaagent/src/test/groovy/springdata/Elasticsearch53SpringTemplateTest.groovy b/instrumentation/elasticsearch/elasticsearch-transport-5.3/javaagent/src/test/groovy/springdata/Elasticsearch53SpringTemplateTest.groovy index 9a02c9a3ae61..2dd1e5b6c6fa 100644 --- a/instrumentation/elasticsearch/elasticsearch-transport-5.3/javaagent/src/test/groovy/springdata/Elasticsearch53SpringTemplateTest.groovy +++ b/instrumentation/elasticsearch/elasticsearch-transport-5.3/javaagent/src/test/groovy/springdata/Elasticsearch53SpringTemplateTest.groovy @@ -10,7 +10,7 @@ import static io.opentelemetry.instrumentation.test.utils.TraceUtils.runUnderTra import static org.elasticsearch.cluster.ClusterName.CLUSTER_NAME_SETTING import com.google.common.collect.ImmutableSet -import io.opentelemetry.api.trace.attributes.SemanticAttributes +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes import io.opentelemetry.instrumentation.test.AgentTestRunner import java.util.concurrent.atomic.AtomicLong import org.elasticsearch.action.search.SearchResponse diff --git a/instrumentation/elasticsearch/elasticsearch-transport-6.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/elasticsearch/transport/v6_0/TransportActionListener.java b/instrumentation/elasticsearch/elasticsearch-transport-6.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/elasticsearch/transport/v6_0/TransportActionListener.java index b97bdc822609..97e51dda9001 100644 --- a/instrumentation/elasticsearch/elasticsearch-transport-6.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/elasticsearch/transport/v6_0/TransportActionListener.java +++ b/instrumentation/elasticsearch/elasticsearch-transport-6.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/elasticsearch/transport/v6_0/TransportActionListener.java @@ -8,9 +8,9 @@ import static io.opentelemetry.javaagent.instrumentation.elasticsearch.transport.ElasticsearchTransportClientTracer.tracer; import io.opentelemetry.api.trace.Span; -import io.opentelemetry.api.trace.attributes.SemanticAttributes; import io.opentelemetry.context.Context; import io.opentelemetry.instrumentation.api.tracer.utils.NetPeerUtils; +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes; import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.ActionRequest; import org.elasticsearch.action.ActionResponse; diff --git a/instrumentation/elasticsearch/elasticsearch-transport-6.0/javaagent/src/test/groovy/Elasticsearch6NodeClientTest.groovy b/instrumentation/elasticsearch/elasticsearch-transport-6.0/javaagent/src/test/groovy/Elasticsearch6NodeClientTest.groovy index f1ebad2488d1..a849b114460b 100644 --- a/instrumentation/elasticsearch/elasticsearch-transport-6.0/javaagent/src/test/groovy/Elasticsearch6NodeClientTest.groovy +++ b/instrumentation/elasticsearch/elasticsearch-transport-6.0/javaagent/src/test/groovy/Elasticsearch6NodeClientTest.groovy @@ -7,7 +7,7 @@ import static io.opentelemetry.api.trace.Span.Kind.CLIENT import static io.opentelemetry.instrumentation.test.utils.TraceUtils.runUnderTrace import static org.elasticsearch.cluster.ClusterName.CLUSTER_NAME_SETTING -import io.opentelemetry.api.trace.attributes.SemanticAttributes +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes import io.opentelemetry.instrumentation.test.AgentTestRunner import org.elasticsearch.action.admin.cluster.health.ClusterHealthRequest import org.elasticsearch.common.io.FileSystemUtils diff --git a/instrumentation/elasticsearch/elasticsearch-transport-6.0/javaagent/src/test/groovy/Elasticsearch6TransportClientTest.groovy b/instrumentation/elasticsearch/elasticsearch-transport-6.0/javaagent/src/test/groovy/Elasticsearch6TransportClientTest.groovy index 665a594cdfc6..ef350d6de3af 100644 --- a/instrumentation/elasticsearch/elasticsearch-transport-6.0/javaagent/src/test/groovy/Elasticsearch6TransportClientTest.groovy +++ b/instrumentation/elasticsearch/elasticsearch-transport-6.0/javaagent/src/test/groovy/Elasticsearch6TransportClientTest.groovy @@ -7,7 +7,7 @@ import static io.opentelemetry.api.trace.Span.Kind.CLIENT import static io.opentelemetry.instrumentation.test.utils.TraceUtils.runUnderTrace import static org.elasticsearch.cluster.ClusterName.CLUSTER_NAME_SETTING -import io.opentelemetry.api.trace.attributes.SemanticAttributes +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes import io.opentelemetry.instrumentation.test.AgentTestRunner import org.elasticsearch.action.admin.cluster.health.ClusterHealthRequest import org.elasticsearch.client.transport.TransportClient diff --git a/instrumentation/elasticsearch/elasticsearch-transport-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/elasticsearch/transport/ElasticsearchTransportClientTracer.java b/instrumentation/elasticsearch/elasticsearch-transport-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/elasticsearch/transport/ElasticsearchTransportClientTracer.java index 33879e1ae570..a114bfaf575c 100644 --- a/instrumentation/elasticsearch/elasticsearch-transport-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/elasticsearch/transport/ElasticsearchTransportClientTracer.java +++ b/instrumentation/elasticsearch/elasticsearch-transport-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/elasticsearch/transport/ElasticsearchTransportClientTracer.java @@ -6,9 +6,9 @@ package io.opentelemetry.javaagent.instrumentation.elasticsearch.transport; import io.opentelemetry.api.trace.Span; -import io.opentelemetry.api.trace.attributes.SemanticAttributes; import io.opentelemetry.context.Context; import io.opentelemetry.instrumentation.api.tracer.DatabaseClientTracer; +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes; import java.net.InetSocketAddress; import org.elasticsearch.action.Action; diff --git a/instrumentation/executors/javaagent/src/test/java/JavaAsyncChild.java b/instrumentation/executors/javaagent/src/test/java/JavaAsyncChild.java index f6c68cb3386a..578c26c64b46 100644 --- a/instrumentation/executors/javaagent/src/test/java/JavaAsyncChild.java +++ b/instrumentation/executors/javaagent/src/test/java/JavaAsyncChild.java @@ -3,7 +3,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -import io.opentelemetry.api.OpenTelemetry; +import io.opentelemetry.api.GlobalOpenTelemetry; import io.opentelemetry.api.trace.Tracer; import java.util.concurrent.Callable; import java.util.concurrent.CountDownLatch; @@ -11,7 +11,7 @@ import java.util.concurrent.atomic.AtomicBoolean; public class JavaAsyncChild extends ForkJoinTask implements Runnable, Callable { - private static final Tracer tracer = OpenTelemetry.getGlobalTracer("io.opentelemetry.auto"); + private static final Tracer tracer = GlobalOpenTelemetry.getTracer("io.opentelemetry.auto"); private final AtomicBoolean blockThread; private final boolean doTraceableWork; diff --git a/instrumentation/external-annotations/javaagent/src/test/java/io/opentelemetry/test/annotation/SayTracedHello.java b/instrumentation/external-annotations/javaagent/src/test/java/io/opentelemetry/test/annotation/SayTracedHello.java index 9b2993dd47b9..1c23771f4f8c 100644 --- a/instrumentation/external-annotations/javaagent/src/test/java/io/opentelemetry/test/annotation/SayTracedHello.java +++ b/instrumentation/external-annotations/javaagent/src/test/java/io/opentelemetry/test/annotation/SayTracedHello.java @@ -5,14 +5,14 @@ package io.opentelemetry.test.annotation; -import io.opentelemetry.api.OpenTelemetry; +import io.opentelemetry.api.GlobalOpenTelemetry; import io.opentelemetry.api.trace.Span; import io.opentelemetry.api.trace.Tracer; import java.util.concurrent.Callable; public class SayTracedHello { - private static final Tracer TRACER = OpenTelemetry.getGlobalTracer("io.opentelemetry.auto"); + private static final Tracer TRACER = GlobalOpenTelemetry.getTracer("io.opentelemetry.auto"); @com.appoptics.api.ext.LogMethod public String appoptics() { diff --git a/instrumentation/geode-1.4/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/geode/GeodeTracer.java b/instrumentation/geode-1.4/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/geode/GeodeTracer.java index c93615b8f5df..b487205b840a 100644 --- a/instrumentation/geode-1.4/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/geode/GeodeTracer.java +++ b/instrumentation/geode-1.4/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/geode/GeodeTracer.java @@ -8,8 +8,8 @@ import static io.opentelemetry.api.trace.Span.Kind.CLIENT; import io.opentelemetry.api.trace.Span; -import io.opentelemetry.api.trace.attributes.SemanticAttributes; import io.opentelemetry.instrumentation.api.tracer.DatabaseClientTracer; +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes; import java.net.InetSocketAddress; import org.apache.geode.cache.Region; diff --git a/instrumentation/geode-1.4/javaagent/src/test/groovy/PutGetTest.groovy b/instrumentation/geode-1.4/javaagent/src/test/groovy/PutGetTest.groovy index 68fc4c34f9bb..6568f4e62273 100644 --- a/instrumentation/geode-1.4/javaagent/src/test/groovy/PutGetTest.groovy +++ b/instrumentation/geode-1.4/javaagent/src/test/groovy/PutGetTest.groovy @@ -7,7 +7,7 @@ import static io.opentelemetry.api.trace.Span.Kind.CLIENT import static io.opentelemetry.api.trace.Span.Kind.INTERNAL import static io.opentelemetry.instrumentation.test.utils.TraceUtils.runUnderTrace -import io.opentelemetry.api.trace.attributes.SemanticAttributes +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes import io.opentelemetry.instrumentation.test.AgentTestRunner import org.apache.geode.DataSerializable import org.apache.geode.cache.client.ClientCacheFactory diff --git a/instrumentation/google-http-client-1.19/javaagent/src/test/groovy/AbstractGoogleHttpClientTest.groovy b/instrumentation/google-http-client-1.19/javaagent/src/test/groovy/AbstractGoogleHttpClientTest.groovy index 63edecae0c4f..6ba287414263 100644 --- a/instrumentation/google-http-client-1.19/javaagent/src/test/groovy/AbstractGoogleHttpClientTest.groovy +++ b/instrumentation/google-http-client-1.19/javaagent/src/test/groovy/AbstractGoogleHttpClientTest.groovy @@ -9,7 +9,7 @@ import com.google.api.client.http.GenericUrl import com.google.api.client.http.HttpRequest import com.google.api.client.http.HttpResponse import com.google.api.client.http.javanet.NetHttpTransport -import io.opentelemetry.api.trace.attributes.SemanticAttributes +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes import io.opentelemetry.instrumentation.test.base.HttpClientTest import spock.lang.Shared diff --git a/instrumentation/grpc-1.5/library/src/main/java/io/opentelemetry/instrumentation/grpc/v1_5/client/GrpcClientTracer.java b/instrumentation/grpc-1.5/library/src/main/java/io/opentelemetry/instrumentation/grpc/v1_5/client/GrpcClientTracer.java index e2e1feb076f2..3e2b042732d9 100644 --- a/instrumentation/grpc-1.5/library/src/main/java/io/opentelemetry/instrumentation/grpc/v1_5/client/GrpcClientTracer.java +++ b/instrumentation/grpc-1.5/library/src/main/java/io/opentelemetry/instrumentation/grpc/v1_5/client/GrpcClientTracer.java @@ -11,9 +11,9 @@ import io.opentelemetry.api.trace.Span; import io.opentelemetry.api.trace.SpanBuilder; import io.opentelemetry.api.trace.Tracer; -import io.opentelemetry.api.trace.attributes.SemanticAttributes; import io.opentelemetry.instrumentation.api.tracer.RpcClientTracer; import io.opentelemetry.instrumentation.grpc.v1_5.common.GrpcHelper; +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes; public class GrpcClientTracer extends RpcClientTracer { diff --git a/instrumentation/grpc-1.5/library/src/main/java/io/opentelemetry/instrumentation/grpc/v1_5/client/TracingClientInterceptor.java b/instrumentation/grpc-1.5/library/src/main/java/io/opentelemetry/instrumentation/grpc/v1_5/client/TracingClientInterceptor.java index d9e7a1b50c3c..e2d9ac8dc8ed 100644 --- a/instrumentation/grpc-1.5/library/src/main/java/io/opentelemetry/instrumentation/grpc/v1_5/client/TracingClientInterceptor.java +++ b/instrumentation/grpc-1.5/library/src/main/java/io/opentelemetry/instrumentation/grpc/v1_5/client/TracingClientInterceptor.java @@ -18,7 +18,7 @@ import io.grpc.Metadata; import io.grpc.MethodDescriptor; import io.grpc.Status; -import io.opentelemetry.api.OpenTelemetry; +import io.opentelemetry.api.GlobalOpenTelemetry; import io.opentelemetry.api.common.Attributes; import io.opentelemetry.api.trace.Span; import io.opentelemetry.api.trace.Tracer; @@ -97,7 +97,7 @@ static final class TracingClientCall @Override public void start(Listener responseListener, Metadata headers) { - OpenTelemetry.getGlobalPropagators().getTextMapPropagator().inject(context, headers, SETTER); + GlobalOpenTelemetry.getPropagators().getTextMapPropagator().inject(context, headers, SETTER); try (Scope ignored = span.makeCurrent()) { super.start(new TracingClientCallListener<>(responseListener, span, tracer), headers); } catch (Throwable e) { diff --git a/instrumentation/grpc-1.5/library/src/main/java/io/opentelemetry/instrumentation/grpc/v1_5/common/GrpcHelper.java b/instrumentation/grpc-1.5/library/src/main/java/io/opentelemetry/instrumentation/grpc/v1_5/common/GrpcHelper.java index 3a3fe453afa8..ea20ca9619e6 100644 --- a/instrumentation/grpc-1.5/library/src/main/java/io/opentelemetry/instrumentation/grpc/v1_5/common/GrpcHelper.java +++ b/instrumentation/grpc-1.5/library/src/main/java/io/opentelemetry/instrumentation/grpc/v1_5/common/GrpcHelper.java @@ -9,7 +9,7 @@ import io.opentelemetry.api.common.AttributeKey; import io.opentelemetry.api.trace.Span; import io.opentelemetry.api.trace.StatusCode; -import io.opentelemetry.api.trace.attributes.SemanticAttributes; +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes; public final class GrpcHelper { diff --git a/instrumentation/grpc-1.5/library/src/main/java/io/opentelemetry/instrumentation/grpc/v1_5/server/GrpcServerTracer.java b/instrumentation/grpc-1.5/library/src/main/java/io/opentelemetry/instrumentation/grpc/v1_5/server/GrpcServerTracer.java index b1ca58b8d279..664b15992c21 100644 --- a/instrumentation/grpc-1.5/library/src/main/java/io/opentelemetry/instrumentation/grpc/v1_5/server/GrpcServerTracer.java +++ b/instrumentation/grpc-1.5/library/src/main/java/io/opentelemetry/instrumentation/grpc/v1_5/server/GrpcServerTracer.java @@ -12,10 +12,10 @@ import io.opentelemetry.api.trace.Span; import io.opentelemetry.api.trace.SpanBuilder; import io.opentelemetry.api.trace.Tracer; -import io.opentelemetry.api.trace.attributes.SemanticAttributes; import io.opentelemetry.context.propagation.TextMapPropagator.Getter; import io.opentelemetry.instrumentation.api.tracer.RpcServerTracer; import io.opentelemetry.instrumentation.grpc.v1_5.common.GrpcHelper; +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes; public class GrpcServerTracer extends RpcServerTracer { diff --git a/instrumentation/grpc-1.5/library/src/main/java/io/opentelemetry/instrumentation/grpc/v1_5/server/TracingServerInterceptor.java b/instrumentation/grpc-1.5/library/src/main/java/io/opentelemetry/instrumentation/grpc/v1_5/server/TracingServerInterceptor.java index fc41e6b2f432..4c2901c58d86 100644 --- a/instrumentation/grpc-1.5/library/src/main/java/io/opentelemetry/instrumentation/grpc/v1_5/server/TracingServerInterceptor.java +++ b/instrumentation/grpc-1.5/library/src/main/java/io/opentelemetry/instrumentation/grpc/v1_5/server/TracingServerInterceptor.java @@ -17,10 +17,10 @@ import io.opentelemetry.api.common.Attributes; import io.opentelemetry.api.trace.Span; import io.opentelemetry.api.trace.Tracer; -import io.opentelemetry.api.trace.attributes.SemanticAttributes; import io.opentelemetry.context.Context; import io.opentelemetry.context.Scope; import io.opentelemetry.instrumentation.grpc.v1_5.common.GrpcHelper; +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes; import java.net.InetSocketAddress; import java.net.SocketAddress; import java.util.concurrent.atomic.AtomicLong; diff --git a/instrumentation/grpc-1.5/testing/src/main/groovy/io/opentelemetry/instrumentation/grpc/v1_5/AbstractGrpcStreamingTest.groovy b/instrumentation/grpc-1.5/testing/src/main/groovy/io/opentelemetry/instrumentation/grpc/v1_5/AbstractGrpcStreamingTest.groovy index 0500a129e0d7..4ff34284d3e1 100644 --- a/instrumentation/grpc-1.5/testing/src/main/groovy/io/opentelemetry/instrumentation/grpc/v1_5/AbstractGrpcStreamingTest.groovy +++ b/instrumentation/grpc-1.5/testing/src/main/groovy/io/opentelemetry/instrumentation/grpc/v1_5/AbstractGrpcStreamingTest.groovy @@ -16,7 +16,7 @@ import io.grpc.ManagedChannelBuilder import io.grpc.Server import io.grpc.ServerBuilder import io.grpc.stub.StreamObserver -import io.opentelemetry.api.trace.attributes.SemanticAttributes +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes import io.opentelemetry.instrumentation.test.InstrumentationSpecification import io.opentelemetry.instrumentation.test.utils.PortUtils import java.util.concurrent.CopyOnWriteArrayList diff --git a/instrumentation/grpc-1.5/testing/src/main/groovy/io/opentelemetry/instrumentation/grpc/v1_5/AbstractGrpcTest.groovy b/instrumentation/grpc-1.5/testing/src/main/groovy/io/opentelemetry/instrumentation/grpc/v1_5/AbstractGrpcTest.groovy index 5c1c37df6971..3e72020c9bb0 100644 --- a/instrumentation/grpc-1.5/testing/src/main/groovy/io/opentelemetry/instrumentation/grpc/v1_5/AbstractGrpcTest.groovy +++ b/instrumentation/grpc-1.5/testing/src/main/groovy/io/opentelemetry/instrumentation/grpc/v1_5/AbstractGrpcTest.groovy @@ -32,7 +32,7 @@ import io.grpc.Status import io.grpc.StatusRuntimeException import io.grpc.stub.StreamObserver import io.opentelemetry.api.trace.StatusCode -import io.opentelemetry.api.trace.attributes.SemanticAttributes +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes import io.opentelemetry.instrumentation.test.InstrumentationSpecification import io.opentelemetry.instrumentation.test.utils.PortUtils import java.util.concurrent.CountDownLatch diff --git a/instrumentation/hibernate/hibernate-3.3/javaagent/src/test/groovy/CriteriaTest.groovy b/instrumentation/hibernate/hibernate-3.3/javaagent/src/test/groovy/CriteriaTest.groovy index 5c7cb5f37b8c..2c2afba44521 100644 --- a/instrumentation/hibernate/hibernate-3.3/javaagent/src/test/groovy/CriteriaTest.groovy +++ b/instrumentation/hibernate/hibernate-3.3/javaagent/src/test/groovy/CriteriaTest.groovy @@ -6,7 +6,7 @@ import static io.opentelemetry.api.trace.Span.Kind.CLIENT import static io.opentelemetry.api.trace.Span.Kind.INTERNAL -import io.opentelemetry.api.trace.attributes.SemanticAttributes +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes import org.hibernate.Criteria import org.hibernate.Session import org.hibernate.criterion.Order diff --git a/instrumentation/hibernate/hibernate-3.3/javaagent/src/test/groovy/QueryTest.groovy b/instrumentation/hibernate/hibernate-3.3/javaagent/src/test/groovy/QueryTest.groovy index cd2fd526d223..106cd8799873 100644 --- a/instrumentation/hibernate/hibernate-3.3/javaagent/src/test/groovy/QueryTest.groovy +++ b/instrumentation/hibernate/hibernate-3.3/javaagent/src/test/groovy/QueryTest.groovy @@ -6,7 +6,7 @@ import static io.opentelemetry.api.trace.Span.Kind.CLIENT import static io.opentelemetry.api.trace.Span.Kind.INTERNAL -import io.opentelemetry.api.trace.attributes.SemanticAttributes +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes import org.hibernate.Query import org.hibernate.Session diff --git a/instrumentation/hibernate/hibernate-3.3/javaagent/src/test/groovy/SessionTest.groovy b/instrumentation/hibernate/hibernate-3.3/javaagent/src/test/groovy/SessionTest.groovy index f79a7a1d0949..23137830dcb0 100644 --- a/instrumentation/hibernate/hibernate-3.3/javaagent/src/test/groovy/SessionTest.groovy +++ b/instrumentation/hibernate/hibernate-3.3/javaagent/src/test/groovy/SessionTest.groovy @@ -7,7 +7,7 @@ import static io.opentelemetry.api.trace.Span.Kind.CLIENT import static io.opentelemetry.api.trace.Span.Kind.INTERNAL import static io.opentelemetry.instrumentation.test.utils.TraceUtils.runUnderTrace -import io.opentelemetry.api.trace.attributes.SemanticAttributes +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes import org.hibernate.LockMode import org.hibernate.MappingException import org.hibernate.Query diff --git a/instrumentation/hibernate/hibernate-4.0/javaagent/src/test/groovy/CriteriaTest.groovy b/instrumentation/hibernate/hibernate-4.0/javaagent/src/test/groovy/CriteriaTest.groovy index 5c7cb5f37b8c..2c2afba44521 100644 --- a/instrumentation/hibernate/hibernate-4.0/javaagent/src/test/groovy/CriteriaTest.groovy +++ b/instrumentation/hibernate/hibernate-4.0/javaagent/src/test/groovy/CriteriaTest.groovy @@ -6,7 +6,7 @@ import static io.opentelemetry.api.trace.Span.Kind.CLIENT import static io.opentelemetry.api.trace.Span.Kind.INTERNAL -import io.opentelemetry.api.trace.attributes.SemanticAttributes +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes import org.hibernate.Criteria import org.hibernate.Session import org.hibernate.criterion.Order diff --git a/instrumentation/hibernate/hibernate-4.0/javaagent/src/test/groovy/QueryTest.groovy b/instrumentation/hibernate/hibernate-4.0/javaagent/src/test/groovy/QueryTest.groovy index a17d83809adf..b602388bffc5 100644 --- a/instrumentation/hibernate/hibernate-4.0/javaagent/src/test/groovy/QueryTest.groovy +++ b/instrumentation/hibernate/hibernate-4.0/javaagent/src/test/groovy/QueryTest.groovy @@ -6,7 +6,7 @@ import static io.opentelemetry.api.trace.Span.Kind.CLIENT import static io.opentelemetry.api.trace.Span.Kind.INTERNAL -import io.opentelemetry.api.trace.attributes.SemanticAttributes +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes import org.hibernate.Query import org.hibernate.Session diff --git a/instrumentation/hibernate/hibernate-4.0/javaagent/src/test/groovy/SessionTest.groovy b/instrumentation/hibernate/hibernate-4.0/javaagent/src/test/groovy/SessionTest.groovy index 43a8643a159b..5116c154e3bc 100644 --- a/instrumentation/hibernate/hibernate-4.0/javaagent/src/test/groovy/SessionTest.groovy +++ b/instrumentation/hibernate/hibernate-4.0/javaagent/src/test/groovy/SessionTest.groovy @@ -7,7 +7,7 @@ import static io.opentelemetry.api.trace.Span.Kind.CLIENT import static io.opentelemetry.api.trace.Span.Kind.INTERNAL import static io.opentelemetry.instrumentation.test.utils.TraceUtils.runUnderTrace -import io.opentelemetry.api.trace.attributes.SemanticAttributes +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes import org.hibernate.LockMode import org.hibernate.MappingException import org.hibernate.Query diff --git a/instrumentation/hibernate/hibernate-4.3/javaagent/src/test/groovy/ProcedureCallTest.groovy b/instrumentation/hibernate/hibernate-4.3/javaagent/src/test/groovy/ProcedureCallTest.groovy index 4762f0ad368a..67524dde1e80 100644 --- a/instrumentation/hibernate/hibernate-4.3/javaagent/src/test/groovy/ProcedureCallTest.groovy +++ b/instrumentation/hibernate/hibernate-4.3/javaagent/src/test/groovy/ProcedureCallTest.groovy @@ -6,7 +6,7 @@ import static io.opentelemetry.api.trace.Span.Kind.CLIENT import static io.opentelemetry.api.trace.Span.Kind.INTERNAL -import io.opentelemetry.api.trace.attributes.SemanticAttributes +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes import io.opentelemetry.instrumentation.test.AgentTestRunner import java.sql.Connection import java.sql.DriverManager diff --git a/instrumentation/hibernate/hibernate-4.3/javaagent/src/test/groovy/SpringJpaTest.groovy b/instrumentation/hibernate/hibernate-4.3/javaagent/src/test/groovy/SpringJpaTest.groovy index 0bee9d99a68f..2f3052d2364c 100644 --- a/instrumentation/hibernate/hibernate-4.3/javaagent/src/test/groovy/SpringJpaTest.groovy +++ b/instrumentation/hibernate/hibernate-4.3/javaagent/src/test/groovy/SpringJpaTest.groovy @@ -5,7 +5,7 @@ import static io.opentelemetry.api.trace.Span.Kind.CLIENT -import io.opentelemetry.api.trace.attributes.SemanticAttributes +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes import io.opentelemetry.instrumentation.test.AgentTestRunner import org.springframework.context.annotation.AnnotationConfigApplicationContext import spock.lang.Shared diff --git a/instrumentation/http-url-connection/javaagent/src/test/groovy/HttpUrlConnectionTest.groovy b/instrumentation/http-url-connection/javaagent/src/test/groovy/HttpUrlConnectionTest.groovy index f86b18647286..4a9e87b43bae 100644 --- a/instrumentation/http-url-connection/javaagent/src/test/groovy/HttpUrlConnectionTest.groovy +++ b/instrumentation/http-url-connection/javaagent/src/test/groovy/HttpUrlConnectionTest.groovy @@ -7,7 +7,7 @@ import static io.opentelemetry.api.trace.Span.Kind.CLIENT import static io.opentelemetry.instrumentation.test.utils.TraceUtils.runUnderTrace import io.opentelemetry.api.trace.Span -import io.opentelemetry.api.trace.attributes.SemanticAttributes +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes import io.opentelemetry.instrumentation.test.base.HttpClientTest import spock.lang.Ignore import spock.lang.Requires diff --git a/instrumentation/http-url-connection/javaagent/src/test/groovy/UrlConnectionTest.groovy b/instrumentation/http-url-connection/javaagent/src/test/groovy/UrlConnectionTest.groovy index 447523f23f14..7e510583060e 100644 --- a/instrumentation/http-url-connection/javaagent/src/test/groovy/UrlConnectionTest.groovy +++ b/instrumentation/http-url-connection/javaagent/src/test/groovy/UrlConnectionTest.groovy @@ -8,7 +8,7 @@ import static io.opentelemetry.instrumentation.test.utils.PortUtils.UNUSABLE_POR import static io.opentelemetry.instrumentation.test.utils.TraceUtils.runUnderTrace import io.opentelemetry.api.trace.Span -import io.opentelemetry.api.trace.attributes.SemanticAttributes +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes import io.opentelemetry.instrumentation.test.AgentTestRunner class UrlConnectionTest extends AgentTestRunner { diff --git a/instrumentation/instrumentation.gradle b/instrumentation/instrumentation.gradle index 9fec935cbdae..b03842f26e35 100644 --- a/instrumentation/instrumentation.gradle +++ b/instrumentation/instrumentation.gradle @@ -71,6 +71,7 @@ shadowJar { // relocate OpenTelemetry API usage relocate "io.opentelemetry.api", "io.opentelemetry.javaagent.shaded.io.opentelemetry.api" + relocate "io.opentelemetry.semconv", "io.opentelemetry.javaagent.shaded.io.opentelemetry.semconv" relocate "io.opentelemetry.spi", "io.opentelemetry.javaagent.shaded.io.opentelemetry.spi" relocate "io.opentelemetry.context", "io.opentelemetry.javaagent.shaded.io.opentelemetry.context" diff --git a/instrumentation/java-httpclient/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/httpclient/JdkHttpClientTracer.java b/instrumentation/java-httpclient/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/httpclient/JdkHttpClientTracer.java index 1ba032374a86..f2a267de736f 100644 --- a/instrumentation/java-httpclient/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/httpclient/JdkHttpClientTracer.java +++ b/instrumentation/java-httpclient/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/httpclient/JdkHttpClientTracer.java @@ -5,12 +5,12 @@ package io.opentelemetry.javaagent.instrumentation.httpclient; -import io.opentelemetry.api.OpenTelemetry; +import io.opentelemetry.api.GlobalOpenTelemetry; import io.opentelemetry.api.trace.Span; -import io.opentelemetry.api.trace.attributes.SemanticAttributes; import io.opentelemetry.context.Context; import io.opentelemetry.context.propagation.TextMapPropagator.Setter; import io.opentelemetry.instrumentation.api.tracer.HttpClientTracer; +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes; import java.net.URI; import java.net.http.HttpClient.Version; import java.net.http.HttpHeaders; @@ -87,7 +87,7 @@ protected Throwable unwrapThrowable(Throwable throwable) { public HttpHeaders inject(HttpHeaders original) { Map> headerMap = new HashMap<>(); - OpenTelemetry.getGlobalPropagators() + GlobalOpenTelemetry.getPropagators() .getTextMapPropagator() .inject( Context.current(), diff --git a/instrumentation/java-httpclient/javaagent/src/test/groovy/JdkHttpClientTest.groovy b/instrumentation/java-httpclient/javaagent/src/test/groovy/JdkHttpClientTest.groovy index 72f3a1b8ef5b..fe159832da3d 100644 --- a/instrumentation/java-httpclient/javaagent/src/test/groovy/JdkHttpClientTest.groovy +++ b/instrumentation/java-httpclient/javaagent/src/test/groovy/JdkHttpClientTest.groovy @@ -5,7 +5,7 @@ import static io.opentelemetry.api.trace.Span.Kind.CLIENT -import io.opentelemetry.api.trace.attributes.SemanticAttributes +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes import io.opentelemetry.instrumentation.test.base.HttpClientTest import java.net.http.HttpClient import java.net.http.HttpRequest diff --git a/instrumentation/jaxrs-client/jaxrs-client-2.0/jaxrs-client-2.0-common/javaagent/src/test/groovy/JaxRsClientTest.groovy b/instrumentation/jaxrs-client/jaxrs-client-2.0/jaxrs-client-2.0-common/javaagent/src/test/groovy/JaxRsClientTest.groovy index b7acfbb32b6f..2cc20c920240 100644 --- a/instrumentation/jaxrs-client/jaxrs-client-2.0/jaxrs-client-2.0-common/javaagent/src/test/groovy/JaxRsClientTest.groovy +++ b/instrumentation/jaxrs-client/jaxrs-client-2.0/jaxrs-client-2.0-common/javaagent/src/test/groovy/JaxRsClientTest.groovy @@ -5,7 +5,7 @@ import static io.opentelemetry.api.trace.Span.Kind.CLIENT -import io.opentelemetry.api.trace.attributes.SemanticAttributes +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes import io.opentelemetry.instrumentation.test.base.HttpClientTest import java.util.concurrent.TimeUnit import javax.ws.rs.client.Client diff --git a/instrumentation/jaxrs/jaxrs-2.0/jaxrs-2.0-testing/src/main/groovy/JaxRsHttpServerTest.groovy b/instrumentation/jaxrs/jaxrs-2.0/jaxrs-2.0-testing/src/main/groovy/JaxRsHttpServerTest.groovy index fa646a88be4c..9c449289e8a4 100644 --- a/instrumentation/jaxrs/jaxrs-2.0/jaxrs-2.0-testing/src/main/groovy/JaxRsHttpServerTest.groovy +++ b/instrumentation/jaxrs/jaxrs-2.0/jaxrs-2.0-testing/src/main/groovy/JaxRsHttpServerTest.groovy @@ -11,7 +11,7 @@ import static io.opentelemetry.instrumentation.test.base.HttpServerTest.ServerEn import static java.util.concurrent.TimeUnit.SECONDS import static org.junit.Assume.assumeTrue -import io.opentelemetry.api.trace.attributes.SemanticAttributes +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes import io.opentelemetry.instrumentation.test.asserts.TraceAssert import io.opentelemetry.instrumentation.test.base.HttpServerTest import io.opentelemetry.sdk.trace.data.SpanData diff --git a/instrumentation/jdbc/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jdbc/JdbcConnectionUrlParser.java b/instrumentation/jdbc/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jdbc/JdbcConnectionUrlParser.java index c3ba118291a2..21072c252e43 100644 --- a/instrumentation/jdbc/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jdbc/JdbcConnectionUrlParser.java +++ b/instrumentation/jdbc/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jdbc/JdbcConnectionUrlParser.java @@ -8,7 +8,7 @@ import static io.opentelemetry.javaagent.instrumentation.jdbc.DbInfo.DEFAULT; import static java.util.regex.Pattern.CASE_INSENSITIVE; -import io.opentelemetry.api.trace.attributes.SemanticAttributes.DbSystemValues; +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes.DbSystemValues; import java.io.UnsupportedEncodingException; import java.net.URI; import java.net.URLDecoder; diff --git a/instrumentation/jdbc/javaagent/src/test/groovy/JdbcInstrumentationTest.groovy b/instrumentation/jdbc/javaagent/src/test/groovy/JdbcInstrumentationTest.groovy index 47af57635f34..9c6a537d06f1 100644 --- a/instrumentation/jdbc/javaagent/src/test/groovy/JdbcInstrumentationTest.groovy +++ b/instrumentation/jdbc/javaagent/src/test/groovy/JdbcInstrumentationTest.groovy @@ -10,7 +10,7 @@ import static io.opentelemetry.instrumentation.test.utils.TraceUtils.runUnderTra import com.mchange.v2.c3p0.ComboPooledDataSource import com.zaxxer.hikari.HikariConfig import com.zaxxer.hikari.HikariDataSource -import io.opentelemetry.api.trace.attributes.SemanticAttributes +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes import io.opentelemetry.instrumentation.test.AgentTestRunner import java.sql.CallableStatement import java.sql.Connection diff --git a/instrumentation/jedis/jedis-1.4/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jedis/v1_4/JedisClientTracer.java b/instrumentation/jedis/jedis-1.4/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jedis/v1_4/JedisClientTracer.java index ebb09bac2278..ae2764dc4e4b 100644 --- a/instrumentation/jedis/jedis-1.4/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jedis/v1_4/JedisClientTracer.java +++ b/instrumentation/jedis/jedis-1.4/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jedis/v1_4/JedisClientTracer.java @@ -5,10 +5,10 @@ package io.opentelemetry.javaagent.instrumentation.jedis.v1_4; -import io.opentelemetry.api.trace.attributes.SemanticAttributes.DbSystemValues; import io.opentelemetry.instrumentation.api.tracer.DatabaseClientTracer; import io.opentelemetry.javaagent.instrumentation.api.db.RedisCommandNormalizer; import io.opentelemetry.javaagent.instrumentation.jedis.v1_4.JedisClientTracer.CommandWithArgs; +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes.DbSystemValues; import java.net.InetSocketAddress; import java.util.Arrays; import java.util.List; diff --git a/instrumentation/jedis/jedis-1.4/javaagent/src/test/groovy/JedisClientTest.groovy b/instrumentation/jedis/jedis-1.4/javaagent/src/test/groovy/JedisClientTest.groovy index 82b3cd5eeb06..fcb483a248e3 100644 --- a/instrumentation/jedis/jedis-1.4/javaagent/src/test/groovy/JedisClientTest.groovy +++ b/instrumentation/jedis/jedis-1.4/javaagent/src/test/groovy/JedisClientTest.groovy @@ -5,7 +5,7 @@ import static io.opentelemetry.api.trace.Span.Kind.CLIENT -import io.opentelemetry.api.trace.attributes.SemanticAttributes +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes import io.opentelemetry.instrumentation.test.AgentTestRunner import io.opentelemetry.instrumentation.test.utils.PortUtils import redis.clients.jedis.Jedis diff --git a/instrumentation/jedis/jedis-3.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jedis/v3_0/JedisClientTracer.java b/instrumentation/jedis/jedis-3.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jedis/v3_0/JedisClientTracer.java index 1574f6a2f3d6..43048c6f3839 100644 --- a/instrumentation/jedis/jedis-3.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jedis/v3_0/JedisClientTracer.java +++ b/instrumentation/jedis/jedis-3.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jedis/v3_0/JedisClientTracer.java @@ -5,10 +5,10 @@ package io.opentelemetry.javaagent.instrumentation.jedis.v3_0; -import io.opentelemetry.api.trace.attributes.SemanticAttributes.DbSystemValues; import io.opentelemetry.instrumentation.api.tracer.DatabaseClientTracer; import io.opentelemetry.javaagent.instrumentation.api.db.RedisCommandNormalizer; import io.opentelemetry.javaagent.instrumentation.jedis.v3_0.JedisClientTracer.CommandWithArgs; +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes.DbSystemValues; import java.net.InetSocketAddress; import java.nio.charset.StandardCharsets; import java.util.Arrays; diff --git a/instrumentation/jedis/jedis-3.0/javaagent/src/test/groovy/Jedis30ClientTest.groovy b/instrumentation/jedis/jedis-3.0/javaagent/src/test/groovy/Jedis30ClientTest.groovy index 732668b9796e..6a9b56f9ceb7 100644 --- a/instrumentation/jedis/jedis-3.0/javaagent/src/test/groovy/Jedis30ClientTest.groovy +++ b/instrumentation/jedis/jedis-3.0/javaagent/src/test/groovy/Jedis30ClientTest.groovy @@ -5,7 +5,7 @@ import static io.opentelemetry.api.trace.Span.Kind.CLIENT -import io.opentelemetry.api.trace.attributes.SemanticAttributes +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes import io.opentelemetry.instrumentation.test.AgentTestRunner import io.opentelemetry.instrumentation.test.utils.PortUtils import redis.clients.jedis.Jedis diff --git a/instrumentation/jetty-8.0/javaagent/src/test/groovy/JavaAsyncChild.java b/instrumentation/jetty-8.0/javaagent/src/test/groovy/JavaAsyncChild.java index f6c68cb3386a..578c26c64b46 100644 --- a/instrumentation/jetty-8.0/javaagent/src/test/groovy/JavaAsyncChild.java +++ b/instrumentation/jetty-8.0/javaagent/src/test/groovy/JavaAsyncChild.java @@ -3,7 +3,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -import io.opentelemetry.api.OpenTelemetry; +import io.opentelemetry.api.GlobalOpenTelemetry; import io.opentelemetry.api.trace.Tracer; import java.util.concurrent.Callable; import java.util.concurrent.CountDownLatch; @@ -11,7 +11,7 @@ import java.util.concurrent.atomic.AtomicBoolean; public class JavaAsyncChild extends ForkJoinTask implements Runnable, Callable { - private static final Tracer tracer = OpenTelemetry.getGlobalTracer("io.opentelemetry.auto"); + private static final Tracer tracer = GlobalOpenTelemetry.getTracer("io.opentelemetry.auto"); private final AtomicBoolean blockThread; private final boolean doTraceableWork; diff --git a/instrumentation/jms-1.1/javaagent/src/jms2Test/groovy/Jms2Test.groovy b/instrumentation/jms-1.1/javaagent/src/jms2Test/groovy/Jms2Test.groovy index 101f6205b2f6..4dca6858bd98 100644 --- a/instrumentation/jms-1.1/javaagent/src/jms2Test/groovy/Jms2Test.groovy +++ b/instrumentation/jms-1.1/javaagent/src/jms2Test/groovy/Jms2Test.groovy @@ -7,7 +7,7 @@ import static io.opentelemetry.api.trace.Span.Kind.CONSUMER import static io.opentelemetry.api.trace.Span.Kind.PRODUCER import com.google.common.io.Files -import io.opentelemetry.api.trace.attributes.SemanticAttributes +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes import io.opentelemetry.instrumentation.test.AgentTestRunner import io.opentelemetry.instrumentation.test.asserts.TraceAssert import io.opentelemetry.sdk.trace.data.SpanData diff --git a/instrumentation/jms-1.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jms/JmsTracer.java b/instrumentation/jms-1.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jms/JmsTracer.java index 2af177ab8946..392d8123016b 100644 --- a/instrumentation/jms-1.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jms/JmsTracer.java +++ b/instrumentation/jms-1.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jms/JmsTracer.java @@ -5,20 +5,19 @@ package io.opentelemetry.javaagent.instrumentation.jms; -import static io.opentelemetry.api.OpenTelemetry.getGlobalPropagators; import static io.opentelemetry.api.trace.Span.Kind.CONSUMER; import static io.opentelemetry.api.trace.Span.Kind.PRODUCER; import static io.opentelemetry.javaagent.instrumentation.jms.MessageExtractAdapter.GETTER; import static io.opentelemetry.javaagent.instrumentation.jms.MessageInjectAdapter.SETTER; -import io.opentelemetry.api.OpenTelemetry; +import io.opentelemetry.api.GlobalOpenTelemetry; import io.opentelemetry.api.trace.Span; import io.opentelemetry.api.trace.SpanBuilder; import io.opentelemetry.api.trace.SpanContext; -import io.opentelemetry.api.trace.attributes.SemanticAttributes; import io.opentelemetry.context.Context; import io.opentelemetry.context.Scope; import io.opentelemetry.instrumentation.api.tracer.BaseTracer; +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes; import java.util.concurrent.TimeUnit; import javax.jms.Destination; import javax.jms.JMSException; @@ -55,7 +54,9 @@ public Span startConsumerSpan( // TODO use BaseTracer.extract() which has context leak detection // (and fix the context leak that it is currently detecting when running Jms2Test) Context context = - getGlobalPropagators().getTextMapPropagator().extract(Context.root(), message, GETTER); + GlobalOpenTelemetry.getPropagators() + .getTextMapPropagator() + .extract(Context.root(), message, GETTER); SpanContext spanContext = Span.fromContext(context).getSpanContext(); if (spanContext.isValid()) { spanBuilder.setParent(context); @@ -75,7 +76,7 @@ public Span startProducerSpan(MessageDestination destination, Message message) { public Scope startProducerScope(Span span, Message message) { Context context = Context.current().with(span); - OpenTelemetry.getGlobalPropagators().getTextMapPropagator().inject(context, message, SETTER); + GlobalOpenTelemetry.getPropagators().getTextMapPropagator().inject(context, message, SETTER); return context.makeCurrent(); } diff --git a/instrumentation/jms-1.1/javaagent/src/test/groovy/Jms1Test.groovy b/instrumentation/jms-1.1/javaagent/src/test/groovy/Jms1Test.groovy index a2116e7eb132..eedc931e601e 100644 --- a/instrumentation/jms-1.1/javaagent/src/test/groovy/Jms1Test.groovy +++ b/instrumentation/jms-1.1/javaagent/src/test/groovy/Jms1Test.groovy @@ -6,7 +6,7 @@ import static io.opentelemetry.api.trace.Span.Kind.CONSUMER import static io.opentelemetry.api.trace.Span.Kind.PRODUCER -import io.opentelemetry.api.trace.attributes.SemanticAttributes +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes import io.opentelemetry.instrumentation.test.AgentTestRunner import io.opentelemetry.instrumentation.test.asserts.TraceAssert import io.opentelemetry.sdk.trace.data.SpanData diff --git a/instrumentation/jsp-2.3/javaagent/src/test/groovy/JspInstrumentationBasicTests.groovy b/instrumentation/jsp-2.3/javaagent/src/test/groovy/JspInstrumentationBasicTests.groovy index e996a4f40d92..e7a16b46452d 100644 --- a/instrumentation/jsp-2.3/javaagent/src/test/groovy/JspInstrumentationBasicTests.groovy +++ b/instrumentation/jsp-2.3/javaagent/src/test/groovy/JspInstrumentationBasicTests.groovy @@ -6,7 +6,7 @@ import static io.opentelemetry.api.trace.Span.Kind.SERVER import com.google.common.io.Files -import io.opentelemetry.api.trace.attributes.SemanticAttributes +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes import io.opentelemetry.instrumentation.test.AgentTestRunner import io.opentelemetry.instrumentation.test.utils.OkHttpUtils import io.opentelemetry.instrumentation.test.utils.PortUtils diff --git a/instrumentation/jsp-2.3/javaagent/src/test/groovy/JspInstrumentationForwardTests.groovy b/instrumentation/jsp-2.3/javaagent/src/test/groovy/JspInstrumentationForwardTests.groovy index fc43136b53fc..789e09306805 100644 --- a/instrumentation/jsp-2.3/javaagent/src/test/groovy/JspInstrumentationForwardTests.groovy +++ b/instrumentation/jsp-2.3/javaagent/src/test/groovy/JspInstrumentationForwardTests.groovy @@ -6,7 +6,7 @@ import static io.opentelemetry.api.trace.Span.Kind.SERVER import com.google.common.io.Files -import io.opentelemetry.api.trace.attributes.SemanticAttributes +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes import io.opentelemetry.instrumentation.test.AgentTestRunner import io.opentelemetry.instrumentation.test.utils.OkHttpUtils import io.opentelemetry.instrumentation.test.utils.PortUtils diff --git a/instrumentation/kafka-clients-0.11/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/kafkaclients/KafkaConsumerTracer.java b/instrumentation/kafka-clients-0.11/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/kafkaclients/KafkaConsumerTracer.java index 417fd63c6a0b..8562c9fa3c61 100644 --- a/instrumentation/kafka-clients-0.11/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/kafkaclients/KafkaConsumerTracer.java +++ b/instrumentation/kafka-clients-0.11/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/kafkaclients/KafkaConsumerTracer.java @@ -9,9 +9,9 @@ import static io.opentelemetry.javaagent.instrumentation.kafkaclients.TextMapExtractAdapter.GETTER; import io.opentelemetry.api.trace.Span; -import io.opentelemetry.api.trace.attributes.SemanticAttributes; import io.opentelemetry.context.Context; import io.opentelemetry.instrumentation.api.tracer.BaseTracer; +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes; import java.util.concurrent.TimeUnit; import org.apache.kafka.clients.consumer.ConsumerRecord; import org.apache.kafka.common.record.TimestampType; diff --git a/instrumentation/kafka-clients-0.11/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/kafkaclients/KafkaProducerTracer.java b/instrumentation/kafka-clients-0.11/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/kafkaclients/KafkaProducerTracer.java index 38daa8975ea2..35115a073a52 100644 --- a/instrumentation/kafka-clients-0.11/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/kafkaclients/KafkaProducerTracer.java +++ b/instrumentation/kafka-clients-0.11/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/kafkaclients/KafkaProducerTracer.java @@ -8,8 +8,8 @@ import static io.opentelemetry.api.trace.Span.Kind.PRODUCER; import io.opentelemetry.api.trace.Span; -import io.opentelemetry.api.trace.attributes.SemanticAttributes; import io.opentelemetry.instrumentation.api.tracer.BaseTracer; +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes; import org.apache.kafka.clients.ApiVersions; import org.apache.kafka.clients.producer.ProducerRecord; import org.apache.kafka.common.record.RecordBatch; diff --git a/instrumentation/kafka-clients-0.11/javaagent/src/test/groovy/KafkaClientPropagationDisabledTest.groovy b/instrumentation/kafka-clients-0.11/javaagent/src/test/groovy/KafkaClientPropagationDisabledTest.groovy index 96c515ae004a..cb3356c6b15e 100644 --- a/instrumentation/kafka-clients-0.11/javaagent/src/test/groovy/KafkaClientPropagationDisabledTest.groovy +++ b/instrumentation/kafka-clients-0.11/javaagent/src/test/groovy/KafkaClientPropagationDisabledTest.groovy @@ -6,7 +6,7 @@ import static io.opentelemetry.api.trace.Span.Kind.CONSUMER import static io.opentelemetry.api.trace.Span.Kind.PRODUCER -import io.opentelemetry.api.trace.attributes.SemanticAttributes +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes import java.util.concurrent.LinkedBlockingQueue import java.util.concurrent.TimeUnit import org.apache.kafka.clients.consumer.ConsumerConfig diff --git a/instrumentation/kafka-clients-0.11/javaagent/src/test/groovy/KafkaClientPropagationEnabledTest.groovy b/instrumentation/kafka-clients-0.11/javaagent/src/test/groovy/KafkaClientPropagationEnabledTest.groovy index 828a2bdb34ce..47c5a009f2fd 100644 --- a/instrumentation/kafka-clients-0.11/javaagent/src/test/groovy/KafkaClientPropagationEnabledTest.groovy +++ b/instrumentation/kafka-clients-0.11/javaagent/src/test/groovy/KafkaClientPropagationEnabledTest.groovy @@ -8,7 +8,7 @@ import static io.opentelemetry.api.trace.Span.Kind.PRODUCER import static io.opentelemetry.instrumentation.test.utils.TraceUtils.basicSpan import static io.opentelemetry.instrumentation.test.utils.TraceUtils.runUnderTrace -import io.opentelemetry.api.trace.attributes.SemanticAttributes +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes import java.util.concurrent.LinkedBlockingQueue import java.util.concurrent.TimeUnit import org.apache.kafka.clients.consumer.ConsumerConfig diff --git a/instrumentation/kafka-streams-0.11/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/kafkastreams/KafkaStreamsTracer.java b/instrumentation/kafka-streams-0.11/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/kafkastreams/KafkaStreamsTracer.java index de7137e09576..490a1a408f4a 100644 --- a/instrumentation/kafka-streams-0.11/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/kafkastreams/KafkaStreamsTracer.java +++ b/instrumentation/kafka-streams-0.11/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/kafkastreams/KafkaStreamsTracer.java @@ -9,9 +9,9 @@ import io.opentelemetry.api.trace.Span; import io.opentelemetry.api.trace.Span.Kind; -import io.opentelemetry.api.trace.attributes.SemanticAttributes; import io.opentelemetry.instrumentation.api.config.Config; import io.opentelemetry.instrumentation.api.tracer.BaseTracer; +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes; import org.apache.kafka.streams.processor.internals.StampedRecord; public class KafkaStreamsTracer extends BaseTracer { diff --git a/instrumentation/kafka-streams-0.11/javaagent/src/test/groovy/KafkaStreamsTest.groovy b/instrumentation/kafka-streams-0.11/javaagent/src/test/groovy/KafkaStreamsTest.groovy index ef0de586403b..515d67beb644 100644 --- a/instrumentation/kafka-streams-0.11/javaagent/src/test/groovy/KafkaStreamsTest.groovy +++ b/instrumentation/kafka-streams-0.11/javaagent/src/test/groovy/KafkaStreamsTest.groovy @@ -7,7 +7,7 @@ import static io.opentelemetry.api.trace.Span.Kind.CONSUMER import static io.opentelemetry.api.trace.Span.Kind.PRODUCER import io.opentelemetry.api.trace.Span -import io.opentelemetry.api.trace.attributes.SemanticAttributes +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes import io.opentelemetry.api.trace.propagation.W3CTraceContextPropagator import io.opentelemetry.context.Context import io.opentelemetry.context.propagation.TextMapPropagator diff --git a/instrumentation/kubernetes-client-7.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/kubernetesclient/KubernetesClientTracer.java b/instrumentation/kubernetes-client-7.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/kubernetesclient/KubernetesClientTracer.java index 84008a531181..993a5247e08b 100644 --- a/instrumentation/kubernetes-client-7.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/kubernetesclient/KubernetesClientTracer.java +++ b/instrumentation/kubernetes-client-7.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/kubernetesclient/KubernetesClientTracer.java @@ -7,7 +7,7 @@ import static io.opentelemetry.api.trace.Span.Kind.CLIENT; -import io.opentelemetry.api.OpenTelemetry; +import io.opentelemetry.api.GlobalOpenTelemetry; import io.opentelemetry.api.trace.Span; import io.opentelemetry.context.Context; import io.opentelemetry.context.propagation.TextMapPropagator.Setter; @@ -38,7 +38,7 @@ public Context startSpan(Context parentContext, Request request) { .setAttribute("name", digest.getResourceMeta().getName()) .startSpan(); Context context = parentContext.with(span).with(CONTEXT_CLIENT_SPAN_KEY, span); - OpenTelemetry.getGlobalPropagators() + GlobalOpenTelemetry.getPropagators() .getTextMapPropagator() .inject(context, request, getSetter()); return context; diff --git a/instrumentation/lettuce/lettuce-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/lettuce/v4_0/LettuceAbstractDatabaseClientTracer.java b/instrumentation/lettuce/lettuce-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/lettuce/v4_0/LettuceAbstractDatabaseClientTracer.java index 77d3fa2fd436..8076c0a87f68 100644 --- a/instrumentation/lettuce/lettuce-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/lettuce/v4_0/LettuceAbstractDatabaseClientTracer.java +++ b/instrumentation/lettuce/lettuce-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/lettuce/v4_0/LettuceAbstractDatabaseClientTracer.java @@ -7,9 +7,9 @@ import com.lambdaworks.redis.RedisURI; import io.opentelemetry.api.trace.Span; -import io.opentelemetry.api.trace.attributes.SemanticAttributes; -import io.opentelemetry.api.trace.attributes.SemanticAttributes.DbSystemValues; import io.opentelemetry.instrumentation.api.tracer.DatabaseClientTracer; +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes; +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes.DbSystemValues; import java.net.InetSocketAddress; public abstract class LettuceAbstractDatabaseClientTracer diff --git a/instrumentation/lettuce/lettuce-4.0/javaagent/src/test/groovy/LettuceAsyncClientTest.groovy b/instrumentation/lettuce/lettuce-4.0/javaagent/src/test/groovy/LettuceAsyncClientTest.groovy index 1cf811a75ccf..f1003917c641 100644 --- a/instrumentation/lettuce/lettuce-4.0/javaagent/src/test/groovy/LettuceAsyncClientTest.groovy +++ b/instrumentation/lettuce/lettuce-4.0/javaagent/src/test/groovy/LettuceAsyncClientTest.groovy @@ -15,7 +15,7 @@ import com.lambdaworks.redis.api.async.RedisAsyncCommands import com.lambdaworks.redis.api.sync.RedisCommands import com.lambdaworks.redis.codec.Utf8StringCodec import com.lambdaworks.redis.protocol.AsyncCommand -import io.opentelemetry.api.trace.attributes.SemanticAttributes +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes import io.opentelemetry.instrumentation.test.AgentTestRunner import io.opentelemetry.instrumentation.test.utils.PortUtils import java.util.concurrent.CancellationException diff --git a/instrumentation/lettuce/lettuce-4.0/javaagent/src/test/groovy/LettuceSyncClientTest.groovy b/instrumentation/lettuce/lettuce-4.0/javaagent/src/test/groovy/LettuceSyncClientTest.groovy index 39a08eb8ddeb..23e1b5fb3111 100644 --- a/instrumentation/lettuce/lettuce-4.0/javaagent/src/test/groovy/LettuceSyncClientTest.groovy +++ b/instrumentation/lettuce/lettuce-4.0/javaagent/src/test/groovy/LettuceSyncClientTest.groovy @@ -10,7 +10,7 @@ import com.lambdaworks.redis.RedisClient import com.lambdaworks.redis.RedisConnectionException import com.lambdaworks.redis.api.StatefulConnection import com.lambdaworks.redis.api.sync.RedisCommands -import io.opentelemetry.api.trace.attributes.SemanticAttributes +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes import io.opentelemetry.instrumentation.test.AgentTestRunner import io.opentelemetry.instrumentation.test.utils.PortUtils import redis.embedded.RedisServer diff --git a/instrumentation/lettuce/lettuce-5.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/lettuce/v5_0/LettuceAbstractDatabaseClientTracer.java b/instrumentation/lettuce/lettuce-5.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/lettuce/v5_0/LettuceAbstractDatabaseClientTracer.java index 62c47fee6a5a..ffe0c3718a34 100644 --- a/instrumentation/lettuce/lettuce-5.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/lettuce/v5_0/LettuceAbstractDatabaseClientTracer.java +++ b/instrumentation/lettuce/lettuce-5.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/lettuce/v5_0/LettuceAbstractDatabaseClientTracer.java @@ -7,9 +7,9 @@ import io.lettuce.core.RedisURI; import io.opentelemetry.api.trace.Span; -import io.opentelemetry.api.trace.attributes.SemanticAttributes; -import io.opentelemetry.api.trace.attributes.SemanticAttributes.DbSystemValues; import io.opentelemetry.instrumentation.api.tracer.DatabaseClientTracer; +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes; +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes.DbSystemValues; import java.net.InetSocketAddress; public abstract class LettuceAbstractDatabaseClientTracer diff --git a/instrumentation/lettuce/lettuce-5.0/javaagent/src/test/groovy/LettuceAsyncClientTest.groovy b/instrumentation/lettuce/lettuce-5.0/javaagent/src/test/groovy/LettuceAsyncClientTest.groovy index 1c8db08dd857..3adecf9c93d9 100644 --- a/instrumentation/lettuce/lettuce-5.0/javaagent/src/test/groovy/LettuceAsyncClientTest.groovy +++ b/instrumentation/lettuce/lettuce-5.0/javaagent/src/test/groovy/LettuceAsyncClientTest.groovy @@ -15,7 +15,7 @@ import io.lettuce.core.api.async.RedisAsyncCommands import io.lettuce.core.api.sync.RedisCommands import io.lettuce.core.codec.StringCodec import io.lettuce.core.protocol.AsyncCommand -import io.opentelemetry.api.trace.attributes.SemanticAttributes +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes import io.opentelemetry.instrumentation.test.AgentTestRunner import io.opentelemetry.instrumentation.test.utils.PortUtils import java.util.concurrent.CancellationException diff --git a/instrumentation/lettuce/lettuce-5.0/javaagent/src/test/groovy/LettuceReactiveClientTest.groovy b/instrumentation/lettuce/lettuce-5.0/javaagent/src/test/groovy/LettuceReactiveClientTest.groovy index 897c758e647a..7fdd1f2e1db3 100644 --- a/instrumentation/lettuce/lettuce-5.0/javaagent/src/test/groovy/LettuceReactiveClientTest.groovy +++ b/instrumentation/lettuce/lettuce-5.0/javaagent/src/test/groovy/LettuceReactiveClientTest.groovy @@ -11,7 +11,7 @@ import io.lettuce.core.RedisClient import io.lettuce.core.api.StatefulConnection import io.lettuce.core.api.reactive.RedisReactiveCommands import io.lettuce.core.api.sync.RedisCommands -import io.opentelemetry.api.trace.attributes.SemanticAttributes +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes import io.opentelemetry.instrumentation.test.AgentTestRunner import io.opentelemetry.instrumentation.test.utils.PortUtils import java.util.function.Consumer diff --git a/instrumentation/lettuce/lettuce-5.0/javaagent/src/test/groovy/LettuceSyncClientTest.groovy b/instrumentation/lettuce/lettuce-5.0/javaagent/src/test/groovy/LettuceSyncClientTest.groovy index be36bd58fa08..8fc0f1203d35 100644 --- a/instrumentation/lettuce/lettuce-5.0/javaagent/src/test/groovy/LettuceSyncClientTest.groovy +++ b/instrumentation/lettuce/lettuce-5.0/javaagent/src/test/groovy/LettuceSyncClientTest.groovy @@ -10,7 +10,7 @@ import io.lettuce.core.RedisClient import io.lettuce.core.RedisConnectionException import io.lettuce.core.api.StatefulConnection import io.lettuce.core.api.sync.RedisCommands -import io.opentelemetry.api.trace.attributes.SemanticAttributes +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes import io.opentelemetry.instrumentation.test.AgentTestRunner import io.opentelemetry.instrumentation.test.utils.PortUtils import java.util.concurrent.CompletionException diff --git a/instrumentation/lettuce/lettuce-5.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/lettuce/v5_1/OpenTelemetryTracing.java b/instrumentation/lettuce/lettuce-5.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/lettuce/v5_1/OpenTelemetryTracing.java index d73d703e7b1d..5598ed0ac0fd 100644 --- a/instrumentation/lettuce/lettuce-5.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/lettuce/v5_1/OpenTelemetryTracing.java +++ b/instrumentation/lettuce/lettuce-5.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/lettuce/v5_1/OpenTelemetryTracing.java @@ -12,17 +12,17 @@ import io.lettuce.core.tracing.Tracer; import io.lettuce.core.tracing.TracerProvider; import io.lettuce.core.tracing.Tracing; -import io.opentelemetry.api.OpenTelemetry; +import io.opentelemetry.api.GlobalOpenTelemetry; import io.opentelemetry.api.trace.Span; import io.opentelemetry.api.trace.Span.Kind; import io.opentelemetry.api.trace.SpanBuilder; import io.opentelemetry.api.trace.StatusCode; -import io.opentelemetry.api.trace.attributes.SemanticAttributes; -import io.opentelemetry.api.trace.attributes.SemanticAttributes.DbSystemValues; import io.opentelemetry.context.Context; import io.opentelemetry.instrumentation.api.tracer.utils.NetPeerUtils; import io.opentelemetry.instrumentation.api.tracer.utils.NetPeerUtils.SpanAttributeSetter; import io.opentelemetry.javaagent.instrumentation.api.db.RedisCommandNormalizer; +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes; +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes.DbSystemValues; import java.net.InetSocketAddress; import java.net.SocketAddress; import java.time.Instant; @@ -34,7 +34,7 @@ public enum OpenTelemetryTracing implements Tracing { INSTANCE; private static final io.opentelemetry.api.trace.Tracer TRACER = - OpenTelemetry.getGlobalTracer("io.opentelemetry.auto.lettuce-5.1"); + GlobalOpenTelemetry.getTracer("io.opentelemetry.auto.lettuce-5.1"); public static io.opentelemetry.api.trace.Tracer tracer() { return TRACER; diff --git a/instrumentation/lettuce/lettuce-5.1/javaagent/src/test/groovy/io/opentelemetry/javaagent/instrumentation/lettuce/v5_1/LettuceAsyncClientTest.groovy b/instrumentation/lettuce/lettuce-5.1/javaagent/src/test/groovy/io/opentelemetry/javaagent/instrumentation/lettuce/v5_1/LettuceAsyncClientTest.groovy index 77da33e0d381..4ec7506169b7 100644 --- a/instrumentation/lettuce/lettuce-5.1/javaagent/src/test/groovy/io/opentelemetry/javaagent/instrumentation/lettuce/v5_1/LettuceAsyncClientTest.groovy +++ b/instrumentation/lettuce/lettuce-5.1/javaagent/src/test/groovy/io/opentelemetry/javaagent/instrumentation/lettuce/v5_1/LettuceAsyncClientTest.groovy @@ -16,7 +16,7 @@ import io.lettuce.core.api.StatefulConnection import io.lettuce.core.api.async.RedisAsyncCommands import io.lettuce.core.api.sync.RedisCommands import io.lettuce.core.codec.StringCodec -import io.opentelemetry.api.trace.attributes.SemanticAttributes +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes import io.opentelemetry.instrumentation.test.AgentTestRunner import io.opentelemetry.instrumentation.test.utils.PortUtils import java.util.concurrent.ExecutionException diff --git a/instrumentation/lettuce/lettuce-5.1/javaagent/src/test/groovy/io/opentelemetry/javaagent/instrumentation/lettuce/v5_1/LettuceReactiveClientTest.groovy b/instrumentation/lettuce/lettuce-5.1/javaagent/src/test/groovy/io/opentelemetry/javaagent/instrumentation/lettuce/v5_1/LettuceReactiveClientTest.groovy index 15b592c025cf..82f35a8be875 100644 --- a/instrumentation/lettuce/lettuce-5.1/javaagent/src/test/groovy/io/opentelemetry/javaagent/instrumentation/lettuce/v5_1/LettuceReactiveClientTest.groovy +++ b/instrumentation/lettuce/lettuce-5.1/javaagent/src/test/groovy/io/opentelemetry/javaagent/instrumentation/lettuce/v5_1/LettuceReactiveClientTest.groovy @@ -13,7 +13,7 @@ import io.lettuce.core.RedisClient import io.lettuce.core.api.StatefulConnection import io.lettuce.core.api.reactive.RedisReactiveCommands import io.lettuce.core.api.sync.RedisCommands -import io.opentelemetry.api.trace.attributes.SemanticAttributes +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes import io.opentelemetry.instrumentation.test.AgentTestRunner import io.opentelemetry.instrumentation.test.utils.PortUtils import java.util.function.Consumer diff --git a/instrumentation/lettuce/lettuce-5.1/javaagent/src/test/groovy/io/opentelemetry/javaagent/instrumentation/lettuce/v5_1/LettuceSyncClientAuthTest.groovy b/instrumentation/lettuce/lettuce-5.1/javaagent/src/test/groovy/io/opentelemetry/javaagent/instrumentation/lettuce/v5_1/LettuceSyncClientAuthTest.groovy index 197a0bc8da1b..21dc55a6f465 100644 --- a/instrumentation/lettuce/lettuce-5.1/javaagent/src/test/groovy/io/opentelemetry/javaagent/instrumentation/lettuce/v5_1/LettuceSyncClientAuthTest.groovy +++ b/instrumentation/lettuce/lettuce-5.1/javaagent/src/test/groovy/io/opentelemetry/javaagent/instrumentation/lettuce/v5_1/LettuceSyncClientAuthTest.groovy @@ -9,7 +9,7 @@ import static io.opentelemetry.api.trace.Span.Kind.CLIENT import io.lettuce.core.ClientOptions import io.lettuce.core.RedisClient -import io.opentelemetry.api.trace.attributes.SemanticAttributes +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes import io.opentelemetry.instrumentation.test.AgentTestRunner import io.opentelemetry.instrumentation.test.utils.PortUtils import redis.embedded.RedisServer diff --git a/instrumentation/lettuce/lettuce-5.1/javaagent/src/test/groovy/io/opentelemetry/javaagent/instrumentation/lettuce/v5_1/LettuceSyncClientTest.groovy b/instrumentation/lettuce/lettuce-5.1/javaagent/src/test/groovy/io/opentelemetry/javaagent/instrumentation/lettuce/v5_1/LettuceSyncClientTest.groovy index 68444efe6c45..dcc8866ea82a 100644 --- a/instrumentation/lettuce/lettuce-5.1/javaagent/src/test/groovy/io/opentelemetry/javaagent/instrumentation/lettuce/v5_1/LettuceSyncClientTest.groovy +++ b/instrumentation/lettuce/lettuce-5.1/javaagent/src/test/groovy/io/opentelemetry/javaagent/instrumentation/lettuce/v5_1/LettuceSyncClientTest.groovy @@ -14,7 +14,7 @@ import io.lettuce.core.RedisConnectionException import io.lettuce.core.ScriptOutputType import io.lettuce.core.api.StatefulConnection import io.lettuce.core.api.sync.RedisCommands -import io.opentelemetry.api.trace.attributes.SemanticAttributes +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes import io.opentelemetry.instrumentation.test.AgentTestRunner import io.opentelemetry.instrumentation.test.utils.PortUtils import redis.embedded.RedisServer diff --git a/instrumentation/mongo/mongo-async-3.3/javaagent/src/test/groovy/MongoAsyncClientTest.groovy b/instrumentation/mongo/mongo-async-3.3/javaagent/src/test/groovy/MongoAsyncClientTest.groovy index 3c67e56e2955..5f60bc436beb 100644 --- a/instrumentation/mongo/mongo-async-3.3/javaagent/src/test/groovy/MongoAsyncClientTest.groovy +++ b/instrumentation/mongo/mongo-async-3.3/javaagent/src/test/groovy/MongoAsyncClientTest.groovy @@ -16,7 +16,7 @@ import com.mongodb.async.client.MongoDatabase import com.mongodb.client.result.DeleteResult import com.mongodb.client.result.UpdateResult import com.mongodb.connection.ClusterSettings -import io.opentelemetry.api.trace.attributes.SemanticAttributes +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes import io.opentelemetry.instrumentation.test.asserts.TraceAssert import io.opentelemetry.sdk.trace.data.SpanData import java.util.concurrent.CompletableFuture diff --git a/instrumentation/mongo/mongo-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/mongo/MongoClientTracer.java b/instrumentation/mongo/mongo-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/mongo/MongoClientTracer.java index 9690e1fe6cc7..169e4e0ea75b 100644 --- a/instrumentation/mongo/mongo-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/mongo/MongoClientTracer.java +++ b/instrumentation/mongo/mongo-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/mongo/MongoClientTracer.java @@ -11,9 +11,9 @@ import com.mongodb.connection.ConnectionDescription; import com.mongodb.event.CommandStartedEvent; import io.opentelemetry.api.trace.Span; -import io.opentelemetry.api.trace.attributes.SemanticAttributes; -import io.opentelemetry.api.trace.attributes.SemanticAttributes.DbSystemValues; import io.opentelemetry.instrumentation.api.tracer.DatabaseClientTracer; +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes; +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes.DbSystemValues; import java.io.StringWriter; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; diff --git a/instrumentation/mongo/mongo-testing/src/main/groovy/MongoBaseTest.groovy b/instrumentation/mongo/mongo-testing/src/main/groovy/MongoBaseTest.groovy index 5eac22ad3720..8a6a435cfb7d 100644 --- a/instrumentation/mongo/mongo-testing/src/main/groovy/MongoBaseTest.groovy +++ b/instrumentation/mongo/mongo-testing/src/main/groovy/MongoBaseTest.groovy @@ -13,7 +13,7 @@ import de.flapdoodle.embed.mongo.config.MongodConfigBuilder import de.flapdoodle.embed.mongo.config.Net import de.flapdoodle.embed.mongo.distribution.Version import de.flapdoodle.embed.process.runtime.Network -import io.opentelemetry.api.trace.attributes.SemanticAttributes +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes import io.opentelemetry.instrumentation.test.AgentTestRunner import io.opentelemetry.instrumentation.test.asserts.TraceAssert import io.opentelemetry.instrumentation.test.utils.PortUtils diff --git a/instrumentation/netty/netty-3.8/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/netty/v3_8/client/NettyHttpClientTracer.java b/instrumentation/netty/netty-3.8/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/netty/v3_8/client/NettyHttpClientTracer.java index 7605794a2296..a0d47c3df174 100644 --- a/instrumentation/netty/netty-3.8/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/netty/v3_8/client/NettyHttpClientTracer.java +++ b/instrumentation/netty/netty-3.8/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/netty/v3_8/client/NettyHttpClientTracer.java @@ -9,7 +9,7 @@ import static io.opentelemetry.javaagent.instrumentation.netty.v3_8.client.NettyResponseInjectAdapter.SETTER; import static org.jboss.netty.handler.codec.http.HttpHeaders.Names.HOST; -import io.opentelemetry.api.OpenTelemetry; +import io.opentelemetry.api.GlobalOpenTelemetry; import io.opentelemetry.api.trace.Span; import io.opentelemetry.context.Context; import io.opentelemetry.context.propagation.TextMapPropagator; @@ -43,7 +43,7 @@ public Context startSpan(Context parentContext, ChannelHandlerContext ctx, HttpR NetPeerUtils.INSTANCE.setNetPeer(span, (InetSocketAddress) ctx.getChannel().getRemoteAddress()); Context context = withClientSpan(parentContext, span); - OpenTelemetry.getGlobalPropagators() + GlobalOpenTelemetry.getPropagators() .getTextMapPropagator() .inject(context, request.headers(), SETTER); return context; diff --git a/instrumentation/netty/netty-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/netty/v4_0/client/NettyHttpClientTracer.java b/instrumentation/netty/netty-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/netty/v4_0/client/NettyHttpClientTracer.java index b6894e4f70f1..71d3c35833ab 100644 --- a/instrumentation/netty/netty-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/netty/v4_0/client/NettyHttpClientTracer.java +++ b/instrumentation/netty/netty-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/netty/v4_0/client/NettyHttpClientTracer.java @@ -13,7 +13,7 @@ import io.netty.handler.codec.http.HttpHeaders; import io.netty.handler.codec.http.HttpRequest; import io.netty.handler.codec.http.HttpResponse; -import io.opentelemetry.api.OpenTelemetry; +import io.opentelemetry.api.GlobalOpenTelemetry; import io.opentelemetry.api.trace.Span; import io.opentelemetry.context.Context; import io.opentelemetry.context.propagation.TextMapPropagator; @@ -43,7 +43,7 @@ public Context startSpan(Context parentContext, ChannelHandlerContext ctx, HttpR NetPeerUtils.INSTANCE.setNetPeer(span, (InetSocketAddress) ctx.channel().remoteAddress()); Context context = withClientSpan(parentContext, span); - OpenTelemetry.getGlobalPropagators() + GlobalOpenTelemetry.getPropagators() .getTextMapPropagator() .inject(context, request.headers(), SETTER); return context; diff --git a/instrumentation/netty/netty-4.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/netty/v4_1/client/NettyHttpClientTracer.java b/instrumentation/netty/netty-4.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/netty/v4_1/client/NettyHttpClientTracer.java index 2da347ade36d..6ac8193100b6 100644 --- a/instrumentation/netty/netty-4.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/netty/v4_1/client/NettyHttpClientTracer.java +++ b/instrumentation/netty/netty-4.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/netty/v4_1/client/NettyHttpClientTracer.java @@ -13,7 +13,7 @@ import io.netty.handler.codec.http.HttpHeaders; import io.netty.handler.codec.http.HttpRequest; import io.netty.handler.codec.http.HttpResponse; -import io.opentelemetry.api.OpenTelemetry; +import io.opentelemetry.api.GlobalOpenTelemetry; import io.opentelemetry.api.trace.Span; import io.opentelemetry.context.Context; import io.opentelemetry.context.propagation.TextMapPropagator; @@ -43,7 +43,7 @@ public Context startSpan(Context parentContext, ChannelHandlerContext ctx, HttpR NetPeerUtils.INSTANCE.setNetPeer(span, (InetSocketAddress) ctx.channel().remoteAddress()); Context context = withClientSpan(parentContext, span); - OpenTelemetry.getGlobalPropagators() + GlobalOpenTelemetry.getPropagators() .getTextMapPropagator() .inject(context, request.headers(), SETTER); return context; diff --git a/instrumentation/opentelemetry-api-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/ApplicationOpenTelemetry.java b/instrumentation/opentelemetry-api-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/ApplicationOpenTelemetry.java index b5527f870d7f..ac4617da5616 100644 --- a/instrumentation/opentelemetry-api-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/ApplicationOpenTelemetry.java +++ b/instrumentation/opentelemetry-api-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/ApplicationOpenTelemetry.java @@ -6,11 +6,9 @@ package io.opentelemetry.javaagent.instrumentation.opentelemetryapi; import application.io.opentelemetry.api.OpenTelemetry; -import application.io.opentelemetry.api.metrics.MeterProvider; import application.io.opentelemetry.api.trace.TracerProvider; import application.io.opentelemetry.context.propagation.ContextPropagators; import io.opentelemetry.javaagent.instrumentation.opentelemetryapi.context.propagation.ApplicationContextPropagators; -import io.opentelemetry.javaagent.instrumentation.opentelemetryapi.metrics.ApplicationMeterProvider; import io.opentelemetry.javaagent.instrumentation.opentelemetryapi.trace.ApplicationTracerProvider; public class ApplicationOpenTelemetry implements OpenTelemetry { @@ -18,35 +16,23 @@ public class ApplicationOpenTelemetry implements OpenTelemetry { public static final OpenTelemetry INSTANCE = new ApplicationOpenTelemetry(); private final TracerProvider applicationTracerProvider; - private final MeterProvider applicationMeterProvider; private final ContextPropagators applicationContextPropagators; private ApplicationOpenTelemetry() { io.opentelemetry.api.OpenTelemetry agentOpenTelemetry = - io.opentelemetry.api.OpenTelemetry.get(); + io.opentelemetry.api.GlobalOpenTelemetry.get(); applicationTracerProvider = new ApplicationTracerProvider(agentOpenTelemetry.getTracerProvider()); - applicationMeterProvider = new ApplicationMeterProvider(agentOpenTelemetry.getMeterProvider()); applicationContextPropagators = new ApplicationContextPropagators(agentOpenTelemetry.getPropagators()); } - @Override - public void setPropagators(ContextPropagators contextPropagators) { - // TODO(anuraaga): Implement this somehow. - } - @Override public TracerProvider getTracerProvider() { return applicationTracerProvider; } - @Override - public MeterProvider getMeterProvider() { - return applicationMeterProvider; - } - @Override public ContextPropagators getPropagators() { return applicationContextPropagators; diff --git a/instrumentation/opentelemetry-api-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/trace/ApplicationTracerProvider.java b/instrumentation/opentelemetry-api-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/trace/ApplicationTracerProvider.java index fc1dccb9fe2a..3c05153e209a 100644 --- a/instrumentation/opentelemetry-api-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/trace/ApplicationTracerProvider.java +++ b/instrumentation/opentelemetry-api-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/trace/ApplicationTracerProvider.java @@ -7,6 +7,7 @@ import application.io.opentelemetry.api.trace.Tracer; import application.io.opentelemetry.api.trace.TracerProvider; +import io.opentelemetry.api.GlobalOpenTelemetry; public class ApplicationTracerProvider implements TracerProvider { @@ -25,7 +26,6 @@ public Tracer get(String instrumentationName) { @Override public Tracer get(String instrumentationName, String instrumentationVersion) { return new ApplicationTracer( - io.opentelemetry.api.OpenTelemetry.getGlobalTracerProvider() - .get(instrumentationName, instrumentationVersion)); + GlobalOpenTelemetry.getTracerProvider().get(instrumentationName, instrumentationVersion)); } } diff --git a/instrumentation/opentelemetry-api-1.0/javaagent/src/test/groovy/ContextBridgeTest.groovy b/instrumentation/opentelemetry-api-1.0/javaagent/src/test/groovy/ContextBridgeTest.groovy index 7b69e30f4934..40b4f9afa140 100644 --- a/instrumentation/opentelemetry-api-1.0/javaagent/src/test/groovy/ContextBridgeTest.groovy +++ b/instrumentation/opentelemetry-api-1.0/javaagent/src/test/groovy/ContextBridgeTest.groovy @@ -3,7 +3,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -import io.opentelemetry.api.OpenTelemetry +import io.opentelemetry.api.GlobalOpenTelemetry import io.opentelemetry.api.baggage.Baggage import io.opentelemetry.api.trace.Span import io.opentelemetry.context.Context @@ -66,7 +66,7 @@ class ContextBridgeTest extends AgentTestRunner { def "agent propagates application's span"() { when: - def tracer = OpenTelemetry.getGlobalTracer("test") + def tracer = GlobalOpenTelemetry.getTracer("test") def testSpan = tracer.spanBuilder("test").startSpan() testSpan.makeCurrent().withCloseable { diff --git a/instrumentation/opentelemetry-api-1.0/javaagent/src/test/groovy/ContextTest.groovy b/instrumentation/opentelemetry-api-1.0/javaagent/src/test/groovy/ContextTest.groovy index 9a75462a54a0..32d2da6df5c6 100644 --- a/instrumentation/opentelemetry-api-1.0/javaagent/src/test/groovy/ContextTest.groovy +++ b/instrumentation/opentelemetry-api-1.0/javaagent/src/test/groovy/ContextTest.groovy @@ -3,7 +3,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -import io.opentelemetry.api.OpenTelemetry +import io.opentelemetry.api.GlobalOpenTelemetry import io.opentelemetry.api.trace.Span import io.opentelemetry.context.Context import io.opentelemetry.instrumentation.test.AgentTestRunner @@ -20,7 +20,7 @@ class ContextTest extends AgentTestRunner { def "Span.current() should return span"() { when: - def tracer = OpenTelemetry.getGlobalTracer("test") + def tracer = GlobalOpenTelemetry.getTracer("test") def testSpan = tracer.spanBuilder("test").startSpan() def scope = testSpan.makeCurrent() def span = Span.current() @@ -40,7 +40,7 @@ class ContextTest extends AgentTestRunner { def "getSpan should return span"() { when: - def tracer = OpenTelemetry.getGlobalTracer("test") + def tracer = GlobalOpenTelemetry.getTracer("test") def testSpan = tracer.spanBuilder("test").startSpan() def scope = testSpan.makeCurrent() def span = Span.fromContext(Context.current()) @@ -60,7 +60,7 @@ class ContextTest extends AgentTestRunner { def "Span.fromContextOrNull should return span"() { when: - def tracer = OpenTelemetry.getGlobalTracer("test") + def tracer = GlobalOpenTelemetry.getTracer("test") def testSpan = tracer.spanBuilder("test").startSpan() def scope = testSpan.makeCurrent() def span = Span.fromContextOrNull(Context.current()) diff --git a/instrumentation/opentelemetry-api-1.0/javaagent/src/test/groovy/TracerTest.groovy b/instrumentation/opentelemetry-api-1.0/javaagent/src/test/groovy/TracerTest.groovy index a364fb550ac5..171f7b64b164 100644 --- a/instrumentation/opentelemetry-api-1.0/javaagent/src/test/groovy/TracerTest.groovy +++ b/instrumentation/opentelemetry-api-1.0/javaagent/src/test/groovy/TracerTest.groovy @@ -6,19 +6,19 @@ import static io.opentelemetry.api.trace.Span.Kind.PRODUCER import static io.opentelemetry.api.trace.StatusCode.ERROR -import io.opentelemetry.api.OpenTelemetry +import io.opentelemetry.api.GlobalOpenTelemetry import io.opentelemetry.api.common.Attributes import io.opentelemetry.api.trace.Span -import io.opentelemetry.api.trace.attributes.SemanticAttributes import io.opentelemetry.context.Context import io.opentelemetry.context.Scope import io.opentelemetry.instrumentation.test.AgentTestRunner +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes class TracerTest extends AgentTestRunner { def "capture span, kind, attributes, and status"() { when: - def tracer = OpenTelemetry.getGlobalTracer("test") + def tracer = GlobalOpenTelemetry.getTracer("test") def testSpan = tracer.spanBuilder("test").setSpanKind(PRODUCER).startSpan() testSpan.setAttribute("string", "1") testSpan.setAttribute("long", 2) @@ -48,7 +48,7 @@ class TracerTest extends AgentTestRunner { def "capture span with implicit parent using Tracer.withSpan()"() { when: - def tracer = OpenTelemetry.getGlobalTracer("test") + def tracer = GlobalOpenTelemetry.getTracer("test") Span parentSpan = tracer.spanBuilder("parent").startSpan() Scope parentScope = Context.current().with(parentSpan).makeCurrent() @@ -79,7 +79,7 @@ class TracerTest extends AgentTestRunner { def "capture span with implicit parent using makeCurrent"() { when: - def tracer = OpenTelemetry.getGlobalTracer("test") + def tracer = GlobalOpenTelemetry.getTracer("test") Span parentSpan = tracer.spanBuilder("parent").startSpan() Scope parentScope = parentSpan.makeCurrent() @@ -110,7 +110,7 @@ class TracerTest extends AgentTestRunner { def "capture span with implicit parent using TracingContextUtils.withSpan and makeCurrent"() { when: - def tracer = OpenTelemetry.getGlobalTracer("test") + def tracer = GlobalOpenTelemetry.getTracer("test") Span parentSpan = tracer.spanBuilder("parent").startSpan() def parentContext = Context.current().with(parentSpan) Scope parentScope = parentContext.makeCurrent() @@ -142,7 +142,7 @@ class TracerTest extends AgentTestRunner { def "capture span with explicit parent"() { when: - def tracer = OpenTelemetry.getGlobalTracer("test") + def tracer = GlobalOpenTelemetry.getTracer("test") def parentSpan = tracer.spanBuilder("parent").startSpan() def context = Context.root().with(parentSpan) def testSpan = tracer.spanBuilder("test").setParent(context).startSpan() @@ -170,7 +170,7 @@ class TracerTest extends AgentTestRunner { def "capture span with explicit no parent"() { when: - def tracer = OpenTelemetry.getGlobalTracer("test") + def tracer = GlobalOpenTelemetry.getTracer("test") def parentSpan = tracer.spanBuilder("parent").startSpan() def parentScope = parentSpan.makeCurrent() def testSpan = tracer.spanBuilder("test").setNoParent().startSpan() @@ -201,7 +201,7 @@ class TracerTest extends AgentTestRunner { def "capture name update"() { when: - def tracer = OpenTelemetry.getGlobalTracer("test") + def tracer = GlobalOpenTelemetry.getTracer("test") def testSpan = tracer.spanBuilder("test").startSpan() testSpan.updateName("test2") testSpan.end() @@ -221,7 +221,7 @@ class TracerTest extends AgentTestRunner { def "capture exception()"() { when: - def tracer = OpenTelemetry.getGlobalTracer("test") + def tracer = GlobalOpenTelemetry.getTracer("test") def testSpan = tracer.spanBuilder("test").startSpan() testSpan.recordException(new IllegalStateException()) testSpan.end() @@ -247,7 +247,7 @@ class TracerTest extends AgentTestRunner { def "capture exception with Attributes()"() { when: - def tracer = OpenTelemetry.getGlobalTracer("test") + def tracer = GlobalOpenTelemetry.getTracer("test") def testSpan = tracer.spanBuilder("test").startSpan() testSpan.recordException( new IllegalStateException(), @@ -276,7 +276,7 @@ class TracerTest extends AgentTestRunner { def "capture name update using TracingContextUtils.getCurrentSpan()"() { when: - def tracer = OpenTelemetry.getGlobalTracer("test") + def tracer = GlobalOpenTelemetry.getTracer("test") def testSpan = tracer.spanBuilder("test").startSpan() def testScope = Context.current().with(testSpan).makeCurrent() Span.current().updateName("test2") @@ -298,7 +298,7 @@ class TracerTest extends AgentTestRunner { def "capture name update using TracingContextUtils.Span.fromContext(Context.current())"() { when: - def tracer = OpenTelemetry.getGlobalTracer("test") + def tracer = GlobalOpenTelemetry.getTracer("test") def testSpan = tracer.spanBuilder("test").startSpan() def testScope = Context.current().with(testSpan).makeCurrent() Span.fromContext(Context.current()).updateName("test2") @@ -321,7 +321,7 @@ class TracerTest extends AgentTestRunner { def "add wrapped span to context"() { when: // Lazy way to get a span context - def tracer = OpenTelemetry.getGlobalTracer("test") + def tracer = GlobalOpenTelemetry.getTracer("test") def testSpan = tracer.spanBuilder("test").setSpanKind(PRODUCER).startSpan() testSpan.end() diff --git a/instrumentation/opentelemetry-api-metrics-1.0/javaagent/opentelemetry-api-metrics-1.0-javaagent.gradle b/instrumentation/opentelemetry-api-metrics-1.0/javaagent/opentelemetry-api-metrics-1.0-javaagent.gradle new file mode 100644 index 000000000000..31fa739adfa4 --- /dev/null +++ b/instrumentation/opentelemetry-api-metrics-1.0/javaagent/opentelemetry-api-metrics-1.0-javaagent.gradle @@ -0,0 +1,26 @@ +apply from: "$rootDir/gradle/instrumentation.gradle" + +dependencies { + // this instrumentation needs to be able to reference both the OpenTelemetry API + // that is shaded in the bootstrap class loader (for sending telemetry to the agent), + // and the OpenTelemetry API that the user brings (in order to capture that telemetry) + // + // since (all) instrumentation already uses OpenTelemetry API for sending telemetry to the agent, + // this instrumentation uses a "temporarily shaded" OpenTelemetry API to represent the + // OpenTelemetry API that the user brings + // + // then later, after the OpenTelemetry API in the bootstrap class loader is shaded, + // the "temporarily shaded" OpenTelemetry API is unshaded, so that it will apply to the + // OpenTelemetry API that the user brings + // + // so in the code "application.io.opentelemetry.*" refers to the (unshaded) OpenTelemetry API that + // the application brings (as those references will be translated during the build to remove the + // "application." prefix) + // + // and in the code "io.opentelemetry.*" refers to the (shaded) OpenTelemetry API that is used by + // the agent (as those references will later be shaded) + compileOnly project(path: ':opentelemetry-api-shaded-for-instrumenting', configuration: 'shadow') + compileOnly deps.opentelemetryApiMetrics + + testImplementation deps.opentelemetrySdkMetrics +} diff --git a/instrumentation/opentelemetry-api-metrics-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/metrics/OpenTelemetryApiMetricsInstrumentationModule.java b/instrumentation/opentelemetry-api-metrics-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/metrics/OpenTelemetryApiMetricsInstrumentationModule.java new file mode 100644 index 000000000000..767aa93afc4a --- /dev/null +++ b/instrumentation/opentelemetry-api-metrics-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/metrics/OpenTelemetryApiMetricsInstrumentationModule.java @@ -0,0 +1,24 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.instrumentation.opentelemetryapi.metrics; + +import com.google.auto.service.AutoService; +import io.opentelemetry.javaagent.tooling.InstrumentationModule; +import io.opentelemetry.javaagent.tooling.TypeInstrumentation; +import java.util.Collections; +import java.util.List; + +@AutoService(InstrumentationModule.class) +public class OpenTelemetryApiMetricsInstrumentationModule extends InstrumentationModule { + public OpenTelemetryApiMetricsInstrumentationModule() { + super("opentelemetry-metrics-api"); + } + + @Override + public List typeInstrumentations() { + return Collections.singletonList(new OpenTelemetryMetricsInstrumentation()); + } +} diff --git a/instrumentation/opentelemetry-api-metrics-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/metrics/OpenTelemetryMetricsInstrumentation.java b/instrumentation/opentelemetry-api-metrics-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/metrics/OpenTelemetryMetricsInstrumentation.java new file mode 100644 index 000000000000..620bc7d9c599 --- /dev/null +++ b/instrumentation/opentelemetry-api-metrics-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/metrics/OpenTelemetryMetricsInstrumentation.java @@ -0,0 +1,50 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.instrumentation.opentelemetryapi.metrics; + +import static net.bytebuddy.matcher.ElementMatchers.isMethod; +import static net.bytebuddy.matcher.ElementMatchers.isStatic; +import static net.bytebuddy.matcher.ElementMatchers.named; +import static net.bytebuddy.matcher.ElementMatchers.takesArguments; + +import io.opentelemetry.javaagent.instrumentation.opentelemetryapi.metrics.bridge.ApplicationMeterProvider; +import io.opentelemetry.javaagent.tooling.TypeInstrumentation; +import java.util.Collections; +import java.util.Map; +import net.bytebuddy.asm.Advice; +import net.bytebuddy.description.method.MethodDescription; +import net.bytebuddy.description.type.TypeDescription; +import net.bytebuddy.matcher.ElementMatcher; + +public class OpenTelemetryMetricsInstrumentation implements TypeInstrumentation { + + @Override + public ElementMatcher typeMatcher() { + return named("application.io.opentelemetry.api.metrics.GlobalMetricsProvider"); + } + + @Override + public Map, String> transformers() { + return Collections.singletonMap( + isMethod().and(isStatic()).and(named("get")).and(takesArguments(0)), + OpenTelemetryMetricsInstrumentation.class.getName() + "$GetGlobalMetricsAdvice"); + } + + public static class GetGlobalMetricsAdvice { + + @Advice.OnMethodEnter(skipOn = Advice.OnDefaultValue.class) + public static Object onEnter() { + return null; + } + + @Advice.OnMethodExit(onThrowable = Throwable.class, suppress = Throwable.class) + public static void methodExit( + @Advice.Return(readOnly = false) + application.io.opentelemetry.api.metrics.MeterProvider metricsProvider) { + metricsProvider = ApplicationMeterProvider.INSTANCE; + } + } +} diff --git a/instrumentation/opentelemetry-api-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/metrics/ApplicationBatchRecorder.java b/instrumentation/opentelemetry-api-metrics-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/metrics/bridge/ApplicationBatchRecorder.java similarity index 99% rename from instrumentation/opentelemetry-api-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/metrics/ApplicationBatchRecorder.java rename to instrumentation/opentelemetry-api-metrics-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/metrics/bridge/ApplicationBatchRecorder.java index d2276d673ada..beb0123aeb39 100644 --- a/instrumentation/opentelemetry-api-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/metrics/ApplicationBatchRecorder.java +++ b/instrumentation/opentelemetry-api-metrics-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/metrics/bridge/ApplicationBatchRecorder.java @@ -3,7 +3,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -package io.opentelemetry.javaagent.instrumentation.opentelemetryapi.metrics; +package io.opentelemetry.javaagent.instrumentation.opentelemetryapi.metrics.bridge; import application.io.opentelemetry.api.metrics.BatchRecorder; import application.io.opentelemetry.api.metrics.DoubleCounter; diff --git a/instrumentation/opentelemetry-api-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/metrics/ApplicationDoubleCounter.java b/instrumentation/opentelemetry-api-metrics-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/metrics/bridge/ApplicationDoubleCounter.java similarity index 96% rename from instrumentation/opentelemetry-api-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/metrics/ApplicationDoubleCounter.java rename to instrumentation/opentelemetry-api-metrics-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/metrics/bridge/ApplicationDoubleCounter.java index a1c99dad516d..0c70de2bf6b1 100644 --- a/instrumentation/opentelemetry-api-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/metrics/ApplicationDoubleCounter.java +++ b/instrumentation/opentelemetry-api-metrics-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/metrics/bridge/ApplicationDoubleCounter.java @@ -3,11 +3,10 @@ * SPDX-License-Identifier: Apache-2.0 */ -package io.opentelemetry.javaagent.instrumentation.opentelemetryapi.metrics; +package io.opentelemetry.javaagent.instrumentation.opentelemetryapi.metrics.bridge; import application.io.opentelemetry.api.common.Labels; import application.io.opentelemetry.api.metrics.DoubleCounter; -import io.opentelemetry.javaagent.instrumentation.opentelemetryapi.LabelBridging; class ApplicationDoubleCounter implements DoubleCounter { diff --git a/instrumentation/opentelemetry-api-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/metrics/ApplicationDoubleSumObserver.java b/instrumentation/opentelemetry-api-metrics-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/metrics/bridge/ApplicationDoubleSumObserver.java similarity index 96% rename from instrumentation/opentelemetry-api-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/metrics/ApplicationDoubleSumObserver.java rename to instrumentation/opentelemetry-api-metrics-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/metrics/bridge/ApplicationDoubleSumObserver.java index 5bf1f8efe637..f036f2b04f2e 100644 --- a/instrumentation/opentelemetry-api-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/metrics/ApplicationDoubleSumObserver.java +++ b/instrumentation/opentelemetry-api-metrics-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/metrics/bridge/ApplicationDoubleSumObserver.java @@ -3,11 +3,10 @@ * SPDX-License-Identifier: Apache-2.0 */ -package io.opentelemetry.javaagent.instrumentation.opentelemetryapi.metrics; +package io.opentelemetry.javaagent.instrumentation.opentelemetryapi.metrics.bridge; import application.io.opentelemetry.api.common.Labels; import application.io.opentelemetry.api.metrics.DoubleSumObserver; -import io.opentelemetry.javaagent.instrumentation.opentelemetryapi.LabelBridging; import java.util.function.Consumer; class ApplicationDoubleSumObserver implements DoubleSumObserver { diff --git a/instrumentation/opentelemetry-api-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/metrics/ApplicationDoubleUpDownCounter.java b/instrumentation/opentelemetry-api-metrics-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/metrics/bridge/ApplicationDoubleUpDownCounter.java similarity index 96% rename from instrumentation/opentelemetry-api-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/metrics/ApplicationDoubleUpDownCounter.java rename to instrumentation/opentelemetry-api-metrics-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/metrics/bridge/ApplicationDoubleUpDownCounter.java index 3077064bbfd6..c5d180b4b7c0 100644 --- a/instrumentation/opentelemetry-api-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/metrics/ApplicationDoubleUpDownCounter.java +++ b/instrumentation/opentelemetry-api-metrics-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/metrics/bridge/ApplicationDoubleUpDownCounter.java @@ -3,11 +3,10 @@ * SPDX-License-Identifier: Apache-2.0 */ -package io.opentelemetry.javaagent.instrumentation.opentelemetryapi.metrics; +package io.opentelemetry.javaagent.instrumentation.opentelemetryapi.metrics.bridge; import application.io.opentelemetry.api.common.Labels; import application.io.opentelemetry.api.metrics.DoubleUpDownCounter; -import io.opentelemetry.javaagent.instrumentation.opentelemetryapi.LabelBridging; class ApplicationDoubleUpDownCounter implements DoubleUpDownCounter { diff --git a/instrumentation/opentelemetry-api-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/metrics/ApplicationDoubleUpDownSumObserver.java b/instrumentation/opentelemetry-api-metrics-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/metrics/bridge/ApplicationDoubleUpDownSumObserver.java similarity index 96% rename from instrumentation/opentelemetry-api-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/metrics/ApplicationDoubleUpDownSumObserver.java rename to instrumentation/opentelemetry-api-metrics-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/metrics/bridge/ApplicationDoubleUpDownSumObserver.java index 49b390d4f6d9..1e2af12ca546 100644 --- a/instrumentation/opentelemetry-api-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/metrics/ApplicationDoubleUpDownSumObserver.java +++ b/instrumentation/opentelemetry-api-metrics-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/metrics/bridge/ApplicationDoubleUpDownSumObserver.java @@ -3,11 +3,10 @@ * SPDX-License-Identifier: Apache-2.0 */ -package io.opentelemetry.javaagent.instrumentation.opentelemetryapi.metrics; +package io.opentelemetry.javaagent.instrumentation.opentelemetryapi.metrics.bridge; import application.io.opentelemetry.api.common.Labels; import application.io.opentelemetry.api.metrics.DoubleUpDownSumObserver; -import io.opentelemetry.javaagent.instrumentation.opentelemetryapi.LabelBridging; import java.util.function.Consumer; class ApplicationDoubleUpDownSumObserver implements DoubleUpDownSumObserver { diff --git a/instrumentation/opentelemetry-api-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/metrics/ApplicationDoubleValueObserver.java b/instrumentation/opentelemetry-api-metrics-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/metrics/bridge/ApplicationDoubleValueObserver.java similarity index 96% rename from instrumentation/opentelemetry-api-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/metrics/ApplicationDoubleValueObserver.java rename to instrumentation/opentelemetry-api-metrics-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/metrics/bridge/ApplicationDoubleValueObserver.java index 3df7d36f1882..3dc22c61eab5 100644 --- a/instrumentation/opentelemetry-api-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/metrics/ApplicationDoubleValueObserver.java +++ b/instrumentation/opentelemetry-api-metrics-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/metrics/bridge/ApplicationDoubleValueObserver.java @@ -3,11 +3,10 @@ * SPDX-License-Identifier: Apache-2.0 */ -package io.opentelemetry.javaagent.instrumentation.opentelemetryapi.metrics; +package io.opentelemetry.javaagent.instrumentation.opentelemetryapi.metrics.bridge; import application.io.opentelemetry.api.common.Labels; import application.io.opentelemetry.api.metrics.DoubleValueObserver; -import io.opentelemetry.javaagent.instrumentation.opentelemetryapi.LabelBridging; import java.util.function.Consumer; class ApplicationDoubleValueObserver implements DoubleValueObserver { diff --git a/instrumentation/opentelemetry-api-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/metrics/ApplicationDoubleValueRecorder.java b/instrumentation/opentelemetry-api-metrics-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/metrics/bridge/ApplicationDoubleValueRecorder.java similarity index 96% rename from instrumentation/opentelemetry-api-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/metrics/ApplicationDoubleValueRecorder.java rename to instrumentation/opentelemetry-api-metrics-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/metrics/bridge/ApplicationDoubleValueRecorder.java index cea1963f9c41..908653b5b260 100644 --- a/instrumentation/opentelemetry-api-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/metrics/ApplicationDoubleValueRecorder.java +++ b/instrumentation/opentelemetry-api-metrics-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/metrics/bridge/ApplicationDoubleValueRecorder.java @@ -3,11 +3,10 @@ * SPDX-License-Identifier: Apache-2.0 */ -package io.opentelemetry.javaagent.instrumentation.opentelemetryapi.metrics; +package io.opentelemetry.javaagent.instrumentation.opentelemetryapi.metrics.bridge; import application.io.opentelemetry.api.common.Labels; import application.io.opentelemetry.api.metrics.DoubleValueRecorder; -import io.opentelemetry.javaagent.instrumentation.opentelemetryapi.LabelBridging; class ApplicationDoubleValueRecorder implements DoubleValueRecorder { diff --git a/instrumentation/opentelemetry-api-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/metrics/ApplicationLongCounter.java b/instrumentation/opentelemetry-api-metrics-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/metrics/bridge/ApplicationLongCounter.java similarity index 95% rename from instrumentation/opentelemetry-api-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/metrics/ApplicationLongCounter.java rename to instrumentation/opentelemetry-api-metrics-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/metrics/bridge/ApplicationLongCounter.java index 045fa2b88a10..c848840642cf 100644 --- a/instrumentation/opentelemetry-api-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/metrics/ApplicationLongCounter.java +++ b/instrumentation/opentelemetry-api-metrics-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/metrics/bridge/ApplicationLongCounter.java @@ -3,11 +3,10 @@ * SPDX-License-Identifier: Apache-2.0 */ -package io.opentelemetry.javaagent.instrumentation.opentelemetryapi.metrics; +package io.opentelemetry.javaagent.instrumentation.opentelemetryapi.metrics.bridge; import application.io.opentelemetry.api.common.Labels; import application.io.opentelemetry.api.metrics.LongCounter; -import io.opentelemetry.javaagent.instrumentation.opentelemetryapi.LabelBridging; class ApplicationLongCounter implements LongCounter { diff --git a/instrumentation/opentelemetry-api-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/metrics/ApplicationLongSumObserver.java b/instrumentation/opentelemetry-api-metrics-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/metrics/bridge/ApplicationLongSumObserver.java similarity index 96% rename from instrumentation/opentelemetry-api-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/metrics/ApplicationLongSumObserver.java rename to instrumentation/opentelemetry-api-metrics-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/metrics/bridge/ApplicationLongSumObserver.java index b69b6e38fc42..b84be22fb1cf 100644 --- a/instrumentation/opentelemetry-api-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/metrics/ApplicationLongSumObserver.java +++ b/instrumentation/opentelemetry-api-metrics-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/metrics/bridge/ApplicationLongSumObserver.java @@ -3,11 +3,10 @@ * SPDX-License-Identifier: Apache-2.0 */ -package io.opentelemetry.javaagent.instrumentation.opentelemetryapi.metrics; +package io.opentelemetry.javaagent.instrumentation.opentelemetryapi.metrics.bridge; import application.io.opentelemetry.api.common.Labels; import application.io.opentelemetry.api.metrics.LongSumObserver; -import io.opentelemetry.javaagent.instrumentation.opentelemetryapi.LabelBridging; import java.util.function.Consumer; class ApplicationLongSumObserver implements LongSumObserver { diff --git a/instrumentation/opentelemetry-api-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/metrics/ApplicationLongUpDownCounter.java b/instrumentation/opentelemetry-api-metrics-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/metrics/bridge/ApplicationLongUpDownCounter.java similarity index 96% rename from instrumentation/opentelemetry-api-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/metrics/ApplicationLongUpDownCounter.java rename to instrumentation/opentelemetry-api-metrics-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/metrics/bridge/ApplicationLongUpDownCounter.java index 557f05e393f3..0edcd4b77c3c 100644 --- a/instrumentation/opentelemetry-api-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/metrics/ApplicationLongUpDownCounter.java +++ b/instrumentation/opentelemetry-api-metrics-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/metrics/bridge/ApplicationLongUpDownCounter.java @@ -3,11 +3,10 @@ * SPDX-License-Identifier: Apache-2.0 */ -package io.opentelemetry.javaagent.instrumentation.opentelemetryapi.metrics; +package io.opentelemetry.javaagent.instrumentation.opentelemetryapi.metrics.bridge; import application.io.opentelemetry.api.common.Labels; import application.io.opentelemetry.api.metrics.LongUpDownCounter; -import io.opentelemetry.javaagent.instrumentation.opentelemetryapi.LabelBridging; class ApplicationLongUpDownCounter implements LongUpDownCounter { diff --git a/instrumentation/opentelemetry-api-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/metrics/ApplicationLongUpDownSumObserver.java b/instrumentation/opentelemetry-api-metrics-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/metrics/bridge/ApplicationLongUpDownSumObserver.java similarity index 96% rename from instrumentation/opentelemetry-api-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/metrics/ApplicationLongUpDownSumObserver.java rename to instrumentation/opentelemetry-api-metrics-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/metrics/bridge/ApplicationLongUpDownSumObserver.java index 4a7ee1503117..a698f35ac70a 100644 --- a/instrumentation/opentelemetry-api-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/metrics/ApplicationLongUpDownSumObserver.java +++ b/instrumentation/opentelemetry-api-metrics-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/metrics/bridge/ApplicationLongUpDownSumObserver.java @@ -3,11 +3,10 @@ * SPDX-License-Identifier: Apache-2.0 */ -package io.opentelemetry.javaagent.instrumentation.opentelemetryapi.metrics; +package io.opentelemetry.javaagent.instrumentation.opentelemetryapi.metrics.bridge; import application.io.opentelemetry.api.common.Labels; import application.io.opentelemetry.api.metrics.LongUpDownSumObserver; -import io.opentelemetry.javaagent.instrumentation.opentelemetryapi.LabelBridging; import java.util.function.Consumer; class ApplicationLongUpDownSumObserver implements LongUpDownSumObserver { diff --git a/instrumentation/opentelemetry-api-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/metrics/ApplicationLongValueObserver.java b/instrumentation/opentelemetry-api-metrics-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/metrics/bridge/ApplicationLongValueObserver.java similarity index 96% rename from instrumentation/opentelemetry-api-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/metrics/ApplicationLongValueObserver.java rename to instrumentation/opentelemetry-api-metrics-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/metrics/bridge/ApplicationLongValueObserver.java index a100435b65a1..186306ab83f6 100644 --- a/instrumentation/opentelemetry-api-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/metrics/ApplicationLongValueObserver.java +++ b/instrumentation/opentelemetry-api-metrics-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/metrics/bridge/ApplicationLongValueObserver.java @@ -3,11 +3,10 @@ * SPDX-License-Identifier: Apache-2.0 */ -package io.opentelemetry.javaagent.instrumentation.opentelemetryapi.metrics; +package io.opentelemetry.javaagent.instrumentation.opentelemetryapi.metrics.bridge; import application.io.opentelemetry.api.common.Labels; import application.io.opentelemetry.api.metrics.LongValueObserver; -import io.opentelemetry.javaagent.instrumentation.opentelemetryapi.LabelBridging; import java.util.function.Consumer; class ApplicationLongValueObserver implements LongValueObserver { diff --git a/instrumentation/opentelemetry-api-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/metrics/ApplicationLongValueRecorder.java b/instrumentation/opentelemetry-api-metrics-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/metrics/bridge/ApplicationLongValueRecorder.java similarity index 96% rename from instrumentation/opentelemetry-api-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/metrics/ApplicationLongValueRecorder.java rename to instrumentation/opentelemetry-api-metrics-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/metrics/bridge/ApplicationLongValueRecorder.java index 6bfc83dee28f..2bae66f9a7f8 100644 --- a/instrumentation/opentelemetry-api-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/metrics/ApplicationLongValueRecorder.java +++ b/instrumentation/opentelemetry-api-metrics-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/metrics/bridge/ApplicationLongValueRecorder.java @@ -3,11 +3,10 @@ * SPDX-License-Identifier: Apache-2.0 */ -package io.opentelemetry.javaagent.instrumentation.opentelemetryapi.metrics; +package io.opentelemetry.javaagent.instrumentation.opentelemetryapi.metrics.bridge; import application.io.opentelemetry.api.common.Labels; import application.io.opentelemetry.api.metrics.LongValueRecorder; -import io.opentelemetry.javaagent.instrumentation.opentelemetryapi.LabelBridging; class ApplicationLongValueRecorder implements LongValueRecorder { diff --git a/instrumentation/opentelemetry-api-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/metrics/ApplicationMeter.java b/instrumentation/opentelemetry-api-metrics-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/metrics/bridge/ApplicationMeter.java similarity index 99% rename from instrumentation/opentelemetry-api-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/metrics/ApplicationMeter.java rename to instrumentation/opentelemetry-api-metrics-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/metrics/bridge/ApplicationMeter.java index 5d00e79f5fbf..be537d0097c7 100644 --- a/instrumentation/opentelemetry-api-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/metrics/ApplicationMeter.java +++ b/instrumentation/opentelemetry-api-metrics-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/metrics/bridge/ApplicationMeter.java @@ -3,7 +3,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -package io.opentelemetry.javaagent.instrumentation.opentelemetryapi.metrics; +package io.opentelemetry.javaagent.instrumentation.opentelemetryapi.metrics.bridge; import application.io.opentelemetry.api.metrics.BatchRecorder; import application.io.opentelemetry.api.metrics.DoubleCounter; diff --git a/instrumentation/opentelemetry-api-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/metrics/ApplicationMeterProvider.java b/instrumentation/opentelemetry-api-metrics-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/metrics/bridge/ApplicationMeterProvider.java similarity index 77% rename from instrumentation/opentelemetry-api-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/metrics/ApplicationMeterProvider.java rename to instrumentation/opentelemetry-api-metrics-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/metrics/bridge/ApplicationMeterProvider.java index 83e9713c5acc..2cf835bb7164 100644 --- a/instrumentation/opentelemetry-api-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/metrics/ApplicationMeterProvider.java +++ b/instrumentation/opentelemetry-api-metrics-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/metrics/bridge/ApplicationMeterProvider.java @@ -3,17 +3,19 @@ * SPDX-License-Identifier: Apache-2.0 */ -package io.opentelemetry.javaagent.instrumentation.opentelemetryapi.metrics; +package io.opentelemetry.javaagent.instrumentation.opentelemetryapi.metrics.bridge; import application.io.opentelemetry.api.metrics.Meter; import application.io.opentelemetry.api.metrics.MeterProvider; public class ApplicationMeterProvider implements MeterProvider { + public static final MeterProvider INSTANCE = new ApplicationMeterProvider(); + private final io.opentelemetry.api.metrics.MeterProvider agentMeterProvider; - public ApplicationMeterProvider(io.opentelemetry.api.metrics.MeterProvider agentMeterProvider) { - this.agentMeterProvider = agentMeterProvider; + public ApplicationMeterProvider() { + this.agentMeterProvider = io.opentelemetry.api.metrics.GlobalMetricsProvider.get(); } @Override diff --git a/instrumentation/opentelemetry-api-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/LabelBridging.java b/instrumentation/opentelemetry-api-metrics-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/metrics/bridge/LabelBridging.java similarity index 97% rename from instrumentation/opentelemetry-api-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/LabelBridging.java rename to instrumentation/opentelemetry-api-metrics-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/metrics/bridge/LabelBridging.java index 85853594893b..1b190074f70b 100644 --- a/instrumentation/opentelemetry-api-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/LabelBridging.java +++ b/instrumentation/opentelemetry-api-metrics-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/metrics/bridge/LabelBridging.java @@ -3,7 +3,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -package io.opentelemetry.javaagent.instrumentation.opentelemetryapi; +package io.opentelemetry.javaagent.instrumentation.opentelemetryapi.metrics.bridge; import io.opentelemetry.api.common.Labels; import io.opentelemetry.api.common.LabelsBuilder; diff --git a/instrumentation/opentelemetry-api-1.0/javaagent/src/test/groovy/MeterTest.groovy b/instrumentation/opentelemetry-api-metrics-1.0/javaagent/src/test/groovy/MeterTest.groovy similarity index 84% rename from instrumentation/opentelemetry-api-1.0/javaagent/src/test/groovy/MeterTest.groovy rename to instrumentation/opentelemetry-api-metrics-1.0/javaagent/src/test/groovy/MeterTest.groovy index dc44af1f7e8c..08932d1eb7f0 100644 --- a/instrumentation/opentelemetry-api-1.0/javaagent/src/test/groovy/MeterTest.groovy +++ b/instrumentation/opentelemetry-api-metrics-1.0/javaagent/src/test/groovy/MeterTest.groovy @@ -3,18 +3,20 @@ * SPDX-License-Identifier: Apache-2.0 */ -import static io.opentelemetry.sdk.metrics.data.MetricData.Type.DOUBLE_GAUGE -import static io.opentelemetry.sdk.metrics.data.MetricData.Type.DOUBLE_SUM -import static io.opentelemetry.sdk.metrics.data.MetricData.Type.LONG_GAUGE -import static io.opentelemetry.sdk.metrics.data.MetricData.Type.LONG_SUM -import static io.opentelemetry.sdk.metrics.data.MetricData.Type.SUMMARY +import static io.opentelemetry.sdk.metrics.data.MetricDataType.DOUBLE_GAUGE +import static io.opentelemetry.sdk.metrics.data.MetricDataType.DOUBLE_SUM +import static io.opentelemetry.sdk.metrics.data.MetricDataType.LONG_GAUGE +import static io.opentelemetry.sdk.metrics.data.MetricDataType.LONG_SUM +import static io.opentelemetry.sdk.metrics.data.MetricDataType.SUMMARY import static java.util.concurrent.TimeUnit.SECONDS import com.google.common.base.Stopwatch -import io.opentelemetry.api.OpenTelemetry import io.opentelemetry.api.common.Labels import io.opentelemetry.api.metrics.AsynchronousInstrument +import io.opentelemetry.api.metrics.GlobalMetricsProvider import io.opentelemetry.instrumentation.test.AgentTestRunner +import io.opentelemetry.sdk.metrics.data.MetricData +import io.opentelemetry.sdk.metrics.data.Point import java.util.function.Consumer class MeterTest extends AgentTestRunner { @@ -25,7 +27,7 @@ class MeterTest extends AgentTestRunner { def instrumentationName = "test" + new Random().nextLong() when: - def meter = OpenTelemetry.getGlobalMeterProvider().get(instrumentationName, "1.2.3") + def meter = GlobalMetricsProvider.getMeter(instrumentationName, "1.2.3") def instrument = meter."$builderMethod"("test") .setDescription("d") .setUnit("u") @@ -49,8 +51,8 @@ class MeterTest extends AgentTestRunner { metricData.type == expectedType metricData.instrumentationLibraryInfo.name == instrumentationName metricData.instrumentationLibraryInfo.version == "1.2.3" - metricData.points.size() == 1 - def point = metricData.points.iterator().next() + points(metricData).size() == 1 + def point = points(metricData).iterator().next() if (bind) { point.labels == Labels.of("w", "x", "y", "z") } else { @@ -76,7 +78,7 @@ class MeterTest extends AgentTestRunner { def instrumentationName = "test" + new Random().nextLong() when: - def meter = OpenTelemetry.getGlobalMeterProvider().get(instrumentationName, "1.2.3") + def meter = GlobalMetricsProvider.getMeter(instrumentationName, "1.2.3") def instrument = meter."$builderMethod"("test") .setDescription("d") .setUnit("u") @@ -100,8 +102,8 @@ class MeterTest extends AgentTestRunner { metricData.type == SUMMARY metricData.instrumentationLibraryInfo.name == instrumentationName metricData.instrumentationLibraryInfo.version == "1.2.3" - metricData.points.size() == 1 - def point = metricData.points.iterator().next() + points(metricData).size() == 1 + def point = points(metricData).iterator().next() if (bind) { point.labels == Labels.of("w", "x", "y", "z") } else { @@ -122,7 +124,7 @@ class MeterTest extends AgentTestRunner { def instrumentationName = "test" + new Random().nextLong() when: - def meter = OpenTelemetry.getGlobalMeterProvider().get(instrumentationName, "1.2.3") + def meter = GlobalMetricsProvider.getMeter(instrumentationName, "1.2.3") def instrument = meter."$builderMethod"("test") .setDescription("d") .setUnit("u") @@ -179,8 +181,8 @@ class MeterTest extends AgentTestRunner { metricData.type == expectedType metricData.instrumentationLibraryInfo.name == instrumentationName metricData.instrumentationLibraryInfo.version == "1.2.3" - metricData.points.size() == 1 - def point = metricData.points.iterator().next() + points(metricData).size() == 1 + def point = points(metricData).iterator().next() point.labels == Labels.of("q", "r") if (builderMethod.startsWith("long")) { point.value == 123 @@ -204,7 +206,7 @@ class MeterTest extends AgentTestRunner { def instrumentationName = "test" + new Random().nextLong() when: - def meter = OpenTelemetry.getGlobalMeterProvider().get(instrumentationName, "1.2.3") + def meter = GlobalMetricsProvider.getMeter(instrumentationName, "1.2.3") def longCounter = meter.longCounterBuilder("test") .setDescription("d") .setUnit("u") @@ -229,8 +231,8 @@ class MeterTest extends AgentTestRunner { metricData.type == LONG_SUM metricData.instrumentationLibraryInfo.name == instrumentationName metricData.instrumentationLibraryInfo.version == "1.2.3" - metricData.points.size() == 1 - def point = metricData.points.iterator().next() + points(metricData).size() == 1 + def point = points(metricData).iterator().next() point.labels == Labels.of("q", "r") point.value == 11 @@ -241,8 +243,8 @@ class MeterTest extends AgentTestRunner { metricData2.type == SUMMARY metricData2.instrumentationLibraryInfo.name == instrumentationName metricData2.instrumentationLibraryInfo.version == "1.2.3" - metricData2.points.size() == 1 - def point2 = metricData2.points.iterator().next() + points(metricData2).size() == 1 + def point2 = points(metricData2).iterator().next() point2.labels == Labels.of("q", "r") point2.count == 2 point2.sum == 12.1 @@ -259,4 +261,14 @@ class MeterTest extends AgentTestRunner { } } } + + List points(MetricData metricData) { + def points = [] + points.addAll(metricData.getDoubleGaugeData().getPoints()) + points.addAll(metricData.getDoubleSumData().getPoints()) + points.addAll(metricData.getDoubleSummaryData().getPoints()) + points.addAll(metricData.getLongGaugeData().getPoints()) + points.addAll(metricData.getLongSumData().getPoints()) + return points + } } diff --git a/instrumentation/opentelemetry-sdk-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetrysdk/NoopTracerManagement.java b/instrumentation/opentelemetry-sdk-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetrysdk/NoopTracerManagement.java index d9a9da8a3135..2ed1a517ac18 100644 --- a/instrumentation/opentelemetry-sdk-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetrysdk/NoopTracerManagement.java +++ b/instrumentation/opentelemetry-sdk-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetrysdk/NoopTracerManagement.java @@ -48,7 +48,9 @@ public void updateActiveTraceConfig(TraceConfig traceConfig) {} public void addSpanProcessor(SpanProcessor spanProcessor) {} @Override - public void shutdown() {} + public CompletableResultCode shutdown() { + return CompletableResultCode.ofSuccess(); + } @Override public CompletableResultCode forceFlush() { diff --git a/instrumentation/oshi/library/oshi-library.gradle b/instrumentation/oshi/library/oshi-library.gradle index 56f1f700c1bb..69e9bc10ebb2 100644 --- a/instrumentation/oshi/library/oshi-library.gradle +++ b/instrumentation/oshi/library/oshi-library.gradle @@ -2,8 +2,11 @@ apply from: "$rootDir/gradle/instrumentation-library.gradle" dependencies { + implementation deps.opentelemetryApiMetrics + library group: 'com.github.oshi', name: 'oshi-core', version: '5.3.1' + testImplementation deps.opentelemetrySdkMetrics testImplementation project(':testing-common') testImplementation group: 'org.assertj', name: 'assertj-core', version: '3.18.1' } \ No newline at end of file diff --git a/instrumentation/oshi/library/src/main/java/io/opentelemetry/instrumentation/oshi/ProcessMetrics.java b/instrumentation/oshi/library/src/main/java/io/opentelemetry/instrumentation/oshi/ProcessMetrics.java index 1442f0aa787a..aa4d0caed36b 100644 --- a/instrumentation/oshi/library/src/main/java/io/opentelemetry/instrumentation/oshi/ProcessMetrics.java +++ b/instrumentation/oshi/library/src/main/java/io/opentelemetry/instrumentation/oshi/ProcessMetrics.java @@ -5,8 +5,8 @@ package io.opentelemetry.instrumentation.oshi; -import io.opentelemetry.api.OpenTelemetry; import io.opentelemetry.api.common.Labels; +import io.opentelemetry.api.metrics.GlobalMetricsProvider; import io.opentelemetry.api.metrics.Meter; import oshi.SystemInfo; import oshi.software.os.OSProcess; @@ -20,7 +20,7 @@ private ProcessMetrics() {} /** Register observers for java runtime metrics. */ public static void registerObservers() { - Meter meter = OpenTelemetry.getGlobalMeterProvider().get(ProcessMetrics.class.getName()); + Meter meter = GlobalMetricsProvider.get().get(ProcessMetrics.class.getName()); SystemInfo systemInfo = new SystemInfo(); OperatingSystem osInfo = systemInfo.getOperatingSystem(); OSProcess processInfo = osInfo.getProcess(osInfo.getProcessId()); diff --git a/instrumentation/oshi/library/src/main/java/io/opentelemetry/instrumentation/oshi/SystemMetrics.java b/instrumentation/oshi/library/src/main/java/io/opentelemetry/instrumentation/oshi/SystemMetrics.java index ae614bbe32f7..acafbfe868f3 100644 --- a/instrumentation/oshi/library/src/main/java/io/opentelemetry/instrumentation/oshi/SystemMetrics.java +++ b/instrumentation/oshi/library/src/main/java/io/opentelemetry/instrumentation/oshi/SystemMetrics.java @@ -5,8 +5,8 @@ package io.opentelemetry.instrumentation.oshi; -import io.opentelemetry.api.OpenTelemetry; import io.opentelemetry.api.common.Labels; +import io.opentelemetry.api.metrics.GlobalMetricsProvider; import io.opentelemetry.api.metrics.Meter; import oshi.SystemInfo; import oshi.hardware.GlobalMemory; @@ -25,8 +25,7 @@ private SystemMetrics() {} /** Register observers for system metrics. */ public static void registerObservers() { - Meter meter = - OpenTelemetry.getGlobalMeterProvider().get("io.opentelemetry.instrumentation.oshi"); + Meter meter = GlobalMetricsProvider.get().get("io.opentelemetry.instrumentation.oshi"); SystemInfo systemInfo = new SystemInfo(); HardwareAbstractionLayer hal = systemInfo.getHardware(); diff --git a/instrumentation/oshi/library/src/test/java/io/opentelemetry/instrumentation/oshi/AbstractMetricsTest.java b/instrumentation/oshi/library/src/test/java/io/opentelemetry/instrumentation/oshi/AbstractMetricsTest.java index 279e12a5cbb1..e92b8a714e11 100644 --- a/instrumentation/oshi/library/src/test/java/io/opentelemetry/instrumentation/oshi/AbstractMetricsTest.java +++ b/instrumentation/oshi/library/src/test/java/io/opentelemetry/instrumentation/oshi/AbstractMetricsTest.java @@ -7,14 +7,17 @@ import static org.assertj.core.api.Assertions.assertThat; -import io.opentelemetry.sdk.OpenTelemetrySdk; import io.opentelemetry.sdk.common.CompletableResultCode; +import io.opentelemetry.sdk.metrics.SdkMeterProvider; +import io.opentelemetry.sdk.metrics.data.DoublePoint; +import io.opentelemetry.sdk.metrics.data.DoubleSummaryPoint; +import io.opentelemetry.sdk.metrics.data.LongPoint; import io.opentelemetry.sdk.metrics.data.MetricData; -import io.opentelemetry.sdk.metrics.data.MetricData.DoublePoint; -import io.opentelemetry.sdk.metrics.data.MetricData.LongPoint; -import io.opentelemetry.sdk.metrics.data.MetricData.Point; +import io.opentelemetry.sdk.metrics.data.MetricDataType; +import io.opentelemetry.sdk.metrics.data.Point; import io.opentelemetry.sdk.metrics.export.IntervalMetricReader; import io.opentelemetry.sdk.metrics.export.MetricExporter; +import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.List; @@ -22,13 +25,21 @@ import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; -public class AbstractMetricsTest { +class AbstractMetricsTest { TestMetricExporter testMetricExporter; + static SdkMeterProvider meterProvider; + + @BeforeAll + static void initializeOpenTelemetry() { + meterProvider = SdkMeterProvider.builder().buildAndRegisterGlobal(); + } + @BeforeEach - public void beforeEach() { + void beforeEach() { testMetricExporter = new TestMetricExporter(); } @@ -36,31 +47,37 @@ IntervalMetricReader createIntervalMetricReader() { return IntervalMetricReader.builder() .setExportIntervalMillis(100) .setMetricExporter(testMetricExporter) - .setMetricProducers( - Collections.singletonList( - OpenTelemetrySdk.getGlobalMeterProvider().getMetricProducer())) + .setMetricProducers(Collections.singletonList(meterProvider)) .build(); } public void verify( - String metricName, String unit, MetricData.Type type, boolean checkNonZeroValue) { + String metricName, String unit, MetricDataType type, boolean checkNonZeroValue) { List metricDataList = testMetricExporter.metricDataList; for (MetricData metricData : metricDataList) { if (metricData.getName().equals(metricName)) { assertThat(metricData.getDescription()).isNotEmpty(); assertThat(metricData.getUnit()).isEqualTo(unit); - assertThat(metricData.getPoints()).isNotEmpty(); + metricData.getDoubleGaugeData().getPoints(); + List points = new ArrayList<>(); + points.addAll(metricData.getDoubleGaugeData().getPoints()); + points.addAll(metricData.getDoubleSumData().getPoints()); + points.addAll(metricData.getDoubleSummaryData().getPoints()); + points.addAll(metricData.getLongGaugeData().getPoints()); + points.addAll(metricData.getLongSumData().getPoints()); + + assertThat(points).isNotEmpty(); assertThat(metricData.getType()).isEqualTo(type); if (checkNonZeroValue) { - for (Point point : metricData.getPoints()) { + for (Point point : points) { if (point instanceof LongPoint) { LongPoint longPoint = (LongPoint) point; assertThat(longPoint.getValue()).isGreaterThan(0); } else if (point instanceof DoublePoint) { DoublePoint doublePoint = (DoublePoint) point; assertThat(doublePoint.getValue()).isGreaterThan(0.0); - } else if (point instanceof MetricData.DoubleSummaryPoint) { - MetricData.DoubleSummaryPoint summaryPoint = (MetricData.DoubleSummaryPoint) point; + } else if (point instanceof DoubleSummaryPoint) { + DoubleSummaryPoint summaryPoint = (DoubleSummaryPoint) point; assertThat(summaryPoint.getSum()).isGreaterThan(0.0); } else { Assertions.fail("unexpected type " + metricData.getType()); diff --git a/instrumentation/oshi/library/src/test/java/io/opentelemetry/instrumentation/oshi/ProcessMetricsTest.java b/instrumentation/oshi/library/src/test/java/io/opentelemetry/instrumentation/oshi/ProcessMetricsTest.java index 602888a31ef8..af41df48fde3 100644 --- a/instrumentation/oshi/library/src/test/java/io/opentelemetry/instrumentation/oshi/ProcessMetricsTest.java +++ b/instrumentation/oshi/library/src/test/java/io/opentelemetry/instrumentation/oshi/ProcessMetricsTest.java @@ -5,7 +5,7 @@ package io.opentelemetry.instrumentation.oshi; -import io.opentelemetry.sdk.metrics.data.MetricData.Type; +import io.opentelemetry.sdk.metrics.data.MetricDataType; import io.opentelemetry.sdk.metrics.export.IntervalMetricReader; import org.junit.jupiter.api.Test; @@ -19,7 +19,7 @@ public void test() throws Exception { testMetricExporter.waitForData(); intervalMetricReader.shutdown(); - verify("runtime.java.memory", "bytes", Type.LONG_SUM, true); - verify("runtime.java.cpu_time", "seconds", Type.DOUBLE_GAUGE, true); + verify("runtime.java.memory", "bytes", MetricDataType.LONG_SUM, true); + verify("runtime.java.cpu_time", "seconds", MetricDataType.DOUBLE_GAUGE, true); } } diff --git a/instrumentation/oshi/library/src/test/java/io/opentelemetry/instrumentation/oshi/SystemMetricsTest.java b/instrumentation/oshi/library/src/test/java/io/opentelemetry/instrumentation/oshi/SystemMetricsTest.java index 38a79d648c76..2eacb7096186 100644 --- a/instrumentation/oshi/library/src/test/java/io/opentelemetry/instrumentation/oshi/SystemMetricsTest.java +++ b/instrumentation/oshi/library/src/test/java/io/opentelemetry/instrumentation/oshi/SystemMetricsTest.java @@ -5,7 +5,7 @@ package io.opentelemetry.instrumentation.oshi; -import io.opentelemetry.sdk.metrics.data.MetricData.Type; +import io.opentelemetry.sdk.metrics.data.MetricDataType; import io.opentelemetry.sdk.metrics.export.IntervalMetricReader; import org.junit.jupiter.api.Test; @@ -19,14 +19,14 @@ public void test() throws Exception { testMetricExporter.waitForData(); intervalMetricReader.shutdown(); - verify("system.memory.usage", "By", Type.LONG_SUM, true); - verify("system.memory.utilization", "1", Type.DOUBLE_GAUGE, true); + verify("system.memory.usage", "By", MetricDataType.LONG_SUM, true); + verify("system.memory.utilization", "1", MetricDataType.DOUBLE_GAUGE, true); - verify("system.network.io", "By", Type.LONG_SUM, false); - verify("system.network.packets", "packets", Type.LONG_SUM, false); - verify("system.network.errors", "errors", Type.LONG_SUM, false); + verify("system.network.io", "By", MetricDataType.LONG_SUM, false); + verify("system.network.packets", "packets", MetricDataType.LONG_SUM, false); + verify("system.network.errors", "errors", MetricDataType.LONG_SUM, false); - verify("system.disk.io", "By", Type.LONG_SUM, false); - verify("system.disk.operations", "operations", Type.LONG_SUM, false); + verify("system.disk.io", "By", MetricDataType.LONG_SUM, false); + verify("system.disk.operations", "operations", MetricDataType.LONG_SUM, false); } } diff --git a/instrumentation/rabbitmq-2.7/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/rabbitmq/RabbitChannelInstrumentation.java b/instrumentation/rabbitmq-2.7/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/rabbitmq/RabbitChannelInstrumentation.java index 530390f0400b..003f486264c8 100644 --- a/instrumentation/rabbitmq-2.7/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/rabbitmq/RabbitChannelInstrumentation.java +++ b/instrumentation/rabbitmq-2.7/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/rabbitmq/RabbitChannelInstrumentation.java @@ -27,12 +27,12 @@ import com.rabbitmq.client.GetResponse; import com.rabbitmq.client.MessageProperties; import io.opentelemetry.api.trace.Span; -import io.opentelemetry.api.trace.attributes.SemanticAttributes; import io.opentelemetry.context.Context; import io.opentelemetry.context.Scope; import io.opentelemetry.javaagent.instrumentation.api.CallDepthThreadLocalMap; import io.opentelemetry.javaagent.instrumentation.api.Java8BytecodeBridge; import io.opentelemetry.javaagent.tooling.TypeInstrumentation; +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes; import java.io.IOException; import java.util.HashMap; import java.util.LinkedHashMap; diff --git a/instrumentation/rabbitmq-2.7/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/rabbitmq/RabbitTracer.java b/instrumentation/rabbitmq-2.7/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/rabbitmq/RabbitTracer.java index ed96e340ff85..7be34b0bb1c2 100644 --- a/instrumentation/rabbitmq-2.7/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/rabbitmq/RabbitTracer.java +++ b/instrumentation/rabbitmq-2.7/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/rabbitmq/RabbitTracer.java @@ -18,9 +18,9 @@ import com.rabbitmq.client.GetResponse; import io.opentelemetry.api.trace.Span; import io.opentelemetry.api.trace.SpanBuilder; -import io.opentelemetry.api.trace.attributes.SemanticAttributes; import io.opentelemetry.instrumentation.api.tracer.BaseTracer; import io.opentelemetry.instrumentation.api.tracer.utils.NetPeerUtils; +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes; import java.util.Map; import java.util.concurrent.TimeUnit; diff --git a/instrumentation/rabbitmq-2.7/javaagent/src/test/groovy/RabbitMQTest.groovy b/instrumentation/rabbitmq-2.7/javaagent/src/test/groovy/RabbitMQTest.groovy index 2156e36e9965..5add94569ceb 100644 --- a/instrumentation/rabbitmq-2.7/javaagent/src/test/groovy/RabbitMQTest.groovy +++ b/instrumentation/rabbitmq-2.7/javaagent/src/test/groovy/RabbitMQTest.groovy @@ -18,7 +18,7 @@ import com.rabbitmq.client.Envelope import com.rabbitmq.client.GetResponse import com.rabbitmq.client.ShutdownSignalException import io.opentelemetry.api.common.AttributeKey -import io.opentelemetry.api.trace.attributes.SemanticAttributes +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes import io.opentelemetry.instrumentation.test.AgentTestRunner import io.opentelemetry.instrumentation.test.asserts.TraceAssert import io.opentelemetry.sdk.trace.data.SpanData diff --git a/instrumentation/ratpack-1.4/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/ratpack/BlockWrapper.java b/instrumentation/ratpack-1.4/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/ratpack/BlockWrapper.java index d937f7c99759..d3ee774854ee 100644 --- a/instrumentation/ratpack-1.4/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/ratpack/BlockWrapper.java +++ b/instrumentation/ratpack-1.4/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/ratpack/BlockWrapper.java @@ -5,7 +5,7 @@ package io.opentelemetry.javaagent.instrumentation.ratpack; -import io.opentelemetry.api.OpenTelemetry; +import io.opentelemetry.api.GlobalOpenTelemetry; import io.opentelemetry.api.trace.Tracer; import io.opentelemetry.context.Context; import io.opentelemetry.context.Scope; @@ -18,7 +18,7 @@ public class BlockWrapper implements Block { private static final Logger log = LoggerFactory.getLogger(BlockWrapper.class); private static final Tracer TRACER = - OpenTelemetry.getGlobalTracer("io.opentelemetry.auto.ratpack-1.4"); + GlobalOpenTelemetry.getTracer("io.opentelemetry.auto.ratpack-1.4"); private final Block delegate; private final Context parentContext; diff --git a/instrumentation/ratpack-1.4/javaagent/src/test/groovy/RatpackOtherTest.groovy b/instrumentation/ratpack-1.4/javaagent/src/test/groovy/RatpackOtherTest.groovy index cf0470ffd125..99374225888e 100644 --- a/instrumentation/ratpack-1.4/javaagent/src/test/groovy/RatpackOtherTest.groovy +++ b/instrumentation/ratpack-1.4/javaagent/src/test/groovy/RatpackOtherTest.groovy @@ -6,7 +6,7 @@ import static io.opentelemetry.api.trace.Span.Kind.INTERNAL import static io.opentelemetry.api.trace.Span.Kind.SERVER -import io.opentelemetry.api.trace.attributes.SemanticAttributes +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes import io.opentelemetry.instrumentation.test.AgentTestRunner import io.opentelemetry.instrumentation.test.utils.OkHttpUtils import okhttp3.HttpUrl diff --git a/instrumentation/reactor-3.1/javaagent/src/test/groovy/ReactorCoreTest.groovy b/instrumentation/reactor-3.1/javaagent/src/test/groovy/ReactorCoreTest.groovy index 9ab7f1a3962b..d1d0b70fd5cc 100644 --- a/instrumentation/reactor-3.1/javaagent/src/test/groovy/ReactorCoreTest.groovy +++ b/instrumentation/reactor-3.1/javaagent/src/test/groovy/ReactorCoreTest.groovy @@ -5,7 +5,7 @@ import static io.opentelemetry.instrumentation.test.utils.TraceUtils.basicSpan -import io.opentelemetry.api.OpenTelemetry +import io.opentelemetry.api.GlobalOpenTelemetry import io.opentelemetry.context.Context import io.opentelemetry.instrumentation.test.AgentTestRunner import io.opentelemetry.instrumentation.test.utils.TraceUtils @@ -257,7 +257,7 @@ class ReactorCoreTest extends AgentTestRunner { // The "add one" operations in the publisher created here should be children of the publisher-parent Publisher publisher = publisherSupplier() - def tracer = OpenTelemetry.getGlobalTracer("test") + def tracer = GlobalOpenTelemetry.getTracer("test") def intermediate = tracer.spanBuilder("intermediate").startSpan() // After this activation, the "add two" operations below should be children of this span def scope = Context.current().with(intermediate).makeCurrent() @@ -296,7 +296,7 @@ class ReactorCoreTest extends AgentTestRunner { def runUnderTrace(def publisherSupplier) { TraceUtils.runUnderTrace("trace-parent") { - def tracer = OpenTelemetry.getGlobalTracer("test") + def tracer = GlobalOpenTelemetry.getTracer("test") def span = tracer.spanBuilder("publisher-parent").startSpan() def scope = Context.current().with(span).makeCurrent() try { @@ -318,7 +318,7 @@ class ReactorCoreTest extends AgentTestRunner { def cancelUnderTrace(def publisherSupplier) { TraceUtils.runUnderTrace("trace-parent") { - def tracer = OpenTelemetry.getGlobalTracer("test") + def tracer = GlobalOpenTelemetry.getTracer("test") def span = tracer.spanBuilder("publisher-parent").startSpan() def scope = Context.current().with(span).makeCurrent() diff --git a/instrumentation/reactor-3.1/javaagent/src/test/groovy/SubscriptionTest.groovy b/instrumentation/reactor-3.1/javaagent/src/test/groovy/SubscriptionTest.groovy index 4fa62198a5b8..31f4443c991f 100644 --- a/instrumentation/reactor-3.1/javaagent/src/test/groovy/SubscriptionTest.groovy +++ b/instrumentation/reactor-3.1/javaagent/src/test/groovy/SubscriptionTest.groovy @@ -6,7 +6,7 @@ import static io.opentelemetry.instrumentation.test.utils.TraceUtils.basicSpan import static io.opentelemetry.instrumentation.test.utils.TraceUtils.runUnderTrace -import io.opentelemetry.api.OpenTelemetry +import io.opentelemetry.api.GlobalOpenTelemetry import io.opentelemetry.instrumentation.test.AgentTestRunner import java.util.concurrent.CountDownLatch import reactor.core.publisher.Mono @@ -39,7 +39,7 @@ class SubscriptionTest extends AgentTestRunner { static class Connection { static int query() { - def span = OpenTelemetry.getGlobalTracer("test").spanBuilder("Connection.query").startSpan() + def span = GlobalOpenTelemetry.getTracer("test").spanBuilder("Connection.query").startSpan() span.end() return new Random().nextInt() } diff --git a/instrumentation/reactor-netty-0.9/javaagent/src/test/groovy/HttpClientTest.groovy b/instrumentation/reactor-netty-0.9/javaagent/src/test/groovy/HttpClientTest.groovy index aef04bb7e6e0..ff52124efdd8 100644 --- a/instrumentation/reactor-netty-0.9/javaagent/src/test/groovy/HttpClientTest.groovy +++ b/instrumentation/reactor-netty-0.9/javaagent/src/test/groovy/HttpClientTest.groovy @@ -8,7 +8,7 @@ import static io.opentelemetry.instrumentation.test.server.http.TestHttpServer.h import static io.opentelemetry.instrumentation.test.utils.TraceUtils.basicSpan import static io.opentelemetry.instrumentation.test.utils.TraceUtils.runUnderTrace -import io.opentelemetry.api.trace.attributes.SemanticAttributes +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes import io.opentelemetry.instrumentation.test.AgentTestRunner import io.opentelemetry.instrumentation.test.asserts.TraceAssert import io.opentelemetry.sdk.trace.data.SpanData diff --git a/instrumentation/rediscala-1.8/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/rediscala/RediscalaClientTracer.java b/instrumentation/rediscala-1.8/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/rediscala/RediscalaClientTracer.java index 964bb04d2e34..5195fb65a2c9 100644 --- a/instrumentation/rediscala-1.8/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/rediscala/RediscalaClientTracer.java +++ b/instrumentation/rediscala-1.8/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/rediscala/RediscalaClientTracer.java @@ -5,8 +5,8 @@ package io.opentelemetry.javaagent.instrumentation.rediscala; -import io.opentelemetry.api.trace.attributes.SemanticAttributes.DbSystemValues; import io.opentelemetry.instrumentation.api.tracer.DatabaseClientTracer; +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes.DbSystemValues; import java.net.InetSocketAddress; import redis.RedisCommand; diff --git a/instrumentation/rediscala-1.8/javaagent/src/test/groovy/RediscalaClientTest.groovy b/instrumentation/rediscala-1.8/javaagent/src/test/groovy/RediscalaClientTest.groovy index 77d253d4c24f..418801971387 100644 --- a/instrumentation/rediscala-1.8/javaagent/src/test/groovy/RediscalaClientTest.groovy +++ b/instrumentation/rediscala-1.8/javaagent/src/test/groovy/RediscalaClientTest.groovy @@ -6,7 +6,7 @@ import static io.opentelemetry.api.trace.Span.Kind.CLIENT import akka.actor.ActorSystem -import io.opentelemetry.api.trace.attributes.SemanticAttributes +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes import io.opentelemetry.instrumentation.test.AgentTestRunner import io.opentelemetry.instrumentation.test.utils.PortUtils import redis.ByteStringDeserializerDefault diff --git a/instrumentation/redisson-3.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/redisson/RedissonClientTracer.java b/instrumentation/redisson-3.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/redisson/RedissonClientTracer.java index bdef98a349f4..09235870b189 100644 --- a/instrumentation/redisson-3.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/redisson/RedissonClientTracer.java +++ b/instrumentation/redisson-3.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/redisson/RedissonClientTracer.java @@ -7,9 +7,9 @@ import io.netty.buffer.ByteBuf; import io.netty.channel.Channel; -import io.opentelemetry.api.trace.attributes.SemanticAttributes.DbSystemValues; import io.opentelemetry.instrumentation.api.tracer.DatabaseClientTracer; import io.opentelemetry.javaagent.instrumentation.api.db.RedisCommandNormalizer; +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes.DbSystemValues; import java.net.InetSocketAddress; import java.util.ArrayList; import java.util.List; diff --git a/instrumentation/redisson-3.0/javaagent/src/test/groovy/RedissonAsyncClientTest.groovy b/instrumentation/redisson-3.0/javaagent/src/test/groovy/RedissonAsyncClientTest.groovy index 7950229bd48b..71979fa1f2f1 100644 --- a/instrumentation/redisson-3.0/javaagent/src/test/groovy/RedissonAsyncClientTest.groovy +++ b/instrumentation/redisson-3.0/javaagent/src/test/groovy/RedissonAsyncClientTest.groovy @@ -5,7 +5,7 @@ import static io.opentelemetry.api.trace.Span.Kind.CLIENT -import io.opentelemetry.api.trace.attributes.SemanticAttributes +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes import io.opentelemetry.instrumentation.test.AgentTestRunner import io.opentelemetry.instrumentation.test.utils.PortUtils import java.util.concurrent.TimeUnit diff --git a/instrumentation/redisson-3.0/javaagent/src/test/groovy/RedissonClientTest.groovy b/instrumentation/redisson-3.0/javaagent/src/test/groovy/RedissonClientTest.groovy index 8e2ddd2a9fa3..8cbff4daac01 100644 --- a/instrumentation/redisson-3.0/javaagent/src/test/groovy/RedissonClientTest.groovy +++ b/instrumentation/redisson-3.0/javaagent/src/test/groovy/RedissonClientTest.groovy @@ -7,7 +7,7 @@ import static io.opentelemetry.api.trace.Span.Kind.CLIENT import static java.util.regex.Pattern.compile import static java.util.regex.Pattern.quote -import io.opentelemetry.api.trace.attributes.SemanticAttributes +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes import io.opentelemetry.instrumentation.test.AgentTestRunner import io.opentelemetry.instrumentation.test.utils.PortUtils import org.redisson.Redisson diff --git a/instrumentation/rmi/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/rmi/client/RmiClientTracer.java b/instrumentation/rmi/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/rmi/client/RmiClientTracer.java index df2a3bb55ab3..5e47eb4e6352 100644 --- a/instrumentation/rmi/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/rmi/client/RmiClientTracer.java +++ b/instrumentation/rmi/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/rmi/client/RmiClientTracer.java @@ -9,8 +9,8 @@ import io.opentelemetry.api.trace.Span; import io.opentelemetry.api.trace.SpanBuilder; -import io.opentelemetry.api.trace.attributes.SemanticAttributes; import io.opentelemetry.instrumentation.api.tracer.RpcClientTracer; +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes; import java.lang.reflect.Method; public class RmiClientTracer extends RpcClientTracer { diff --git a/instrumentation/rmi/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/rmi/context/ContextPayload.java b/instrumentation/rmi/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/rmi/context/ContextPayload.java index ba7a4456cbac..d04fc3b32237 100644 --- a/instrumentation/rmi/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/rmi/context/ContextPayload.java +++ b/instrumentation/rmi/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/rmi/context/ContextPayload.java @@ -5,7 +5,7 @@ package io.opentelemetry.javaagent.instrumentation.rmi.context; -import io.opentelemetry.api.OpenTelemetry; +import io.opentelemetry.api.GlobalOpenTelemetry; import io.opentelemetry.api.trace.Span; import io.opentelemetry.api.trace.Tracer; import io.opentelemetry.context.Context; @@ -23,7 +23,7 @@ public class ContextPayload { private static final Logger log = LoggerFactory.getLogger(ContextPayload.class); - private static final Tracer TRACER = OpenTelemetry.getGlobalTracer("io.opentelemetry.auto.rmi"); + private static final Tracer TRACER = GlobalOpenTelemetry.getTracer("io.opentelemetry.auto.rmi"); public static Tracer tracer() { return TRACER; @@ -44,7 +44,7 @@ public ContextPayload(Map context) { public static ContextPayload from(Span span) { ContextPayload payload = new ContextPayload(); Context context = Context.current().with(span); - OpenTelemetry.getGlobalPropagators().getTextMapPropagator().inject(context, payload, SETTER); + GlobalOpenTelemetry.getPropagators().getTextMapPropagator().inject(context, payload, SETTER); return payload; } diff --git a/instrumentation/rmi/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/rmi/server/RmiServerTracer.java b/instrumentation/rmi/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/rmi/server/RmiServerTracer.java index c116135810cd..0e3b55e9f7ab 100644 --- a/instrumentation/rmi/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/rmi/server/RmiServerTracer.java +++ b/instrumentation/rmi/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/rmi/server/RmiServerTracer.java @@ -9,10 +9,10 @@ import io.opentelemetry.api.trace.Span; import io.opentelemetry.api.trace.SpanBuilder; -import io.opentelemetry.api.trace.attributes.SemanticAttributes; import io.opentelemetry.context.Context; import io.opentelemetry.context.propagation.TextMapPropagator.Getter; import io.opentelemetry.instrumentation.api.tracer.RpcServerTracer; +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes; import java.lang.reflect.Method; public class RmiServerTracer extends RpcServerTracer { diff --git a/instrumentation/rmi/javaagent/src/test/groovy/RmiTest.groovy b/instrumentation/rmi/javaagent/src/test/groovy/RmiTest.groovy index e2d6e9e2cc2f..9c3b08abb9fd 100644 --- a/instrumentation/rmi/javaagent/src/test/groovy/RmiTest.groovy +++ b/instrumentation/rmi/javaagent/src/test/groovy/RmiTest.groovy @@ -8,7 +8,7 @@ import static io.opentelemetry.api.trace.Span.Kind.SERVER import static io.opentelemetry.instrumentation.test.utils.TraceUtils.basicSpan import static io.opentelemetry.instrumentation.test.utils.TraceUtils.runUnderTrace -import io.opentelemetry.api.trace.attributes.SemanticAttributes +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes import io.opentelemetry.instrumentation.test.AgentTestRunner import io.opentelemetry.instrumentation.test.utils.PortUtils import java.rmi.registry.LocateRegistry diff --git a/instrumentation/runtime-metrics/library/runtime-metrics-library.gradle b/instrumentation/runtime-metrics/library/runtime-metrics-library.gradle index d4941d894c90..e56517c4e86a 100644 --- a/instrumentation/runtime-metrics/library/runtime-metrics-library.gradle +++ b/instrumentation/runtime-metrics/library/runtime-metrics-library.gradle @@ -1,6 +1,9 @@ apply from: "$rootDir/gradle/instrumentation-library.gradle" dependencies { + implementation deps.opentelemetryApiMetrics + + testImplementation deps.opentelemetrySdkMetrics testImplementation project(':testing-common') testImplementation group: 'org.mockito', name: 'mockito-core', version: '3.6.0' } \ No newline at end of file diff --git a/instrumentation/runtime-metrics/library/src/main/java/io/opentelemetry/instrumentation/runtimemetrics/GarbageCollector.java b/instrumentation/runtime-metrics/library/src/main/java/io/opentelemetry/instrumentation/runtimemetrics/GarbageCollector.java index 73aa6b549452..1643e973a16e 100644 --- a/instrumentation/runtime-metrics/library/src/main/java/io/opentelemetry/instrumentation/runtimemetrics/GarbageCollector.java +++ b/instrumentation/runtime-metrics/library/src/main/java/io/opentelemetry/instrumentation/runtimemetrics/GarbageCollector.java @@ -5,8 +5,8 @@ package io.opentelemetry.instrumentation.runtimemetrics; -import io.opentelemetry.api.OpenTelemetry; import io.opentelemetry.api.common.Labels; +import io.opentelemetry.api.metrics.GlobalMetricsProvider; import io.opentelemetry.api.metrics.Meter; import java.lang.management.GarbageCollectorMXBean; import java.lang.management.ManagementFactory; @@ -34,7 +34,7 @@ public final class GarbageCollector { /** Register all observers provided by this module. */ public void registerObservers() { List garbageCollectors = ManagementFactory.getGarbageCollectorMXBeans(); - Meter meter = OpenTelemetry.getGlobalMeter(GarbageCollector.class.getName()); + Meter meter = GlobalMetricsProvider.getMeter(GarbageCollector.class.getName()); List labelSets = new ArrayList<>(garbageCollectors.size()); for (final GarbageCollectorMXBean gc : garbageCollectors) { labelSets.add(Labels.of(GC_LABEL_KEY, gc.getName())); diff --git a/instrumentation/runtime-metrics/library/src/main/java/io/opentelemetry/instrumentation/runtimemetrics/MemoryPools.java b/instrumentation/runtime-metrics/library/src/main/java/io/opentelemetry/instrumentation/runtimemetrics/MemoryPools.java index 597f30d07031..750701db23db 100644 --- a/instrumentation/runtime-metrics/library/src/main/java/io/opentelemetry/instrumentation/runtimemetrics/MemoryPools.java +++ b/instrumentation/runtime-metrics/library/src/main/java/io/opentelemetry/instrumentation/runtimemetrics/MemoryPools.java @@ -5,9 +5,9 @@ package io.opentelemetry.instrumentation.runtimemetrics; -import io.opentelemetry.api.OpenTelemetry; import io.opentelemetry.api.common.Labels; import io.opentelemetry.api.metrics.AsynchronousInstrument.LongResult; +import io.opentelemetry.api.metrics.GlobalMetricsProvider; import io.opentelemetry.api.metrics.LongUpDownSumObserver; import io.opentelemetry.api.metrics.Meter; import java.lang.management.ManagementFactory; @@ -59,7 +59,7 @@ public final class MemoryPools { /** Register only the "area" observers. */ public static void registerMemoryAreaObservers() { MemoryMXBean memoryBean = ManagementFactory.getMemoryMXBean(); - Meter meter = OpenTelemetry.getGlobalMeter(MemoryPools.class.getName()); + Meter meter = GlobalMetricsProvider.getMeter(MemoryPools.class.getName()); final LongUpDownSumObserver areaMetric = meter .longUpDownSumObserverBuilder("runtime.jvm.memory.area") @@ -76,7 +76,7 @@ public static void registerMemoryAreaObservers() { /** Register only the "pool" observers. */ public static void registerMemoryPoolObservers() { List poolBeans = ManagementFactory.getMemoryPoolMXBeans(); - Meter meter = OpenTelemetry.getGlobalMeter(MemoryPools.class.getName()); + Meter meter = GlobalMetricsProvider.getMeter(MemoryPools.class.getName()); List usedLabelSets = new ArrayList<>(poolBeans.size()); List committedLabelSets = new ArrayList<>(poolBeans.size()); List maxLabelSets = new ArrayList<>(poolBeans.size()); diff --git a/instrumentation/scala-executors/javaagent/src/slickTest/groovy/SlickTest.groovy b/instrumentation/scala-executors/javaagent/src/slickTest/groovy/SlickTest.groovy index 2202bea0f99c..4aae0eea2a9b 100644 --- a/instrumentation/scala-executors/javaagent/src/slickTest/groovy/SlickTest.groovy +++ b/instrumentation/scala-executors/javaagent/src/slickTest/groovy/SlickTest.groovy @@ -5,7 +5,7 @@ import static io.opentelemetry.api.trace.Span.Kind.CLIENT -import io.opentelemetry.api.trace.attributes.SemanticAttributes +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes import io.opentelemetry.instrumentation.test.AgentTestRunner class SlickTest extends AgentTestRunner { diff --git a/instrumentation/scala-executors/javaagent/src/test/scala/ScalaAsyncChild.java b/instrumentation/scala-executors/javaagent/src/test/scala/ScalaAsyncChild.java index 4af1e2b80b16..737f09c8d501 100644 --- a/instrumentation/scala-executors/javaagent/src/test/scala/ScalaAsyncChild.java +++ b/instrumentation/scala-executors/javaagent/src/test/scala/ScalaAsyncChild.java @@ -3,7 +3,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -import io.opentelemetry.api.OpenTelemetry; +import io.opentelemetry.api.GlobalOpenTelemetry; import io.opentelemetry.api.trace.Tracer; import java.util.concurrent.Callable; import java.util.concurrent.CountDownLatch; @@ -11,7 +11,7 @@ import scala.concurrent.forkjoin.ForkJoinTask; public class ScalaAsyncChild extends ForkJoinTask implements Runnable, Callable { - private static final Tracer tracer = OpenTelemetry.getGlobalTracer("io.opentelemetry.auto"); + private static final Tracer tracer = GlobalOpenTelemetry.getTracer("io.opentelemetry.auto"); private final AtomicBoolean blockThread; private final boolean doTraceableWork; diff --git a/instrumentation/servlet/servlet-2.2/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/servlet/v2_2/HttpServletResponseInstrumentation.java b/instrumentation/servlet/servlet-2.2/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/servlet/v2_2/HttpServletResponseInstrumentation.java index 89f51cb60652..8b1bf24891d1 100644 --- a/instrumentation/servlet/servlet-2.2/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/servlet/v2_2/HttpServletResponseInstrumentation.java +++ b/instrumentation/servlet/servlet-2.2/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/servlet/v2_2/HttpServletResponseInstrumentation.java @@ -27,7 +27,7 @@ /** * Class javax.servlet.http.HttpServletResponse got method getStatus only * in Servlet specification version 3.0. This means that we cannot set {@link - * io.opentelemetry.api.trace.attributes.SemanticAttributes#HTTP_STATUS_CODE} attribute on the + * io.opentelemetry.semconv.trace.attributes.SemanticAttributes#HTTP_STATUS_CODE} attribute on the * created span using just response object. * *

This instrumentation intercepts status setting methods from Servlet 2.0 specification and diff --git a/instrumentation/spark-2.3/javaagent/src/test/groovy/SparkJavaBasedTest.groovy b/instrumentation/spark-2.3/javaagent/src/test/groovy/SparkJavaBasedTest.groovy index e34b13e033f8..3d95510150cc 100644 --- a/instrumentation/spark-2.3/javaagent/src/test/groovy/SparkJavaBasedTest.groovy +++ b/instrumentation/spark-2.3/javaagent/src/test/groovy/SparkJavaBasedTest.groovy @@ -5,7 +5,7 @@ import static io.opentelemetry.api.trace.Span.Kind.SERVER -import io.opentelemetry.api.trace.attributes.SemanticAttributes +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes import io.opentelemetry.instrumentation.test.AgentTestRunner import io.opentelemetry.instrumentation.test.utils.OkHttpUtils import io.opentelemetry.instrumentation.test.utils.PortUtils diff --git a/instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/TracerAutoConfiguration.java b/instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/TracerAutoConfiguration.java index a2f888d60f36..5cef81603fa9 100644 --- a/instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/TracerAutoConfiguration.java +++ b/instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/TracerAutoConfiguration.java @@ -5,7 +5,7 @@ package io.opentelemetry.instrumentation.spring.autoconfigure; -import io.opentelemetry.api.OpenTelemetry; +import io.opentelemetry.api.GlobalOpenTelemetry; import io.opentelemetry.api.trace.Tracer; import io.opentelemetry.sdk.OpenTelemetrySdk; import io.opentelemetry.sdk.trace.SpanProcessor; @@ -37,7 +37,7 @@ public class TracerAutoConfiguration { public Tracer otelTracer( TracerProperties tracerProperties, ObjectProvider> spanExportersProvider) throws Exception { - Tracer tracer = OpenTelemetry.getGlobalTracer(tracerProperties.getName()); + Tracer tracer = GlobalOpenTelemetry.getTracer(tracerProperties.getName()); List spanExporters = spanExportersProvider.getIfAvailable(); if (spanExporters == null || spanExporters.isEmpty()) { diff --git a/instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/exporters/otlp/OtlpGrpcSpanExporterProperties.java b/instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/exporters/otlp/OtlpGrpcSpanExporterProperties.java index 32dbb8b6bca7..b2380967434c 100644 --- a/instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/exporters/otlp/OtlpGrpcSpanExporterProperties.java +++ b/instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/exporters/otlp/OtlpGrpcSpanExporterProperties.java @@ -5,8 +5,8 @@ package io.opentelemetry.instrumentation.spring.autoconfigure.exporters.otlp; -import static io.opentelemetry.exporter.otlp.trace.OtlpGrpcSpanExporter.DEFAULT_DEADLINE_MS; import static io.opentelemetry.exporter.otlp.trace.OtlpGrpcSpanExporter.DEFAULT_ENDPOINT; +import static io.opentelemetry.exporter.otlp.trace.OtlpGrpcSpanExporter.DEFAULT_TIMEOUT_MS; import java.time.Duration; import org.springframework.boot.context.properties.ConfigurationProperties; @@ -26,7 +26,7 @@ public final class OtlpGrpcSpanExporterProperties { private boolean enabled = true; private String serviceName = "unknown"; private String endpoint = DEFAULT_ENDPOINT; - private Duration spanTimeout = Duration.ofMillis(DEFAULT_DEADLINE_MS); + private Duration spanTimeout = Duration.ofMillis(DEFAULT_TIMEOUT_MS); public boolean isEnabled() { return enabled; diff --git a/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/TracerAutoConfigurationTest.java b/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/TracerAutoConfigurationTest.java index 45f46b88db06..41b89d1e1e6e 100644 --- a/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/TracerAutoConfigurationTest.java +++ b/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/TracerAutoConfigurationTest.java @@ -7,7 +7,7 @@ import static org.assertj.core.api.Assertions.assertThat; -import io.opentelemetry.api.OpenTelemetry; +import io.opentelemetry.api.GlobalOpenTelemetry; import io.opentelemetry.api.trace.Tracer; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; @@ -22,7 +22,7 @@ class TracerAutoConfigurationTest { static class CustomTracerConfiguration { @Bean public Tracer customTestTracer() { - return OpenTelemetry.getGlobalTracer("customTestTracer"); + return GlobalOpenTelemetry.getTracer("customTestTracer"); } } @@ -61,7 +61,7 @@ void withTracerNameProperty() { .run( (context) -> { assertThat(context.getBean("otelTracer", Tracer.class)) - .isEqualTo(OpenTelemetry.getGlobalTracer("testTracer")); + .isEqualTo(GlobalOpenTelemetry.getTracer("testTracer")); }); } } diff --git a/instrumentation/spring/spring-core-2.0/javaagent/src/test/groovy/SimpleAsyncTaskExecutorInstrumentationTest.groovy b/instrumentation/spring/spring-core-2.0/javaagent/src/test/groovy/SimpleAsyncTaskExecutorInstrumentationTest.groovy index ee476e2d702b..db34b8dc2d54 100644 --- a/instrumentation/spring/spring-core-2.0/javaagent/src/test/groovy/SimpleAsyncTaskExecutorInstrumentationTest.groovy +++ b/instrumentation/spring/spring-core-2.0/javaagent/src/test/groovy/SimpleAsyncTaskExecutorInstrumentationTest.groovy @@ -6,7 +6,7 @@ import static io.opentelemetry.api.trace.Span.Kind.INTERNAL import static io.opentelemetry.instrumentation.test.utils.TraceUtils.runUnderTrace -import io.opentelemetry.api.OpenTelemetry +import io.opentelemetry.api.GlobalOpenTelemetry import io.opentelemetry.instrumentation.test.AgentTestRunner import java.util.concurrent.Callable import java.util.concurrent.CountDownLatch @@ -68,7 +68,7 @@ class SimpleAsyncTaskExecutorInstrumentationTest extends AgentTestRunner { } class AsyncTask implements Runnable, Callable { - private static final TRACER = OpenTelemetry.getGlobalTracer("io.opentelemetry.auto") + private static final TRACER = GlobalOpenTelemetry.getTracer("io.opentelemetry.auto") final latch = new CountDownLatch(1) boolean startSpan diff --git a/instrumentation/spring/spring-data-1.8/javaagent/src/test/groovy/SpringJpaTest.groovy b/instrumentation/spring/spring-data-1.8/javaagent/src/test/groovy/SpringJpaTest.groovy index 666e8cb3908b..0dc3a2c21543 100644 --- a/instrumentation/spring/spring-data-1.8/javaagent/src/test/groovy/SpringJpaTest.groovy +++ b/instrumentation/spring/spring-data-1.8/javaagent/src/test/groovy/SpringJpaTest.groovy @@ -7,7 +7,7 @@ import static io.opentelemetry.api.trace.Span.Kind.CLIENT import static io.opentelemetry.api.trace.Span.Kind.INTERNAL import static io.opentelemetry.instrumentation.test.utils.TraceUtils.runUnderTrace -import io.opentelemetry.api.trace.attributes.SemanticAttributes +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes import io.opentelemetry.instrumentation.test.AgentTestRunner import org.springframework.context.annotation.AnnotationConfigApplicationContext import spring.jpa.JpaCustomer diff --git a/instrumentation/spring/spring-webflux-5.0/javaagent/src/test/groovy/SpringWebfluxTest.groovy b/instrumentation/spring/spring-webflux-5.0/javaagent/src/test/groovy/SpringWebfluxTest.groovy index 9dbe4e2ca070..1b99cdbca025 100644 --- a/instrumentation/spring/spring-webflux-5.0/javaagent/src/test/groovy/SpringWebfluxTest.groovy +++ b/instrumentation/spring/spring-webflux-5.0/javaagent/src/test/groovy/SpringWebfluxTest.groovy @@ -6,7 +6,7 @@ import static io.opentelemetry.api.trace.Span.Kind.INTERNAL import static io.opentelemetry.api.trace.Span.Kind.SERVER -import io.opentelemetry.api.trace.attributes.SemanticAttributes +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes import io.opentelemetry.instrumentation.api.config.Config import io.opentelemetry.instrumentation.test.AgentTestRunner import io.opentelemetry.instrumentation.test.utils.OkHttpUtils diff --git a/instrumentation/spring/spring-webflux-5.0/javaagent/src/test/groovy/server/EchoHandler.groovy b/instrumentation/spring/spring-webflux-5.0/javaagent/src/test/groovy/server/EchoHandler.groovy index 0b63ac324088..ee990c655808 100644 --- a/instrumentation/spring/spring-webflux-5.0/javaagent/src/test/groovy/server/EchoHandler.groovy +++ b/instrumentation/spring/spring-webflux-5.0/javaagent/src/test/groovy/server/EchoHandler.groovy @@ -5,7 +5,7 @@ package server -import io.opentelemetry.api.OpenTelemetry +import io.opentelemetry.api.GlobalOpenTelemetry import io.opentelemetry.api.trace.Tracer import org.springframework.http.MediaType import org.springframework.stereotype.Component @@ -16,7 +16,7 @@ import reactor.core.publisher.Mono @Component class EchoHandler { - private static final Tracer tracer = OpenTelemetry.getGlobalTracer("io.opentelemetry.auto") + private static final Tracer tracer = GlobalOpenTelemetry.getTracer("io.opentelemetry.auto") Mono echo(ServerRequest request) { tracer.spanBuilder("echo").startSpan().end() diff --git a/instrumentation/spring/spring-webflux-5.0/javaagent/src/test/groovy/server/SpringWebFluxTestApplication.groovy b/instrumentation/spring/spring-webflux-5.0/javaagent/src/test/groovy/server/SpringWebFluxTestApplication.groovy index 87d43943861a..b5280bb10b7b 100644 --- a/instrumentation/spring/spring-webflux-5.0/javaagent/src/test/groovy/server/SpringWebFluxTestApplication.groovy +++ b/instrumentation/spring/spring-webflux-5.0/javaagent/src/test/groovy/server/SpringWebFluxTestApplication.groovy @@ -9,6 +9,7 @@ import static org.springframework.web.reactive.function.server.RequestPredicates import static org.springframework.web.reactive.function.server.RequestPredicates.POST import static org.springframework.web.reactive.function.server.RouterFunctions.route +import io.opentelemetry.api.GlobalOpenTelemetry import io.opentelemetry.api.OpenTelemetry import io.opentelemetry.api.trace.Tracer import java.time.Duration @@ -26,7 +27,7 @@ import reactor.core.publisher.Mono @SpringBootApplication class SpringWebFluxTestApplication { - private static final Tracer tracer = OpenTelemetry.getGlobalTracer("io.opentelemetry.auto") + private static final Tracer tracer = GlobalOpenTelemetry.getTracer("io.opentelemetry.auto") @Bean RouterFunction echoRouterFunction(EchoHandler echoHandler) { diff --git a/instrumentation/spring/spring-webflux-5.0/javaagent/src/test/groovy/server/TestController.groovy b/instrumentation/spring/spring-webflux-5.0/javaagent/src/test/groovy/server/TestController.groovy index 05f73f4ebb5a..707c30a3f3a1 100644 --- a/instrumentation/spring/spring-webflux-5.0/javaagent/src/test/groovy/server/TestController.groovy +++ b/instrumentation/spring/spring-webflux-5.0/javaagent/src/test/groovy/server/TestController.groovy @@ -5,7 +5,7 @@ package server -import io.opentelemetry.api.OpenTelemetry +import io.opentelemetry.api.GlobalOpenTelemetry import io.opentelemetry.api.trace.Tracer import java.time.Duration import org.springframework.web.bind.annotation.GetMapping @@ -16,7 +16,7 @@ import reactor.core.publisher.Mono @RestController class TestController { - private static final Tracer tracer = OpenTelemetry.getGlobalTracer("io.opentelemetry.auto") + private static final Tracer tracer = GlobalOpenTelemetry.getTracer("io.opentelemetry.auto") @GetMapping("/foo") Mono getFooModel() { diff --git a/instrumentation/spring/spring-webmvc-3.1/javaagent/src/test/groovy/test/boot/SpringBootBasedTest.groovy b/instrumentation/spring/spring-webmvc-3.1/javaagent/src/test/groovy/test/boot/SpringBootBasedTest.groovy index 931c35919794..5169da954085 100644 --- a/instrumentation/spring/spring-webmvc-3.1/javaagent/src/test/groovy/test/boot/SpringBootBasedTest.groovy +++ b/instrumentation/spring/spring-webmvc-3.1/javaagent/src/test/groovy/test/boot/SpringBootBasedTest.groovy @@ -15,7 +15,7 @@ import static io.opentelemetry.instrumentation.test.base.HttpServerTest.ServerEn import static io.opentelemetry.instrumentation.test.base.HttpServerTest.ServerEndpoint.SUCCESS import com.google.common.collect.ImmutableMap -import io.opentelemetry.api.trace.attributes.SemanticAttributes +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes import io.opentelemetry.instrumentation.test.asserts.TraceAssert import io.opentelemetry.instrumentation.test.base.HttpServerTest import io.opentelemetry.sdk.trace.data.SpanData diff --git a/instrumentation/spymemcached-2.12/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/spymemcached/MemcacheClientTracer.java b/instrumentation/spymemcached-2.12/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/spymemcached/MemcacheClientTracer.java index 16d3c072cbde..a660152a82e2 100644 --- a/instrumentation/spymemcached-2.12/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/spymemcached/MemcacheClientTracer.java +++ b/instrumentation/spymemcached-2.12/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/spymemcached/MemcacheClientTracer.java @@ -6,8 +6,8 @@ package io.opentelemetry.javaagent.instrumentation.spymemcached; import io.opentelemetry.api.trace.Span; -import io.opentelemetry.api.trace.attributes.SemanticAttributes; import io.opentelemetry.instrumentation.api.tracer.DatabaseClientTracer; +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes; import java.net.InetSocketAddress; import net.spy.memcached.MemcachedConnection; diff --git a/instrumentation/spymemcached-2.12/javaagent/src/test/groovy/SpymemcachedTest.groovy b/instrumentation/spymemcached-2.12/javaagent/src/test/groovy/SpymemcachedTest.groovy index 96b7180198fb..37258bb22b43 100644 --- a/instrumentation/spymemcached-2.12/javaagent/src/test/groovy/SpymemcachedTest.groovy +++ b/instrumentation/spymemcached-2.12/javaagent/src/test/groovy/SpymemcachedTest.groovy @@ -8,7 +8,7 @@ import static io.opentelemetry.instrumentation.test.utils.TraceUtils.runUnderTra import static net.spy.memcached.ConnectionFactoryBuilder.Protocol.BINARY import com.google.common.util.concurrent.MoreExecutors -import io.opentelemetry.api.trace.attributes.SemanticAttributes +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes import io.opentelemetry.instrumentation.test.AgentTestRunner import io.opentelemetry.instrumentation.test.asserts.TraceAssert import io.opentelemetry.javaagent.instrumentation.spymemcached.CompletionListener diff --git a/instrumentation/struts-2.3/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/struts2/Struts2Tracer.java b/instrumentation/struts-2.3/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/struts2/Struts2Tracer.java index 30227e71a053..a15c7159bcb1 100644 --- a/instrumentation/struts-2.3/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/struts2/Struts2Tracer.java +++ b/instrumentation/struts-2.3/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/struts2/Struts2Tracer.java @@ -8,10 +8,10 @@ import com.opensymphony.xwork2.ActionInvocation; import com.opensymphony.xwork2.ActionProxy; import io.opentelemetry.api.trace.Span; -import io.opentelemetry.api.trace.attributes.SemanticAttributes; import io.opentelemetry.context.Context; import io.opentelemetry.instrumentation.api.servlet.ServletContextPath; import io.opentelemetry.instrumentation.api.tracer.BaseTracer; +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes; public class Struts2Tracer extends BaseTracer { diff --git a/instrumentation/vertx-reactive-3.5/javaagent/src/test/groovy/VertxReactivePropagationTest.groovy b/instrumentation/vertx-reactive-3.5/javaagent/src/test/groovy/VertxReactivePropagationTest.groovy index 3b5c4aa9f676..774d5f5e5005 100644 --- a/instrumentation/vertx-reactive-3.5/javaagent/src/test/groovy/VertxReactivePropagationTest.groovy +++ b/instrumentation/vertx-reactive-3.5/javaagent/src/test/groovy/VertxReactivePropagationTest.groovy @@ -8,7 +8,7 @@ import static io.opentelemetry.api.trace.Span.Kind.SERVER import static io.opentelemetry.instrumentation.test.base.HttpServerTest.ServerEndpoint.SUCCESS import static io.opentelemetry.instrumentation.test.utils.TraceUtils.basicSpan -import io.opentelemetry.api.trace.attributes.SemanticAttributes +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes import io.opentelemetry.instrumentation.test.AgentTestRunner import io.opentelemetry.instrumentation.test.utils.OkHttpUtils import io.opentelemetry.instrumentation.test.utils.PortUtils diff --git a/instrumentation/vertx-reactive-3.5/javaagent/src/test/java/VertxReactiveWebServer.java b/instrumentation/vertx-reactive-3.5/javaagent/src/test/java/VertxReactiveWebServer.java index cef911d703f9..e64ca6bbe7fb 100644 --- a/instrumentation/vertx-reactive-3.5/javaagent/src/test/java/VertxReactiveWebServer.java +++ b/instrumentation/vertx-reactive-3.5/javaagent/src/test/java/VertxReactiveWebServer.java @@ -5,7 +5,7 @@ import static io.opentelemetry.instrumentation.test.base.HttpServerTest.ServerEndpoint.SUCCESS; -import io.opentelemetry.api.OpenTelemetry; +import io.opentelemetry.api.GlobalOpenTelemetry; import io.opentelemetry.api.trace.Span; import io.opentelemetry.api.trace.Tracer; import io.opentelemetry.context.Context; @@ -34,7 +34,7 @@ public class VertxReactiveWebServer extends AbstractVerticle { private static final Logger log = LoggerFactory.getLogger(VertxReactiveWebServer.class); - private static final Tracer tracer = OpenTelemetry.getGlobalTracer("test"); + private static final Tracer tracer = GlobalOpenTelemetry.getTracer("test"); private static final String CONFIG_HTTP_SERVER_PORT = "http.server.port"; private static JDBCClient client; diff --git a/javaagent-api/src/main/java/io/opentelemetry/javaagent/instrumentation/api/Java8BytecodeBridge.java b/javaagent-api/src/main/java/io/opentelemetry/javaagent/instrumentation/api/Java8BytecodeBridge.java index 4240edfe353b..b65a58d68bf3 100644 --- a/javaagent-api/src/main/java/io/opentelemetry/javaagent/instrumentation/api/Java8BytecodeBridge.java +++ b/javaagent-api/src/main/java/io/opentelemetry/javaagent/instrumentation/api/Java8BytecodeBridge.java @@ -5,6 +5,7 @@ package io.opentelemetry.javaagent.instrumentation.api; +import io.opentelemetry.api.GlobalOpenTelemetry; import io.opentelemetry.api.OpenTelemetry; import io.opentelemetry.api.trace.Span; import io.opentelemetry.api.trace.Tracer; @@ -36,11 +37,11 @@ public static Span spanFromContext(Context context) { } public static ContextPropagators getGlobalPropagators() { - return OpenTelemetry.getGlobalPropagators(); + return GlobalOpenTelemetry.getPropagators(); } /** Calls {@link OpenTelemetry#getGlobalTracer(String)}. */ public static Tracer getGlobalTracer(String name) { - return OpenTelemetry.getGlobalTracer(name); + return GlobalOpenTelemetry.getTracer(name); } } diff --git a/javaagent-bootstrap/javaagent-bootstrap.gradle b/javaagent-bootstrap/javaagent-bootstrap.gradle index 7331e299ed6e..92a5de2f8699 100644 --- a/javaagent-bootstrap/javaagent-bootstrap.gradle +++ b/javaagent-bootstrap/javaagent-bootstrap.gradle @@ -9,6 +9,7 @@ minimumInstructionCoverage = 0.0 dependencies { api deps.opentelemetryApi + api deps.opentelemetryApiMetrics compileOnly deps.opentelemetrySdk implementation deps.slf4j implementation group: 'org.slf4j', name: 'slf4j-simple', version: versions.slf4j diff --git a/javaagent-exporters/javaagent-exporters.gradle b/javaagent-exporters/javaagent-exporters.gradle index 721e70ab8582..4b210578c4f9 100644 --- a/javaagent-exporters/javaagent-exporters.gradle +++ b/javaagent-exporters/javaagent-exporters.gradle @@ -69,6 +69,7 @@ shadowJar { // relocate OpenTelemetry API usage relocate "io.opentelemetry.api", "io.opentelemetry.javaagent.shaded.io.opentelemetry.api" + relocate "io.opentelemetry.semconv", "io.opentelemetry.javaagent.shaded.io.opentelemetry.semconv" relocate "io.opentelemetry.spi", "io.opentelemetry.javaagent.shaded.io.opentelemetry.spi" relocate "io.opentelemetry.context", "io.opentelemetry.javaagent.shaded.io.opentelemetry.context" diff --git a/javaagent-spi/javaagent-spi.gradle b/javaagent-spi/javaagent-spi.gradle index b9af4093f753..b34463ba6563 100644 --- a/javaagent-spi/javaagent-spi.gradle +++ b/javaagent-spi/javaagent-spi.gradle @@ -5,5 +5,6 @@ apply from: "$rootDir/gradle/publish.gradle" dependencies { compileOnly deps.opentelemetrySdk + compileOnly deps.opentelemetrySdkMetrics compileOnly deps.bytebuddy } \ No newline at end of file diff --git a/javaagent-spi/src/main/java/io/opentelemetry/javaagent/spi/ComponentInstaller.java b/javaagent-spi/src/main/java/io/opentelemetry/javaagent/spi/ComponentInstaller.java index e84f67420e2b..343d86b5a255 100644 --- a/javaagent-spi/src/main/java/io/opentelemetry/javaagent/spi/ComponentInstaller.java +++ b/javaagent-spi/src/main/java/io/opentelemetry/javaagent/spi/ComponentInstaller.java @@ -25,8 +25,8 @@ public interface ComponentInstaller { * and InstrumentationContext falls back to the less performant Map implementation for those * classes. */ - void beforeByteBuddyAgent(); + default void beforeByteBuddyAgent() {} /** Runs after instrumentations are added to ByteBuddy. */ - void afterByteBuddyAgent(); + default void afterByteBuddyAgent() {} } diff --git a/javaagent-tooling/javaagent-tooling.gradle b/javaagent-tooling/javaagent-tooling.gradle index 7c3fa74cfe72..a66a40dec407 100644 --- a/javaagent-tooling/javaagent-tooling.gradle +++ b/javaagent-tooling/javaagent-tooling.gradle @@ -19,8 +19,10 @@ dependencies { implementation project(':instrumentation-api') implementation deps.opentelemetryApi + implementation deps.opentelemetryApiMetrics implementation deps.opentelemetryContext implementation deps.opentelemetrySdk + implementation deps.opentelemetrySdkMetrics implementation deps.opentelemetryKotlin implementation deps.opentelemetryTraceProps implementation(deps.opentelemetryResources) { diff --git a/javaagent-tooling/src/main/java/io/opentelemetry/javaagent/tooling/AddThreadDetailsSpanProcessor.java b/javaagent-tooling/src/main/java/io/opentelemetry/javaagent/tooling/AddThreadDetailsSpanProcessor.java index 251e0b78b51d..426098256504 100644 --- a/javaagent-tooling/src/main/java/io/opentelemetry/javaagent/tooling/AddThreadDetailsSpanProcessor.java +++ b/javaagent-tooling/src/main/java/io/opentelemetry/javaagent/tooling/AddThreadDetailsSpanProcessor.java @@ -5,12 +5,12 @@ package io.opentelemetry.javaagent.tooling; -import io.opentelemetry.api.trace.attributes.SemanticAttributes; import io.opentelemetry.context.Context; import io.opentelemetry.sdk.common.CompletableResultCode; import io.opentelemetry.sdk.trace.ReadWriteSpan; import io.opentelemetry.sdk.trace.ReadableSpan; import io.opentelemetry.sdk.trace.SpanProcessor; +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes; public class AddThreadDetailsSpanProcessor implements SpanProcessor { diff --git a/javaagent-tooling/src/main/java/io/opentelemetry/javaagent/tooling/OpenTelemetryInstaller.java b/javaagent-tooling/src/main/java/io/opentelemetry/javaagent/tooling/OpenTelemetryInstaller.java index 97e58fa617c5..dace00343b1d 100644 --- a/javaagent-tooling/src/main/java/io/opentelemetry/javaagent/tooling/OpenTelemetryInstaller.java +++ b/javaagent-tooling/src/main/java/io/opentelemetry/javaagent/tooling/OpenTelemetryInstaller.java @@ -6,7 +6,7 @@ package io.opentelemetry.javaagent.tooling; import com.google.auto.service.AutoService; -import io.opentelemetry.api.OpenTelemetry; +import io.opentelemetry.api.metrics.GlobalMetricsProvider; import io.opentelemetry.instrumentation.api.config.Config; import io.opentelemetry.javaagent.instrumentation.api.OpenTelemetrySdkAccess; import io.opentelemetry.javaagent.spi.ComponentInstaller; @@ -15,6 +15,7 @@ import io.opentelemetry.javaagent.spi.exporter.MetricServer; import io.opentelemetry.javaagent.spi.exporter.SpanExporterFactory; import io.opentelemetry.sdk.OpenTelemetrySdk; +import io.opentelemetry.sdk.metrics.SdkMeterProvider; import io.opentelemetry.sdk.metrics.export.IntervalMetricReader; import io.opentelemetry.sdk.metrics.export.MetricExporter; import io.opentelemetry.sdk.metrics.export.MetricProducer; @@ -46,31 +47,22 @@ public class OpenTelemetryInstaller implements ComponentInstaller { @Override public void beforeByteBuddyAgent() { - // calling (shaded) OpenTelemetry.getGlobalTracerProvider() with context class loader set to - // the - // agent class loader, so that SPI finds the agent's (isolated) SDK, and (shaded) - // OpenTelemetry registers it, and then when instrumentation calls (shaded) - // OpenTelemetry.getGlobalTracerProvider() later, they get back the agent's (isolated) SDK - // - // but if we don't trigger this early registration, then if instrumentation is the first to - // call (shaded) OpenTelemetry.getGlobalTracerProvider(), then SPI can't see the agent class - // loader, - // and so (shaded) OpenTelemetry registers the no-op TracerFactory, and it cannot be replaced - // later - OpenTelemetry.getGlobalTracerProvider(); - OpenTelemetrySdkAccess.internalSetForceFlush( - (timeout, unit) -> - OpenTelemetrySdk.getGlobalTracerManagement().forceFlush().join(timeout, unit)); - } - - @Override - public void afterByteBuddyAgent() { installAgentTracer(); } /** Register agent tracer if no agent tracer is already registered. */ @SuppressWarnings("unused") public static synchronized void installAgentTracer() { + // TODO(anuraaga): Replace with opentelemetry-sdk-extension-autoconfigure + OpenTelemetrySdk.builder() + .setPropagators( + PropagatorsInitializer.initializePropagators( + Config.get().getListProperty(PROPAGATORS_CONFIG))) + .buildAndRegisterGlobal(); + OpenTelemetrySdkAccess.internalSetForceFlush( + (timeout, unit) -> + OpenTelemetrySdk.getGlobalTracerManagement().forceFlush().join(timeout, unit)); + if (Config.get().getBooleanProperty(JAVAAGENT_ENABLED_CONFIG, true)) { Properties config = Config.get().asJavaProperties(); @@ -86,8 +78,6 @@ public static synchronized void installAgentTracer() { } else { log.info("Tracing is disabled."); } - - PropagatorsInitializer.initializePropagators(Config.get().getListProperty(PROPAGATORS_CONFIG)); } private static synchronized void installExporters(List exporters, Properties config) { @@ -188,8 +178,7 @@ private static void installExporter( IntervalMetricReader.builder() .readProperties(config) .setMetricExporter(metricExporter) - .setMetricProducers( - Collections.singleton(OpenTelemetrySdk.getGlobalMeterProvider().getMetricProducer())) + .setMetricProducers(Collections.singleton((SdkMeterProvider) GlobalMetricsProvider.get())) .build(); log.info("Installed metric exporter: " + metricExporter.getClass().getName()); } @@ -203,7 +192,7 @@ private static void installExporter(SpanExporterFactory spanExporterFactory, Pro } private static void installMetricServer(MetricServer metricServer, Properties config) { - MetricProducer metricProducer = OpenTelemetrySdk.getGlobalMeterProvider().getMetricProducer(); + MetricProducer metricProducer = (SdkMeterProvider) GlobalMetricsProvider.get(); metricServer.start(metricProducer, config); log.info("Installed metric server: " + metricServer.getClass().getName()); } diff --git a/javaagent-tooling/src/main/java/io/opentelemetry/javaagent/tooling/PropagatorsInitializer.java b/javaagent-tooling/src/main/java/io/opentelemetry/javaagent/tooling/PropagatorsInitializer.java index 2b38b71ef39b..28073a8dc044 100644 --- a/javaagent-tooling/src/main/java/io/opentelemetry/javaagent/tooling/PropagatorsInitializer.java +++ b/javaagent-tooling/src/main/java/io/opentelemetry/javaagent/tooling/PropagatorsInitializer.java @@ -14,7 +14,7 @@ import io.opentelemetry.context.Context; import io.opentelemetry.context.propagation.ContextPropagators; import io.opentelemetry.context.propagation.TextMapPropagator; -import io.opentelemetry.extension.trace.propagation.AwsXRayPropagator; +import io.opentelemetry.extension.trace.propagation.AwsXrayPropagator; import io.opentelemetry.extension.trace.propagation.B3Propagator; import io.opentelemetry.extension.trace.propagation.JaegerPropagator; import io.opentelemetry.extension.trace.propagation.OtTracerPropagator; @@ -23,7 +23,6 @@ import java.util.Collection; import java.util.List; import java.util.Map; -import java.util.function.Consumer; import java.util.function.Supplier; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -57,22 +56,15 @@ public class PropagatorsInitializer { * previous one. * */ - public static void initializePropagators(List propagatorIds) { - initializePropagators( - propagatorIds, - () -> GlobalOpenTelemetry.get().getPropagators().getTextMapPropagator(), - p -> GlobalOpenTelemetry.get().setPropagators(p)); + public static ContextPropagators initializePropagators(List propagatorIds) { + return initializePropagators( + propagatorIds, () -> GlobalOpenTelemetry.get().getPropagators().getTextMapPropagator()); } // exists for testing - static void initializePropagators( - List propagatorIds, - Supplier preconfiguredPropagator, - Consumer globalSetter) { - ContextPropagators propagators = - createPropagators(propagatorIds, preconfiguredPropagator.get()); - // Register it in the global propagators: - globalSetter.accept(propagators); + static ContextPropagators initializePropagators( + List propagatorIds, Supplier preconfiguredPropagator) { + return createPropagators(propagatorIds, preconfiguredPropagator.get()); } private static ContextPropagators createPropagators( @@ -122,7 +114,7 @@ enum Propagator implements TextMapPropagator { B3_MULTI("b3multi", B3Propagator.builder().injectMultipleHeaders().build(), false), OT_TRACER("ottracer", OtTracerPropagator.getInstance(), false), TRACE_CONTEXT("tracecontext", W3CTraceContextPropagator.getInstance(), false), - XRAY("xray", AwsXRayPropagator.getInstance(), false); + XRAY("xray", AwsXrayPropagator.getInstance(), false); private final String id; private final TextMapPropagator delegate; diff --git a/javaagent-tooling/src/test/groovy/io/opentelemetry/javaagent/tooling/AddThreadDetailsSpanProcessorTest.groovy b/javaagent-tooling/src/test/groovy/io/opentelemetry/javaagent/tooling/AddThreadDetailsSpanProcessorTest.groovy index ce321a7a4956..704179c4a599 100644 --- a/javaagent-tooling/src/test/groovy/io/opentelemetry/javaagent/tooling/AddThreadDetailsSpanProcessorTest.groovy +++ b/javaagent-tooling/src/test/groovy/io/opentelemetry/javaagent/tooling/AddThreadDetailsSpanProcessorTest.groovy @@ -5,7 +5,7 @@ package io.opentelemetry.javaagent.tooling -import io.opentelemetry.api.trace.attributes.SemanticAttributes +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes import io.opentelemetry.context.Context import io.opentelemetry.sdk.trace.ReadWriteSpan import spock.lang.Specification diff --git a/javaagent-tooling/src/test/java/io/opentelemetry/javaagent/tooling/PropagatorsInitializerTest.java b/javaagent-tooling/src/test/java/io/opentelemetry/javaagent/tooling/PropagatorsInitializerTest.java index 16c3660274ad..7c387f92766b 100644 --- a/javaagent-tooling/src/test/java/io/opentelemetry/javaagent/tooling/PropagatorsInitializerTest.java +++ b/javaagent-tooling/src/test/java/io/opentelemetry/javaagent/tooling/PropagatorsInitializerTest.java @@ -11,148 +11,108 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -import io.opentelemetry.api.baggage.propagation.W3CBaggagePropagator; -import io.opentelemetry.api.trace.propagation.W3CTraceContextPropagator; import io.opentelemetry.context.propagation.ContextPropagators; import io.opentelemetry.context.propagation.TextMapPropagator; import java.util.Arrays; +import java.util.Collections; import java.util.List; -import java.util.concurrent.atomic.AtomicReference; -import java.util.function.Consumer; import java.util.function.Supplier; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; class PropagatorsInitializerTest { - AtomicReference seen; TextMapPropagator mockPreconfigured; @BeforeEach void setup() { - seen = new AtomicReference<>(); mockPreconfigured = mock(TextMapPropagator.class); } @Test void initialize_noIdsPassedNotPreconfigured() { List ids = emptyList(); - Consumer setter = seen::set; - - PropagatorsInitializer.initializePropagators(ids, TextMapPropagator::noop, setter); - - assertThat(seen.get().getTextMapPropagator()) - .extracting("textPropagators") - .isInstanceOfSatisfying( - TextMapPropagator[].class, - p -> - assertThat(p) - .containsExactlyInAnyOrder( - W3CTraceContextPropagator.getInstance(), - W3CBaggagePropagator.getInstance())); + + ContextPropagators propagators = + PropagatorsInitializer.initializePropagators(ids, TextMapPropagator::noop); + + assertThat(propagators.getTextMapPropagator().fields()) + .containsExactlyInAnyOrder("traceparent", "tracestate", "baggage"); } @Test void initialize_noIdsPassedWithPreconfigured() { List ids = emptyList(); - Consumer setter = seen::set; TextMapPropagator mockPropagator = mock(TextMapPropagator.class); + when(mockPropagator.fields()).thenReturn(Collections.singleton("test")); Supplier preconfigured = () -> mockPropagator; - PropagatorsInitializer.initializePropagators(ids, preconfigured, setter); - - assertThat(seen.get().getTextMapPropagator()) - .extracting("textPropagators") - .isInstanceOfSatisfying( - TextMapPropagator[].class, - p -> - assertThat(p) - .containsExactlyInAnyOrder( - W3CTraceContextPropagator.getInstance(), - W3CBaggagePropagator.getInstance(), - mockPropagator)); + ContextPropagators propagators = + PropagatorsInitializer.initializePropagators(ids, preconfigured); + + assertThat(propagators.getTextMapPropagator().fields()) + .containsExactlyInAnyOrder("traceparent", "tracestate", "baggage", "test"); } @Test void initialize_preconfiguredSameAsId() { List ids = singletonList("jaeger"); - Consumer setter = seen::set; Supplier preconfigured = () -> PropagatorsInitializer.Propagator.JAEGER; - PropagatorsInitializer.initializePropagators(ids, preconfigured, setter); + ContextPropagators propagators = + PropagatorsInitializer.initializePropagators(ids, preconfigured); - assertThat(seen.get().getTextMapPropagator()) - .isSameAs(PropagatorsInitializer.Propagator.JAEGER); + assertThat(propagators.getTextMapPropagator().fields()) + .containsExactlyInAnyOrder("uber-trace-id"); } @Test void initialize_preconfiguredDuplicatedInIds() { List ids = Arrays.asList("b3", "jaeger", "b3"); - Consumer setter = seen::set; Supplier preconfigured = () -> PropagatorsInitializer.Propagator.JAEGER; - PropagatorsInitializer.initializePropagators(ids, preconfigured, setter); - - assertThat(seen.get().getTextMapPropagator()) - .extracting("textPropagators") - .isInstanceOfSatisfying( - TextMapPropagator[].class, - p -> - assertThat(p) - .containsExactlyInAnyOrder( - PropagatorsInitializer.Propagator.B3, - PropagatorsInitializer.Propagator.JAEGER)); + ContextPropagators propagators = + PropagatorsInitializer.initializePropagators(ids, preconfigured); + + assertThat(propagators.getTextMapPropagator().fields()) + .containsExactlyInAnyOrder( + "uber-trace-id", "X-B3-TraceId", "X-B3-SpanId", "X-B3-Sampled", "b3"); } @Test void initialize_justOneId() { List ids = singletonList("jaeger"); - Consumer setter = seen::set; Supplier preconfigured = TextMapPropagator::noop; - PropagatorsInitializer.initializePropagators(ids, preconfigured, setter); + ContextPropagators propagators = + PropagatorsInitializer.initializePropagators(ids, preconfigured); - assertThat(seen.get().getTextMapPropagator()) - .isSameAs(PropagatorsInitializer.Propagator.JAEGER); + assertThat(propagators.getTextMapPropagator().fields()) + .containsExactlyInAnyOrder("uber-trace-id"); } @Test void initialize_idsWithNoPreconfigured() { List ids = Arrays.asList("b3", "unknown-but-no-harm-done", "jaeger"); - Consumer setter = seen::set; Supplier preconfigured = TextMapPropagator::noop; - PropagatorsInitializer.initializePropagators(ids, preconfigured, setter); - - assertThat(seen.get().getTextMapPropagator()) - .extracting("textPropagators") - .isInstanceOfSatisfying( - TextMapPropagator[].class, - p -> - assertThat(p) - .containsExactlyInAnyOrder( - PropagatorsInitializer.Propagator.B3, - PropagatorsInitializer.Propagator.JAEGER)); + ContextPropagators propagators = + PropagatorsInitializer.initializePropagators(ids, preconfigured); + + assertThat(propagators.getTextMapPropagator().fields()) + .containsExactlyInAnyOrder( + "uber-trace-id", "X-B3-TraceId", "X-B3-SpanId", "X-B3-Sampled", "b3"); } @Test void initialize_idsAndPreconfigured() { List ids = Arrays.asList("jaeger", "xray"); - Consumer setter = seen::set; when(mockPreconfigured.fields()).thenReturn(singletonList("mocked")); Supplier preconfigured = () -> mockPreconfigured; - PropagatorsInitializer.initializePropagators(ids, preconfigured, setter); - - assertThat(seen.get().getTextMapPropagator()) - .extracting("textPropagators") - .isInstanceOfSatisfying( - TextMapPropagator[].class, - p -> - assertThat(p) - .containsExactlyInAnyOrder( - mockPreconfigured, - PropagatorsInitializer.Propagator.JAEGER, - PropagatorsInitializer.Propagator.XRAY)); + ContextPropagators propagators = + PropagatorsInitializer.initializePropagators(ids, preconfigured); + assertThat(propagators.getTextMapPropagator().fields()) + .containsExactlyInAnyOrder("uber-trace-id", "X-Amzn-Trace-Id", "mocked"); } } diff --git a/javaagent/javaagent.gradle b/javaagent/javaagent.gradle index 6f95e0ae19cd..992ad6416888 100644 --- a/javaagent/javaagent.gradle +++ b/javaagent/javaagent.gradle @@ -90,6 +90,7 @@ tasks.withType(ShadowJar).configureEach { // relocate OpenTelemetry API relocate "io.opentelemetry.api", "io.opentelemetry.javaagent.shaded.io.opentelemetry.api" + relocate "io.opentelemetry.semconv", "io.opentelemetry.javaagent.shaded.io.opentelemetry.semconv" relocate "io.opentelemetry.spi", "io.opentelemetry.javaagent.shaded.io.opentelemetry.spi" relocate "io.opentelemetry.context", "io.opentelemetry.javaagent.shaded.io.opentelemetry.context" diff --git a/load-generator/src/main/java/io/opentelemetry/loadgenerator/LoadGenerator.java b/load-generator/src/main/java/io/opentelemetry/loadgenerator/LoadGenerator.java index cf42ae22e973..3a159c9e910a 100644 --- a/load-generator/src/main/java/io/opentelemetry/loadgenerator/LoadGenerator.java +++ b/load-generator/src/main/java/io/opentelemetry/loadgenerator/LoadGenerator.java @@ -6,7 +6,7 @@ package io.opentelemetry.loadgenerator; import com.google.common.util.concurrent.RateLimiter; -import io.opentelemetry.api.OpenTelemetry; +import io.opentelemetry.api.GlobalOpenTelemetry; import io.opentelemetry.api.trace.Span; import io.opentelemetry.api.trace.Tracer; import io.opentelemetry.context.Scope; @@ -22,7 +22,7 @@ description = "Generates traces and spans at a specified rate") public class LoadGenerator implements Callable { - private static final Tracer tracer = OpenTelemetry.getGlobalTracer("io.opentelemetry.auto"); + private static final Tracer tracer = GlobalOpenTelemetry.getTracer("io.opentelemetry.auto"); @Option(names = "--rate", required = true, description = "rate, per second, to generate traces") private int rate; diff --git a/opentelemetry-api-shaded-for-instrumenting/opentelemetry-api-shaded-for-instrumenting.gradle b/opentelemetry-api-shaded-for-instrumenting/opentelemetry-api-shaded-for-instrumenting.gradle index dcc904deeb2a..b5bef1c92a8f 100644 --- a/opentelemetry-api-shaded-for-instrumenting/opentelemetry-api-shaded-for-instrumenting.gradle +++ b/opentelemetry-api-shaded-for-instrumenting/opentelemetry-api-shaded-for-instrumenting.gradle @@ -6,6 +6,7 @@ apply from: "$rootDir/gradle/java.gradle" dependencies { implementation deps.opentelemetryApi + implementation deps.opentelemetryApiMetrics implementation deps.opentelemetryContext } diff --git a/settings.gradle b/settings.gradle index 9c3c7780ddb1..f689d0392fe0 100644 --- a/settings.gradle +++ b/settings.gradle @@ -159,6 +159,7 @@ include ':instrumentation:okhttp:okhttp-2.2:javaagent' include ':instrumentation:okhttp:okhttp-3.0:javaagent' include ':instrumentation:opentelemetry-annotations-1.0:javaagent' include ':instrumentation:opentelemetry-api-1.0:javaagent' +include ':instrumentation:opentelemetry-api-metrics-1.0:javaagent' include ':instrumentation:opentelemetry-sdk-1.0:javaagent' include ':instrumentation:oshi:javaagent' include ':instrumentation:oshi:library' diff --git a/smoke-tests/src/test/groovy/io/opentelemetry/smoketest/GrpcSmokeTest.groovy b/smoke-tests/src/test/groovy/io/opentelemetry/smoketest/GrpcSmokeTest.groovy index b9bf87973386..fc51bf3e3818 100644 --- a/smoke-tests/src/test/groovy/io/opentelemetry/smoketest/GrpcSmokeTest.groovy +++ b/smoke-tests/src/test/groovy/io/opentelemetry/smoketest/GrpcSmokeTest.groovy @@ -17,7 +17,7 @@ import spock.lang.Unroll class GrpcSmokeTest extends SmokeTest { protected String getTargetImage(String jdk, String serverVersion) { - "ghcr.io/open-telemetry/java-test-containers:smoke-grpc-jdk$jdk-20201217.427450992" + "ghcr.io/open-telemetry/java-test-containers:smoke-grpc-jdk$jdk-20210114.484678778" } @Unroll diff --git a/smoke-tests/src/test/groovy/io/opentelemetry/smoketest/JaegerExporterSmokeTest.groovy b/smoke-tests/src/test/groovy/io/opentelemetry/smoketest/JaegerExporterSmokeTest.groovy index bc35dc03c361..76c2baf05649 100644 --- a/smoke-tests/src/test/groovy/io/opentelemetry/smoketest/JaegerExporterSmokeTest.groovy +++ b/smoke-tests/src/test/groovy/io/opentelemetry/smoketest/JaegerExporterSmokeTest.groovy @@ -15,7 +15,7 @@ import okhttp3.Request class JaegerExporterSmokeTest extends SmokeTest { protected String getTargetImage(String jdk, String serverVersion) { - "ghcr.io/open-telemetry/java-test-containers:smoke-springboot-jdk$jdk-20201217.427450994" + "ghcr.io/open-telemetry/java-test-containers:smoke-springboot-jdk$jdk-20210114.484678777" } @Override diff --git a/smoke-tests/src/test/groovy/io/opentelemetry/smoketest/JaegerThriftExporterSmokeTest.groovy b/smoke-tests/src/test/groovy/io/opentelemetry/smoketest/JaegerThriftExporterSmokeTest.groovy index dc1d81d6e6d7..4b4ceca52d9a 100644 --- a/smoke-tests/src/test/groovy/io/opentelemetry/smoketest/JaegerThriftExporterSmokeTest.groovy +++ b/smoke-tests/src/test/groovy/io/opentelemetry/smoketest/JaegerThriftExporterSmokeTest.groovy @@ -16,7 +16,7 @@ import static java.util.stream.Collectors.toSet class JaegerThriftExporterSmokeTest extends SmokeTest { protected String getTargetImage(String jdk, String serverVersion) { - "ghcr.io/open-telemetry/java-test-containers:smoke-springboot-jdk$jdk-20201217.427450994" + "ghcr.io/open-telemetry/java-test-containers:smoke-springboot-jdk$jdk-20210114.484678777" } @Override diff --git a/smoke-tests/src/test/groovy/io/opentelemetry/smoketest/PropagationTest.groovy b/smoke-tests/src/test/groovy/io/opentelemetry/smoketest/PropagationTest.groovy index 47c6aaa41c27..f55b56edb766 100644 --- a/smoke-tests/src/test/groovy/io/opentelemetry/smoketest/PropagationTest.groovy +++ b/smoke-tests/src/test/groovy/io/opentelemetry/smoketest/PropagationTest.groovy @@ -14,7 +14,7 @@ import okhttp3.Request abstract class PropagationTest extends SmokeTest { protected String getTargetImage(String jdk, String serverVersion) { - "ghcr.io/open-telemetry/java-test-containers:smoke-springboot-jdk$jdk-20201217.427450994" + "ghcr.io/open-telemetry/java-test-containers:smoke-springboot-jdk$jdk-20210114.484678777" } def "Should propagate test"() { diff --git a/smoke-tests/src/test/groovy/io/opentelemetry/smoketest/SpringBootSmokeTest.groovy b/smoke-tests/src/test/groovy/io/opentelemetry/smoketest/SpringBootSmokeTest.groovy index d256ea33239e..dbff50390d21 100644 --- a/smoke-tests/src/test/groovy/io/opentelemetry/smoketest/SpringBootSmokeTest.groovy +++ b/smoke-tests/src/test/groovy/io/opentelemetry/smoketest/SpringBootSmokeTest.groovy @@ -17,7 +17,7 @@ import spock.lang.Unroll class SpringBootSmokeTest extends SmokeTest { protected String getTargetImage(String jdk, String serverVersion) { - "ghcr.io/open-telemetry/java-test-containers:smoke-springboot-jdk$jdk-20201217.427450994" + "ghcr.io/open-telemetry/java-test-containers:smoke-springboot-jdk$jdk-20210114.484678777" } @Unroll diff --git a/smoke-tests/src/test/groovy/io/opentelemetry/smoketest/SpringBootWithSamplingSmokeTest.groovy b/smoke-tests/src/test/groovy/io/opentelemetry/smoketest/SpringBootWithSamplingSmokeTest.groovy index f6ea6e48d602..eadcba4fdd2b 100644 --- a/smoke-tests/src/test/groovy/io/opentelemetry/smoketest/SpringBootWithSamplingSmokeTest.groovy +++ b/smoke-tests/src/test/groovy/io/opentelemetry/smoketest/SpringBootWithSamplingSmokeTest.groovy @@ -15,7 +15,7 @@ class SpringBootWithSamplingSmokeTest extends SmokeTest { static final int ALLOWED_DEVIATION = 0.1 * NUM_TRIES protected String getTargetImage(String jdk, String serverVersion) { - "ghcr.io/open-telemetry/java-test-containers:smoke-springboot-jdk$jdk-20201217.427450994" + "ghcr.io/open-telemetry/java-test-containers:smoke-springboot-jdk$jdk-20210114.484678777" } @Override diff --git a/smoke-tests/src/test/groovy/io/opentelemetry/smoketest/ZipkinExporterSmokeTest.groovy b/smoke-tests/src/test/groovy/io/opentelemetry/smoketest/ZipkinExporterSmokeTest.groovy index 04a1a3a40e03..6222e28927f3 100644 --- a/smoke-tests/src/test/groovy/io/opentelemetry/smoketest/ZipkinExporterSmokeTest.groovy +++ b/smoke-tests/src/test/groovy/io/opentelemetry/smoketest/ZipkinExporterSmokeTest.groovy @@ -11,7 +11,7 @@ import okhttp3.Request class ZipkinExporterSmokeTest extends SmokeTest { protected String getTargetImage(String jdk, String serverVersion) { - "ghcr.io/open-telemetry/java-test-containers:smoke-springboot-jdk$jdk-20201217.427450994" + "ghcr.io/open-telemetry/java-test-containers:smoke-springboot-jdk$jdk-20210114.484678777" } @Override diff --git a/testing-common/src/main/groovy/io/opentelemetry/instrumentation/test/AgentTestRunner.java b/testing-common/src/main/groovy/io/opentelemetry/instrumentation/test/AgentTestRunner.java index cdf83ed08b57..fad6ddcf1150 100644 --- a/testing-common/src/main/groovy/io/opentelemetry/instrumentation/test/AgentTestRunner.java +++ b/testing-common/src/main/groovy/io/opentelemetry/instrumentation/test/AgentTestRunner.java @@ -11,7 +11,7 @@ import groovy.lang.DelegatesTo; import groovy.transform.stc.ClosureParams; import groovy.transform.stc.SimpleType; -import io.opentelemetry.api.OpenTelemetry; +import io.opentelemetry.api.GlobalOpenTelemetry; import io.opentelemetry.api.trace.Span; import io.opentelemetry.api.trace.Tracer; import io.opentelemetry.instrumentation.test.asserts.InMemoryExporterAssert; @@ -61,7 +61,7 @@ public abstract class AgentTestRunner extends Specification { ((Logger) LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME)).setLevel(Level.WARN); ((Logger) LoggerFactory.getLogger("io.opentelemetry")).setLevel(Level.DEBUG); - TEST_TRACER = OpenTelemetry.getGlobalTracer("io.opentelemetry.auto"); + TEST_TRACER = GlobalOpenTelemetry.getTracer("io.opentelemetry.auto"); } protected static Tracer getTestTracer() { diff --git a/testing-common/src/main/groovy/io/opentelemetry/instrumentation/test/InstrumentationTestRunner.groovy b/testing-common/src/main/groovy/io/opentelemetry/instrumentation/test/InstrumentationTestRunner.groovy index e9eb83c638ed..5fc16c5c7333 100644 --- a/testing-common/src/main/groovy/io/opentelemetry/instrumentation/test/InstrumentationTestRunner.groovy +++ b/testing-common/src/main/groovy/io/opentelemetry/instrumentation/test/InstrumentationTestRunner.groovy @@ -5,10 +5,8 @@ package io.opentelemetry.instrumentation.test - import groovy.transform.stc.ClosureParams import groovy.transform.stc.SimpleType -import io.opentelemetry.api.OpenTelemetry import io.opentelemetry.api.trace.propagation.W3CTraceContextPropagator import io.opentelemetry.context.Context import io.opentelemetry.context.propagation.ContextPropagators @@ -18,11 +16,11 @@ import io.opentelemetry.sdk.common.CompletableResultCode import io.opentelemetry.sdk.testing.exporter.InMemorySpanExporter import io.opentelemetry.sdk.trace.ReadWriteSpan import io.opentelemetry.sdk.trace.ReadableSpan +import io.opentelemetry.sdk.trace.SdkTracerProvider import io.opentelemetry.sdk.trace.SpanProcessor import io.opentelemetry.sdk.trace.export.SimpleSpanProcessor import org.junit.Before import spock.lang.Specification - /** * A spock test runner which automatically initializes an in-memory exporter that can be used to * verify traces. @@ -35,17 +33,13 @@ abstract class InstrumentationTestRunner extends Specification { static { testExporter = InMemorySpanExporter.create() - // TODO this is probably temporary until default propagators are supplied by SDK - // https://github.com/open-telemetry/opentelemetry-java/issues/1742 - // currently checking against no-op implementation so that it won't override aws-lambda - // propagator configuration - if (OpenTelemetry.getGlobalPropagators().getTextMapPropagator().getClass().getSimpleName() == "NoopTextMapPropagator") { - OpenTelemetry.setGlobalPropagators( - ContextPropagators.create(W3CTraceContextPropagator.getInstance())) - } - OpenTelemetrySdk.getGlobalTracerManagement().addSpanProcessor(new FlushTrackingSpanProcessor()) - OpenTelemetrySdk.getGlobalTracerManagement() - .addSpanProcessor(SimpleSpanProcessor.builder(testExporter).build()) + OpenTelemetrySdk.builder() + .setTracerProvider(SdkTracerProvider.builder() + .addSpanProcessor(new FlushTrackingSpanProcessor()) + .addSpanProcessor(SimpleSpanProcessor.create(testExporter)) + .build()) + .setPropagators(ContextPropagators.create(W3CTraceContextPropagator.getInstance())) + .buildAndRegisterGlobal() } @Before diff --git a/testing-common/src/main/groovy/io/opentelemetry/instrumentation/test/asserts/EventAssert.groovy b/testing-common/src/main/groovy/io/opentelemetry/instrumentation/test/asserts/EventAssert.groovy index 352957cc7bb8..2e000686a711 100644 --- a/testing-common/src/main/groovy/io/opentelemetry/instrumentation/test/asserts/EventAssert.groovy +++ b/testing-common/src/main/groovy/io/opentelemetry/instrumentation/test/asserts/EventAssert.groovy @@ -6,21 +6,21 @@ package io.opentelemetry.instrumentation.test.asserts import static AttributesAssert.assertAttributes -import static io.opentelemetry.sdk.trace.data.SpanData.Event import groovy.transform.stc.ClosureParams import groovy.transform.stc.SimpleType import io.opentelemetry.api.common.Attributes +import io.opentelemetry.sdk.trace.data.EventData class EventAssert { - private final Event event + private final EventData event private final checked = [:] private EventAssert(event) { this.event = event } - static void assertEvent(Event event, + static void assertEvent(EventData event, @ClosureParams(value = SimpleType, options = ['io.opentelemetry.instrumentation.test.asserts.EventAssert']) @DelegatesTo(value = EventAssert, strategy = Closure.DELEGATE_FIRST) Closure spec) { def asserter = new EventAssert(event) diff --git a/testing-common/src/main/groovy/io/opentelemetry/instrumentation/test/asserts/SpanAssert.groovy b/testing-common/src/main/groovy/io/opentelemetry/instrumentation/test/asserts/SpanAssert.groovy index c833c2b6529d..6737f3f56707 100644 --- a/testing-common/src/main/groovy/io/opentelemetry/instrumentation/test/asserts/SpanAssert.groovy +++ b/testing-common/src/main/groovy/io/opentelemetry/instrumentation/test/asserts/SpanAssert.groovy @@ -14,7 +14,7 @@ import io.opentelemetry.api.common.Attributes import io.opentelemetry.api.trace.Span import io.opentelemetry.api.trace.SpanId import io.opentelemetry.api.trace.StatusCode -import io.opentelemetry.api.trace.attributes.SemanticAttributes +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes import io.opentelemetry.sdk.trace.data.SpanData import java.util.regex.Pattern @@ -113,7 +113,7 @@ class SpanAssert { def hasLink(String traceId, String spanId) { def found = false for (def link : span.links) { - if (link.context.traceIdAsHexString == traceId && link.context.spanIdAsHexString == spanId) { + if (link.spanContext.traceIdAsHexString == traceId && link.spanContext.spanIdAsHexString == spanId) { found = true break } diff --git a/testing-common/src/main/groovy/io/opentelemetry/instrumentation/test/base/HttpClientTest.groovy b/testing-common/src/main/groovy/io/opentelemetry/instrumentation/test/base/HttpClientTest.groovy index d6e2d5cc264f..ff527b0f745a 100644 --- a/testing-common/src/main/groovy/io/opentelemetry/instrumentation/test/base/HttpClientTest.groovy +++ b/testing-common/src/main/groovy/io/opentelemetry/instrumentation/test/base/HttpClientTest.groovy @@ -13,7 +13,7 @@ import static io.opentelemetry.instrumentation.test.utils.TraceUtils.basicSpan import static io.opentelemetry.instrumentation.test.utils.TraceUtils.runUnderTrace import static org.junit.Assume.assumeTrue -import io.opentelemetry.api.trace.attributes.SemanticAttributes +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes import io.opentelemetry.instrumentation.test.AgentTestRunner import io.opentelemetry.instrumentation.test.asserts.TraceAssert import io.opentelemetry.sdk.trace.data.SpanData diff --git a/testing-common/src/main/groovy/io/opentelemetry/instrumentation/test/base/HttpServerTest.groovy b/testing-common/src/main/groovy/io/opentelemetry/instrumentation/test/base/HttpServerTest.groovy index e7d9d3c9ebb1..ed6d580e8db7 100644 --- a/testing-common/src/main/groovy/io/opentelemetry/instrumentation/test/base/HttpServerTest.groovy +++ b/testing-common/src/main/groovy/io/opentelemetry/instrumentation/test/base/HttpServerTest.groovy @@ -17,7 +17,7 @@ import static org.junit.Assume.assumeTrue import ch.qos.logback.classic.Level import io.opentelemetry.api.trace.Span -import io.opentelemetry.api.trace.attributes.SemanticAttributes +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes import io.opentelemetry.instrumentation.test.AgentTestRunner import io.opentelemetry.instrumentation.test.asserts.TraceAssert import io.opentelemetry.instrumentation.test.utils.OkHttpUtils diff --git a/testing-common/src/main/groovy/io/opentelemetry/instrumentation/test/server/http/TestHttpServer.groovy b/testing-common/src/main/groovy/io/opentelemetry/instrumentation/test/server/http/TestHttpServer.groovy index bc9e3cf7f15e..6369336338ff 100644 --- a/testing-common/src/main/groovy/io/opentelemetry/instrumentation/test/server/http/TestHttpServer.groovy +++ b/testing-common/src/main/groovy/io/opentelemetry/instrumentation/test/server/http/TestHttpServer.groovy @@ -5,10 +5,10 @@ package io.opentelemetry.instrumentation.test.server.http -import static io.opentelemetry.api.OpenTelemetry.getGlobalPropagators import static io.opentelemetry.api.trace.Span.Kind.SERVER import static io.opentelemetry.instrumentation.test.server.http.HttpServletRequestExtractAdapter.GETTER +import io.opentelemetry.api.GlobalOpenTelemetry import io.opentelemetry.api.OpenTelemetry import io.opentelemetry.api.trace.Span import io.opentelemetry.api.trace.SpanBuilder @@ -32,7 +32,7 @@ import org.eclipse.jetty.server.handler.HandlerList class TestHttpServer implements AutoCloseable { - private static final Tracer tracer = OpenTelemetry.getGlobalTracer("io.opentelemetry.auto") + private static final Tracer tracer = GlobalOpenTelemetry.getTracer("io.opentelemetry.auto") static TestHttpServer httpServer(@DelegatesTo(value = TestHttpServer, strategy = Closure.DELEGATE_FIRST) Closure spec) { @@ -251,7 +251,7 @@ class TestHttpServer implements AutoCloseable { if (isTestServer) { final SpanBuilder spanBuilder = tracer.spanBuilder("test-http-server").setSpanKind(SERVER) // using Context.root() to avoid inheriting any potentially leaked context here - spanBuilder.setParent(getGlobalPropagators().getTextMapPropagator().extract(Context.root(), req, GETTER)) + spanBuilder.setParent(GlobalOpenTelemetry.getPropagators().getTextMapPropagator().extract(Context.root(), req, GETTER)) final Span span = spanBuilder.startSpan() span.end() } diff --git a/testing-common/src/main/groovy/io/opentelemetry/instrumentation/test/utils/TraceUtils.groovy b/testing-common/src/main/groovy/io/opentelemetry/instrumentation/test/utils/TraceUtils.groovy index 98bd942c9d69..614c0fa7299a 100644 --- a/testing-common/src/main/groovy/io/opentelemetry/instrumentation/test/utils/TraceUtils.groovy +++ b/testing-common/src/main/groovy/io/opentelemetry/instrumentation/test/utils/TraceUtils.groovy @@ -5,7 +5,7 @@ package io.opentelemetry.instrumentation.test.utils -import io.opentelemetry.api.OpenTelemetry +import io.opentelemetry.api.GlobalOpenTelemetry import io.opentelemetry.api.trace.Span import io.opentelemetry.api.trace.StatusCode import io.opentelemetry.api.trace.Tracer @@ -17,7 +17,7 @@ import java.util.concurrent.ExecutionException class TraceUtils { - private static final Tracer tracer = OpenTelemetry.getGlobalTracer("io.opentelemetry.auto") + private static final Tracer tracer = GlobalOpenTelemetry.getTracer("io.opentelemetry.auto") static T runUnderServerTrace(final String rootOperationName, final Callable r) { return ServerTraceUtils.runUnderServerTrace(rootOperationName, r) diff --git a/testing-common/src/main/java/io/opentelemetry/javaagent/testing/common/AgentTestingExporterAccess.java b/testing-common/src/main/java/io/opentelemetry/javaagent/testing/common/AgentTestingExporterAccess.java index 4720a276ac05..4adbbc47266d 100644 --- a/testing-common/src/main/java/io/opentelemetry/javaagent/testing/common/AgentTestingExporterAccess.java +++ b/testing-common/src/main/java/io/opentelemetry/javaagent/testing/common/AgentTestingExporterAccess.java @@ -31,7 +31,6 @@ import io.opentelemetry.proto.common.v1.InstrumentationLibrary; import io.opentelemetry.proto.common.v1.KeyValue; import io.opentelemetry.proto.common.v1.StringKeyValue; -import io.opentelemetry.proto.metrics.v1.AggregationTemporality; import io.opentelemetry.proto.metrics.v1.DoubleDataPoint; import io.opentelemetry.proto.metrics.v1.DoubleHistogramDataPoint; import io.opentelemetry.proto.metrics.v1.DoubleSum; @@ -46,9 +45,22 @@ import io.opentelemetry.proto.trace.v1.Span; import io.opentelemetry.proto.trace.v1.Status; import io.opentelemetry.sdk.common.InstrumentationLibraryInfo; +import io.opentelemetry.sdk.metrics.data.AggregationTemporality; +import io.opentelemetry.sdk.metrics.data.DoubleGaugeData; +import io.opentelemetry.sdk.metrics.data.DoublePoint; +import io.opentelemetry.sdk.metrics.data.DoubleSumData; +import io.opentelemetry.sdk.metrics.data.DoubleSummaryData; +import io.opentelemetry.sdk.metrics.data.DoubleSummaryPoint; +import io.opentelemetry.sdk.metrics.data.LongGaugeData; +import io.opentelemetry.sdk.metrics.data.LongPoint; +import io.opentelemetry.sdk.metrics.data.LongSumData; import io.opentelemetry.sdk.metrics.data.MetricData; +import io.opentelemetry.sdk.metrics.data.ValueAtPercentile; import io.opentelemetry.sdk.testing.trace.TestSpanData; +import io.opentelemetry.sdk.trace.data.EventData; +import io.opentelemetry.sdk.trace.data.LinkData; import io.opentelemetry.sdk.trace.data.SpanData; +import io.opentelemetry.sdk.trace.data.StatusData; import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodHandles; import java.lang.invoke.MethodType; @@ -169,7 +181,7 @@ public static List getExportedSpans() { span.getEventsList().stream() .map( event -> - SpanData.Event.create( + EventData.create( event.getTimeUnixNano(), event.getName(), fromProto(event.getAttributesList()), @@ -182,7 +194,7 @@ public static List getExportedSpans() { span.getLinksList().stream() .map( link -> - SpanData.Link.create( + LinkData.create( SpanContext.create( TraceId.bytesToHex(link.getTraceId().toByteArray()), SpanId.bytesToHex(link.getSpanId().toByteArray()), @@ -258,8 +270,7 @@ private static MetricData createMetricData( metric.getName(), metric.getDescription(), metric.getUnit(), - MetricData.LongGaugeData.create( - getIntPoints(metric.getIntGauge().getDataPointsList()))); + LongGaugeData.create(getIntPoints(metric.getIntGauge().getDataPointsList()))); case DOUBLE_GAUGE: return MetricData.createDoubleGauge( resource, @@ -267,8 +278,7 @@ private static MetricData createMetricData( metric.getName(), metric.getDescription(), metric.getUnit(), - MetricData.DoubleGaugeData.create( - getDoublePoints(metric.getDoubleGauge().getDataPointsList()))); + DoubleGaugeData.create(getDoublePoints(metric.getDoubleGauge().getDataPointsList()))); case INT_SUM: IntSum intSum = metric.getIntSum(); return MetricData.createLongSum( @@ -277,7 +287,7 @@ private static MetricData createMetricData( metric.getName(), metric.getDescription(), metric.getUnit(), - MetricData.LongSumData.create( + LongSumData.create( intSum.getIsMonotonic(), getTemporality(intSum.getAggregationTemporality()), getIntPoints(metric.getIntSum().getDataPointsList()))); @@ -289,7 +299,7 @@ private static MetricData createMetricData( metric.getName(), metric.getDescription(), metric.getUnit(), - MetricData.DoubleSumData.create( + DoubleSumData.create( doubleSum.getIsMonotonic(), getTemporality(doubleSum.getAggregationTemporality()), getDoublePoints(metric.getDoubleSum().getDataPointsList()))); @@ -300,7 +310,7 @@ private static MetricData createMetricData( metric.getName(), metric.getDescription(), metric.getUnit(), - MetricData.DoubleSummaryData.create( + DoubleSummaryData.create( getDoubleHistogramDataPoints(metric.getDoubleHistogram().getDataPointsList()))); default: throw new AssertionError("Unexpected metric data: " + metric.getDataCase()); @@ -315,11 +325,11 @@ private static Labels createLabels(List stringKeyValues) { return labelsBuilder.build(); } - private static List getIntPoints(List points) { + private static List getIntPoints(List points) { return points.stream() .map( point -> - MetricData.LongPoint.create( + LongPoint.create( point.getStartTimeUnixNano(), point.getTimeUnixNano(), createLabels(point.getLabelsList()), @@ -327,11 +337,11 @@ private static List getIntPoints(List points) { .collect(toList()); } - private static List getDoublePoints(List points) { + private static List getDoublePoints(List points) { return points.stream() .map( point -> - MetricData.DoublePoint.create( + DoublePoint.create( point.getStartTimeUnixNano(), point.getTimeUnixNano(), createLabels(point.getLabelsList()), @@ -339,12 +349,12 @@ private static List getDoublePoints(List poin .collect(toList()); } - private static Collection getDoubleHistogramDataPoints( + private static Collection getDoubleHistogramDataPoints( List dataPointsList) { return dataPointsList.stream() .map( point -> - MetricData.DoubleSummaryPoint.create( + DoubleSummaryPoint.create( point.getStartTimeUnixNano(), point.getTimeUnixNano(), createLabels(point.getLabelsList()), @@ -354,23 +364,21 @@ private static Collection getDoubleHistogramDataPoints( .collect(toList()); } - private static List getValues(DoubleHistogramDataPoint point) { - List values = new ArrayList<>(); + private static List getValues(DoubleHistogramDataPoint point) { + List values = new ArrayList<>(); for (int i = 0; i < point.getExplicitBoundsCount(); i++) { - values.add( - MetricData.ValueAtPercentile.create( - point.getExplicitBounds(i), point.getBucketCounts(i))); + values.add(ValueAtPercentile.create(point.getExplicitBounds(i), point.getBucketCounts(i))); } return values; } - private static MetricData.AggregationTemporality getTemporality( - AggregationTemporality aggregationTemporality) { + private static AggregationTemporality getTemporality( + io.opentelemetry.proto.metrics.v1.AggregationTemporality aggregationTemporality) { switch (aggregationTemporality) { case AGGREGATION_TEMPORALITY_CUMULATIVE: - return MetricData.AggregationTemporality.CUMULATIVE; + return AggregationTemporality.CUMULATIVE; case AGGREGATION_TEMPORALITY_DELTA: - return MetricData.AggregationTemporality.DELTA; + return AggregationTemporality.DELTA; default: throw new IllegalStateException( "Unexpected aggregation temporality: " + aggregationTemporality); @@ -436,7 +444,7 @@ private static Attributes fromProto(List attributes) { return converted.build(); } - private static SpanData.Status fromProto(Status status) { + private static StatusData fromProto(Status status) { final StatusCode code; switch (status.getCode()) { case STATUS_CODE_OK: @@ -449,7 +457,7 @@ private static SpanData.Status fromProto(Status status) { code = StatusCode.UNSET; break; } - return SpanData.Status.create(code, status.getMessage()); + return StatusData.create(code, status.getMessage()); } private static Kind fromProto(Span.SpanKind kind) { diff --git a/testing/agent-exporter/agent-exporter.gradle b/testing/agent-exporter/agent-exporter.gradle index 9fc2e8d960fe..ad222e661a6f 100644 --- a/testing/agent-exporter/agent-exporter.gradle +++ b/testing/agent-exporter/agent-exporter.gradle @@ -50,6 +50,7 @@ shadowJar { // relocate OpenTelemetry API usage relocate "io.opentelemetry.api", "io.opentelemetry.javaagent.shaded.io.opentelemetry.api" + relocate "io.opentelemetry.semconv", "io.opentelemetry.javaagent.shaded.io.opentelemetry.semconv" relocate "io.opentelemetry.spi", "io.opentelemetry.javaagent.shaded.io.opentelemetry.spi" relocate "io.opentelemetry.context", "io.opentelemetry.javaagent.shaded.io.opentelemetry.context" diff --git a/testing/agent-exporter/src/main/java/io/opentelemetry/javaagent/testing/exporter/AgentTestingSdkCustomizer.java b/testing/agent-exporter/src/main/java/io/opentelemetry/javaagent/testing/exporter/AgentTestingSdkCustomizer.java index 6a97b6b6839d..6141cccf7861 100644 --- a/testing/agent-exporter/src/main/java/io/opentelemetry/javaagent/testing/exporter/AgentTestingSdkCustomizer.java +++ b/testing/agent-exporter/src/main/java/io/opentelemetry/javaagent/testing/exporter/AgentTestingSdkCustomizer.java @@ -6,8 +6,9 @@ package io.opentelemetry.javaagent.testing.exporter; import com.google.auto.service.AutoService; +import io.opentelemetry.api.metrics.GlobalMetricsProvider; import io.opentelemetry.javaagent.spi.TracerCustomizer; -import io.opentelemetry.sdk.OpenTelemetrySdk; +import io.opentelemetry.sdk.metrics.SdkMeterProvider; import io.opentelemetry.sdk.metrics.export.IntervalMetricReader; import io.opentelemetry.sdk.trace.SdkTracerManagement; import io.opentelemetry.sdk.trace.export.SimpleSpanProcessor; @@ -30,8 +31,7 @@ public void configure(SdkTracerManagement tracerManagement) { IntervalMetricReader.builder() .setExportIntervalMillis(100) .setMetricExporter(AgentTestingExporterFactory.metricExporter) - .setMetricProducers( - Collections.singleton(OpenTelemetrySdk.getGlobalMeterProvider().getMetricProducer())) + .setMetricProducers(Collections.singleton((SdkMeterProvider) GlobalMetricsProvider.get())) .build(); } } diff --git a/testing/agent-for-testing/agent-for-testing.gradle b/testing/agent-for-testing/agent-for-testing.gradle index db32e5bf83f1..c5e07540e101 100644 --- a/testing/agent-for-testing/agent-for-testing.gradle +++ b/testing/agent-for-testing/agent-for-testing.gradle @@ -57,6 +57,7 @@ shadowJar { // relocate OpenTelemetry API relocate "io.opentelemetry.api", "io.opentelemetry.javaagent.shaded.io.opentelemetry.api" + relocate "io.opentelemetry.semconv", "io.opentelemetry.javaagent.shaded.io.opentelemetry.semconv" relocate "io.opentelemetry.spi", "io.opentelemetry.javaagent.shaded.io.opentelemetry.spi" relocate "io.opentelemetry.context", "io.opentelemetry.javaagent.shaded.io.opentelemetry.context" diff --git a/testing/agent-for-testing/src/test/java/io/opentelemetry/javaagent/testing/AgentForTestingTest.java b/testing/agent-for-testing/src/test/java/io/opentelemetry/javaagent/testing/AgentForTestingTest.java index fa27db42ae33..5b62062c2c97 100644 --- a/testing/agent-for-testing/src/test/java/io/opentelemetry/javaagent/testing/AgentForTestingTest.java +++ b/testing/agent-for-testing/src/test/java/io/opentelemetry/javaagent/testing/AgentForTestingTest.java @@ -7,7 +7,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -import io.opentelemetry.api.OpenTelemetry; +import io.opentelemetry.api.GlobalOpenTelemetry; import io.opentelemetry.javaagent.testing.common.AgentTestingExporterAccess; import io.opentelemetry.sdk.trace.data.SpanData; import java.util.List; @@ -28,7 +28,7 @@ void empty() { @Test void exportAndRetrieve() { - OpenTelemetry.get().getTracer("test").spanBuilder("test").startSpan().end(); + GlobalOpenTelemetry.getTracer("test").spanBuilder("test").startSpan().end(); List spans = AgentTestingExporterAccess.getExportedSpans(); assertEquals(1, spans.size());