Update to latest SDK snapshot
MODIFY
gradle/dependencies.gradle
gradle/dependencies.gradle
@@ -11,10 +11,10 @@ ext {
// Check https://oss.jfrog.org/libs-snapshot/io/opentelemetry/ for latest snapshot version.
// Snapshot versions are often split across versions (based on jfrog's whim and relative age of
// each module), best to keep these separate until GA
- opentelemetry : '0.10.0-20201030.035030-114',
- opentelemetryOther : '0.10.0-20201030.035030-112',
- opentelemetryAnother: '0.10.0-20201030.035030-113',
- opentelemetryContext: '0.10.0-20201030.035030-85',
+ opentelemetry : '0.10.0-20201101.161040-127',
+ opentelemetryOther : '0.10.0-20201101.161040-125',
+ opentelemetryAnother: '0.10.0-20201101.161040-126',
+ opentelemetryContext: '0.10.0-20201101.161040-98',
slf4j : "1.7.30",
guava : "20.0", // Last version to support Java 7
@@ -40,8 +40,8 @@ ext {
deps = [
// OpenTelemetry
opentelemetryApi : dependencies.create(group: 'io.opentelemetry', name: 'opentelemetry-api', version: versions.opentelemetry),
- opentelemetryContextProp : dependencies.create(group: 'io.opentelemetry', name: 'opentelemetry-context-prop', version: versions.opentelemetryAnother),
opentelemetryAutoAnnotations: dependencies.create(group: 'io.opentelemetry', name: 'opentelemetry-extension-auto-annotations', version: versions.opentelemetryAnother),
+ opentelemetryContext : dependencies.create(group: 'io.opentelemetry', name: 'opentelemetry-context', version: versions.opentelemetryContext),
opentelemetryTraceProps : dependencies.create(group: 'io.opentelemetry', name: 'opentelemetry-extension-trace-propagators', version: versions.opentelemetry),
opentelemetrySdk : dependencies.create(group: 'io.opentelemetry', name: 'opentelemetry-sdk', version: versions.opentelemetryAnother),
opentelemetryJaeger : dependencies.create(group: 'io.opentelemetry', name: 'opentelemetry-exporters-jaeger', version: versions.opentelemetryAnother),

MODIFY
gradle/instrumentation-library.gradle
gradle/instrumentation-library.gradle
@@ -12,7 +12,7 @@ dependencies {
api project(':instrumentation-api')
api deps.opentelemetryApi
- api deps.opentelemetryContextProp
+ api deps.opentelemetryContext
testImplementation project(':testing-common')
}

MODIFY
gradle/java.gradle
gradle/java.gradle
@@ -118,7 +118,6 @@ dependencies {
// transitive dependencies using the generic SNAPSHOT instead of a specific snapshot
implementation group: 'io.opentelemetry', name: 'opentelemetry-api', version: versions.opentelemetry
implementation group: 'io.opentelemetry', name: 'opentelemetry-context', version: versions.opentelemetryContext
- implementation group: 'io.opentelemetry', name: 'opentelemetry-context-prop', version: versions.opentelemetryAnother
implementation group: 'io.opentelemetry', name: 'opentelemetry-sdk', version: versions.opentelemetryAnother
implementation group: 'io.opentelemetry', name: 'opentelemetry-sdk-baggage', version: versions.opentelemetry
implementation group: 'io.opentelemetry', name: 'opentelemetry-sdk-common', version: versions.opentelemetry

MODIFY
instrumentation-api/instrumentation-api.gradle
instrumentation-api/instrumentation-api.gradle
@@ -5,7 +5,7 @@ apply from: "$rootDir/gradle/publish.gradle"
dependencies {
api deps.opentelemetryApi
- api deps.opentelemetryContextProp
+ api deps.opentelemetryContext
implementation deps.slf4j
compileOnly deps.autoValueAnnotations

MODIFY
instrumentation/log4j/log4j-1.2/src/test/groovy/Log4j1MdcTest.groovy
instrumentation/log4j/log4j-1.2/src/test/groovy/Log4j1MdcTest.groovy
@@ -7,9 +7,9 @@ import static io.opentelemetry.instrumentation.api.log.LoggingContextConstants.S
import static io.opentelemetry.instrumentation.api.log.LoggingContextConstants.SPAN_ID
import static io.opentelemetry.instrumentation.api.log.LoggingContextConstants.TRACE_ID
+import io.opentelemetry.api.trace.Span
import io.opentelemetry.instrumentation.test.AgentTestRunner
import io.opentelemetry.instrumentation.test.utils.TraceUtils
-import io.opentelemetry.api.trace.TracingContextUtils
import org.apache.log4j.LogManager
class Log4j1MdcTest extends AgentTestRunner {
@@ -47,14 +47,14 @@ class Log4j1MdcTest extends AgentTestRunner {
when:
def span1 = TraceUtils.runUnderTrace("test") {
logger.info("log message 1")
- TracingContextUtils.currentSpan
+ Span.current()
}
logger.info("log message 2")
def span2 = TraceUtils.runUnderTrace("test 2") {
logger.info("log message 3")
- TracingContextUtils.currentSpan
+ Span.current()
}
then:
@@ -62,8 +62,8 @@ class Log4j1MdcTest extends AgentTestRunner {
events.size() == 3
events[0].message == "log message 1"
- events[0].getMDC(TRACE_ID) == span1.context.traceIdAsHexString
- events[0].getMDC(SPAN_ID) == span1.context.spanIdAsHexString
+ events[0].getMDC(TRACE_ID) == span1.spanContext.traceIdAsHexString
+ events[0].getMDC(SPAN_ID) == span1.spanContext.spanIdAsHexString
events[0].getMDC(SAMPLED) == "true"
events[1].message == "log message 2"
@@ -74,8 +74,8 @@ class Log4j1MdcTest extends AgentTestRunner {
events[2].message == "log message 3"
// this explicit getMDCCopy() call here is to make sure that whole instrumentation is tested
events[2].getMDCCopy()
- events[2].getMDC(TRACE_ID) == span2.context.traceIdAsHexString
- events[2].getMDC(SPAN_ID) == span2.context.spanIdAsHexString
+ events[2].getMDC(TRACE_ID) == span2.spanContext.traceIdAsHexString
+ events[2].getMDC(SPAN_ID) == span2.spanContext.spanIdAsHexString
events[2].getMDC(SAMPLED) == "true"
}
}

MODIFY
instrumentation/log4j/log4j-2-testing/src/main/groovy/Log4j2Test.groovy
instrumentation/log4j/log4j-2-testing/src/main/groovy/Log4j2Test.groovy
@@ -11,7 +11,6 @@ import io.opentelemetry.instrumentation.log4j.v2_13_2.ListAppender
import io.opentelemetry.instrumentation.test.InstrumentationSpecification
import io.opentelemetry.instrumentation.test.utils.TraceUtils
import io.opentelemetry.api.trace.Span
-import io.opentelemetry.api.trace.TracingContextUtils
import org.apache.logging.log4j.LogManager
abstract class Log4j2Test extends InstrumentationSpecification {
@@ -49,14 +48,14 @@ abstract class Log4j2Test extends InstrumentationSpecification {
when:
Span span1 = TraceUtils.runUnderTrace("test") {
logger.info("log message 1")
- TracingContextUtils.currentSpan
+ Span.current()
}
logger.info("log message 2")
Span span2 = TraceUtils.runUnderTrace("test 2") {
logger.info("log message 3")
- TracingContextUtils.currentSpan
+ Span.current()
}
def events = ListAppender.get().getEvents()
@@ -64,8 +63,8 @@ abstract class Log4j2Test extends InstrumentationSpecification {
then:
events.size() == 3
events[0].message.formattedMessage == "log message 1"
- events[0].getContextData().getValue(TRACE_ID) == span1.context.traceIdAsHexString
- events[0].getContextData().getValue(SPAN_ID) == span1.context.spanIdAsHexString
+ events[0].getContextData().getValue(TRACE_ID) == span1.spanContext.traceIdAsHexString
+ events[0].getContextData().getValue(SPAN_ID) == span1.spanContext.spanIdAsHexString
events[0].getContextData().getValue(SAMPLED) == "true"
events[1].message.formattedMessage == "log message 2"
@@ -74,8 +73,8 @@ abstract class Log4j2Test extends InstrumentationSpecification {
events[1].getContextData().getValue(SAMPLED) == null
events[2].message.formattedMessage == "log message 3"
- events[2].getContextData().getValue(TRACE_ID) == span2.context.traceIdAsHexString
- events[2].getContextData().getValue(SPAN_ID) == span2.context.spanIdAsHexString
+ events[2].getContextData().getValue(TRACE_ID) == span2.spanContext.traceIdAsHexString
+ events[2].getContextData().getValue(SPAN_ID) == span2.spanContext.spanIdAsHexString
events[2].getContextData().getValue(SAMPLED) == "true"
}
}

MODIFY
instrumentation/logback/logback-1.0.0/testing/src/main/groovy/io/opentelemetry/instrumentation/logback/v1_0_0/AbstractLogbackTest.groovy
instrumentation/logback/logback-1.0.0/testing/src/main/groovy/io/opentelemetry/instrumentation/logback/v1_0_0/AbstractLogbackTest.groovy
@@ -10,7 +10,6 @@ import ch.qos.logback.core.read.ListAppender
import io.opentelemetry.instrumentation.test.InstrumentationSpecification
import io.opentelemetry.instrumentation.test.utils.TraceUtils
import io.opentelemetry.api.trace.Span
-import io.opentelemetry.api.trace.TracingContextUtils
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import spock.lang.Shared
@@ -63,7 +62,7 @@ abstract class AbstractLogbackTest extends InstrumentationSpecification {
when:
Span span1
TraceUtils.runUnderTrace("test") {
- span1 = TracingContextUtils.currentSpan
+ span1 = Span.current()
logger.info("log message 1")
}
@@ -71,7 +70,7 @@ abstract class AbstractLogbackTest extends InstrumentationSpecification {
Span span2
TraceUtils.runUnderTrace("test 2") {
- span2 = TracingContextUtils.currentSpan
+ span2 = Span.current()
logger.info("log message 3")
}
@@ -80,8 +79,8 @@ abstract class AbstractLogbackTest extends InstrumentationSpecification {
then:
events.size() == 3
events[0].message == "log message 1"
- events[0].getMDCPropertyMap().get("traceId") == span1.context.traceIdAsHexString
- events[0].getMDCPropertyMap().get("spanId") == span1.context.spanIdAsHexString
+ events[0].getMDCPropertyMap().get("traceId") == span1.spanContext.traceIdAsHexString
+ events[0].getMDCPropertyMap().get("spanId") == span1.spanContext.spanIdAsHexString
events[0].getMDCPropertyMap().get("sampled") == "true"
events[1].message == "log message 2"
@@ -90,8 +89,8 @@ abstract class AbstractLogbackTest extends InstrumentationSpecification {
events[1].getMDCPropertyMap().get("sampled") == null
events[2].message == "log message 3"
- events[2].getMDCPropertyMap().get("traceId") == span2.context.traceIdAsHexString
- events[2].getMDCPropertyMap().get("spanId") == span2.context.spanIdAsHexString
+ events[2].getMDCPropertyMap().get("traceId") == span2.spanContext.traceIdAsHexString
+ events[2].getMDCPropertyMap().get("spanId") == span2.spanContext.spanIdAsHexString
events[2].getMDCPropertyMap().get("sampled") == "true"
}
}

MODIFY
instrumentation/opentelemetry-api-beta/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/context/AgentContextStorage.java
instrumentation/opentelemetry-api-beta/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/context/AgentContextStorage.java
@@ -56,9 +56,8 @@ public class AgentContextStorage implements ContextStorage {
static {
io.opentelemetry.context.ContextKey<io.opentelemetry.api.trace.Span> agentSpanContextKey;
try {
- Class<?> tracingContextUtils =
- Class.forName("io.opentelemetry.api.trace.TracingContextUtils");
- Field contextSpanKeyField = tracingContextUtils.getDeclaredField("CONTEXT_SPAN_KEY");
+ Class<?> tracingContextUtils = Class.forName("io.opentelemetry.api.trace.SpanContextKey");
+ Field contextSpanKeyField = tracingContextUtils.getDeclaredField("KEY");
contextSpanKeyField.setAccessible(true);
agentSpanContextKey =
(io.opentelemetry.context.ContextKey<io.opentelemetry.api.trace.Span>)
@@ -71,8 +70,8 @@ public class AgentContextStorage implements ContextStorage {
ContextKey<Span> applicationSpanContextKey;
try {
Class<?> tracingContextUtils =
- Class.forName("application.io.opentelemetry.api.trace.TracingContextUtils");
- Field contextSpanKeyField = tracingContextUtils.getDeclaredField("CONTEXT_SPAN_KEY");
+ Class.forName("application.io.opentelemetry.api.trace.SpanContextKey");
+ Field contextSpanKeyField = tracingContextUtils.getDeclaredField("KEY");
contextSpanKeyField.setAccessible(true);
applicationSpanContextKey = (ContextKey<Span>) contextSpanKeyField.get(null);
} catch (Throwable t) {

MODIFY
javaagent-tooling/javaagent-tooling.gradle
javaagent-tooling/javaagent-tooling.gradle
@@ -19,7 +19,7 @@ dependencies {
implementation project(':instrumentation-api')
implementation deps.opentelemetryApi
- implementation deps.opentelemetryContextProp
+ implementation deps.opentelemetryContext
implementation deps.opentelemetrySdk
implementation deps.opentelemetryTraceProps

MODIFY
opentelemetry-api-beta-shaded-for-instrumenting/opentelemetry-api-beta-shaded-for-instrumenting.gradle
opentelemetry-api-beta-shaded-for-instrumenting/opentelemetry-api-beta-shaded-for-instrumenting.gradle
@@ -6,7 +6,7 @@ apply from: "$rootDir/gradle/java.gradle"
dependencies {
implementation deps.opentelemetryApi
- implementation deps.opentelemetryContextProp
+ implementation deps.opentelemetryContext
}
// OpenTelemetry API shaded so that it can be used in opentelemetry-api-beta instrumentation,

MODIFY
opentelemetry-auto-annotations-beta-shaded-for-instrumenting/opentelemetry-auto-annotations-beta-shaded-for-instrumenting.gradle
opentelemetry-auto-annotations-beta-shaded-for-instrumenting/opentelemetry-auto-annotations-beta-shaded-for-instrumenting.gradle
@@ -6,7 +6,7 @@ apply from: "$rootDir/gradle/java.gradle"
dependencies {
implementation deps.opentelemetryAutoAnnotations
- implementation deps.opentelemetryContextProp
+ implementation deps.opentelemetryContext
}
// OpenTelemetry Auto Annotations shaded so that it can be used in opentelemetry-api-beta

MODIFY
opentelemetry-sdk-beta-shaded-for-instrumenting/opentelemetry-sdk-beta-shaded-for-instrumenting.gradle
opentelemetry-sdk-beta-shaded-for-instrumenting/opentelemetry-sdk-beta-shaded-for-instrumenting.gradle
@@ -7,7 +7,7 @@ apply from: "$rootDir/gradle/java.gradle"
dependencies {
implementation deps.opentelemetryApi
implementation deps.opentelemetrySdk
- implementation deps.opentelemetryContextProp
+ implementation deps.opentelemetryContext
}
// OpenTelemetry API (and SDK) shaded so that it can be used (and tested) in

MODIFY
opentelemetry-sdk-shaded-for-testing/opentelemetry-sdk-shaded-for-testing.gradle
opentelemetry-sdk-shaded-for-testing/opentelemetry-sdk-shaded-for-testing.gradle
@@ -6,7 +6,7 @@ apply from: "$rootDir/gradle/java.gradle"
dependencies {
implementation deps.opentelemetrySdk
- implementation deps.opentelemetryContextProp
+ implementation deps.opentelemetryContext
}
// OpenTelemetry SDK with shaded dependencies so that they do not conflict with other libraries (in particular guava)

Update to latest SDK snapshot (#1539)