Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update the OpenTelemetry SDK version to 1.27.0 #8688

Merged
merged 18 commits into from
Jun 13, 2023
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,10 @@ dependencies {
compileOnly("io.opentelemetry.javaagent:opentelemetry-javaagent-extension-api") {
// OpenTelemetry SDK is not needed for compilation
exclude(group = "io.opentelemetry", module = "opentelemetry-sdk")
exclude(group = "io.opentelemetry", module = "opentelemetry-sdk-metrics")
exclude(group = "io.opentelemetry", module = "opentelemetry-sdk-logs")
}
compileOnly("io.opentelemetry.javaagent:opentelemetry-javaagent-tooling") {
// OpenTelemetry SDK is not needed for compilation
exclude(group = "io.opentelemetry", module = "opentelemetry-sdk")
exclude(group = "io.opentelemetry", module = "opentelemetry-sdk-metrics")
exclude(group = "io.opentelemetry", module = "opentelemetry-sdk-logs")
}

// Used by byte-buddy but not brought in as a transitive dependency
Expand Down
2 changes: 1 addition & 1 deletion dependencyManagement/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ val dependencyVersions = hashMapOf<String, String>()
rootProject.extra["versions"] = dependencyVersions

// this line is managed by .github/scripts/update-sdk-version.sh
val otelSdkVersion = "1.26.0"
val otelSdkVersion = "1.27.0"
val otelSdkAlphaVersion = otelSdkVersion.replaceFirst("(-SNAPSHOT)?$".toRegex(), "-alpha$1")

// Need both BOM and groovy jars
Expand Down
1 change: 0 additions & 1 deletion examples/distro/agent/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ tasks {
dependencies {
exclude("io.opentelemetry:opentelemetry-api")
exclude("io.opentelemetry:opentelemetry-api-events")
exclude("io.opentelemetry:opentelemetry-api-logs")
exclude("io.opentelemetry:opentelemetry-context")
exclude("io.opentelemetry:opentelemetry-semconv")
// metrics advice API
Expand Down
2 changes: 1 addition & 1 deletion examples/distro/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ subprojects {
ext {
versions = [
// this line is managed by .github/scripts/update-sdk-version.sh
opentelemetrySdk : "1.26.0",
opentelemetrySdk : "1.27.0",

// these lines are managed by .github/scripts/update-version.sh
opentelemetryJavaagent : "1.27.0-SNAPSHOT",
Expand Down
1 change: 0 additions & 1 deletion examples/distro/testing/agent-for-testing/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ tasks {
dependencies {
exclude("io.opentelemetry:opentelemetry-api")
exclude("io.opentelemetry:opentelemetry-api-events")
exclude("io.opentelemetry:opentelemetry-api-logs")
exclude("io.opentelemetry:opentelemetry-context")
exclude("io.opentelemetry:opentelemetry-semconv")
// metrics advice API
Expand Down
1 change: 0 additions & 1 deletion instrumentation-annotations-support/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,5 @@ dependencies {
annotationProcessor("com.google.auto.value:auto-value")

testImplementation(project(":testing-common"))
testImplementation("io.opentelemetry:opentelemetry-sdk-metrics")
testImplementation("io.opentelemetry:opentelemetry-sdk-testing")
}
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,6 @@ public static <REQUEST, RESPONSE> MessagingAttributesExtractorBuilder<REQUEST, R
@Override
public void onStart(AttributesBuilder attributes, Context parentContext, REQUEST request) {
internalSet(attributes, SemanticAttributes.MESSAGING_SYSTEM, getter.getSystem(request));
internalSet(
attributes,
SemanticAttributes.MESSAGING_DESTINATION_KIND,
getter.getDestinationKind(request));
boolean isTemporaryDestination = getter.isTemporaryDestination(request);
if (isTemporaryDestination) {
internalSet(attributes, SemanticAttributes.MESSAGING_DESTINATION_TEMPORARY, true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@ public interface MessagingAttributesGetter<REQUEST, RESPONSE> {
@Nullable
String getSystem(REQUEST request);

@Nullable
String getDestinationKind(REQUEST request);
trask marked this conversation as resolved.
Show resolved Hide resolved

@Nullable
String getDestination(REQUEST request);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ void shouldExtractAllAvailableAttributes(
// then
List<MapEntry<AttributeKey<?>, Object>> expectedEntries = new ArrayList<>();
expectedEntries.add(entry(SemanticAttributes.MESSAGING_SYSTEM, "myQueue"));
expectedEntries.add(entry(SemanticAttributes.MESSAGING_DESTINATION_KIND, "topic"));
expectedEntries.add(entry(SemanticAttributes.MESSAGING_DESTINATION_NAME, expectedDestination));
if (temporary) {
expectedEntries.add(entry(SemanticAttributes.MESSAGING_DESTINATION_TEMPORARY, true));
Expand Down Expand Up @@ -118,11 +117,6 @@ public String getSystem(Map<String, String> request) {
return request.get("system");
}

@Override
public String getDestinationKind(Map<String, String> request) {
return request.get("destinationKind");
}

@Override
public String getDestination(Map<String, String> request) {
return request.get("destination");
Expand Down
1 change: 0 additions & 1 deletion instrumentation-api/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ dependencies {
annotationProcessor("com.google.auto.value:auto-value")

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ public void pre(
super.pre(attributes, exchange, endpoint, camelDirection);

attributes.put(SemanticAttributes.MESSAGING_OPERATION, "process");
attributes.put(SemanticAttributes.MESSAGING_DESTINATION_KIND, "topic");

Integer partition = exchange.getIn().getHeader(PARTITION, Integer.class);
if (partition != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ plugins {
dependencies {
compileOnly(project(":instrumentation:java-util-logging:shaded-stub-for-instrumenting"))

compileOnly("io.opentelemetry:opentelemetry-api-logs")
compileOnly(project(":javaagent-bootstrap"))

// ensure no cross interference
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
package io.opentelemetry.javaagent.instrumentation.jul;

import application.java.util.logging.Logger;
import io.opentelemetry.api.GlobalOpenTelemetry;
import io.opentelemetry.api.common.Attributes;
import io.opentelemetry.api.common.AttributesBuilder;
import io.opentelemetry.api.logs.GlobalLoggerProvider;
import io.opentelemetry.api.logs.LogRecordBuilder;
import io.opentelemetry.api.logs.Severity;
import io.opentelemetry.context.Context;
Expand Down Expand Up @@ -41,7 +41,11 @@ public static void capture(Logger logger, LogRecord logRecord) {
instrumentationName = "ROOT";
}
LogRecordBuilder builder =
GlobalLoggerProvider.get().loggerBuilder(instrumentationName).build().logRecordBuilder();
GlobalOpenTelemetry.get()
.getLogsBridge()
.loggerBuilder(instrumentationName)
.build()
.logRecordBuilder();
mapLogRecord(builder, logRecord);
builder.emit();
}
Expand Down Expand Up @@ -81,7 +85,7 @@ private static void mapLogRecord(LogRecordBuilder builder, LogRecord logRecord)
Throwable throwable = logRecord.getThrown();
if (throwable != null) {
// TODO (trask) extract method for recording exception into
// io.opentelemetry:opentelemetry-api-logs
// io.opentelemetry:opentelemetry-api
attributes.put(SemanticAttributes.EXCEPTION_TYPE, throwable.getClass().getName());
attributes.put(SemanticAttributes.EXCEPTION_MESSAGE, throwable.getMessage());
StringWriter writer = new StringWriter();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

package io.opentelemetry.javaagent.instrumentation.jul;

import static io.opentelemetry.sdk.testing.assertj.LogAssertions.assertThat;
import static io.opentelemetry.sdk.testing.assertj.OpenTelemetryAssertions.assertThat;
import static io.opentelemetry.sdk.testing.assertj.OpenTelemetryAssertions.equalTo;
import static io.opentelemetry.sdk.testing.assertj.OpenTelemetryAssertions.satisfies;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ muzzle {
dependencies {
library("org.jboss.logmanager:jboss-logmanager:1.1.0.GA")

compileOnly("io.opentelemetry:opentelemetry-api-logs")
compileOnly(project(":javaagent-bootstrap"))

// ensure no cross interference
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@

import static java.util.Collections.emptyList;

import io.opentelemetry.api.GlobalOpenTelemetry;
import io.opentelemetry.api.common.AttributeKey;
import io.opentelemetry.api.common.Attributes;
import io.opentelemetry.api.common.AttributesBuilder;
import io.opentelemetry.api.logs.GlobalLoggerProvider;
import io.opentelemetry.api.logs.LogRecordBuilder;
import io.opentelemetry.api.logs.Severity;
import io.opentelemetry.context.Context;
Expand Down Expand Up @@ -58,7 +58,11 @@ public void capture(Logger logger, ExtLogRecord record) {
}

LogRecordBuilder builder =
GlobalLoggerProvider.get().loggerBuilder(instrumentationName).build().logRecordBuilder();
GlobalOpenTelemetry.get()
.getLogsBridge()
.loggerBuilder(instrumentationName)
.build()
.logRecordBuilder();

String message = record.getFormattedMessage();
if (message != null) {
Expand All @@ -76,7 +80,7 @@ public void capture(Logger logger, ExtLogRecord record) {
Throwable throwable = record.getThrown();
if (throwable != null) {
// TODO (trask) extract method for recording exception into
// io.opentelemetry:opentelemetry-api-logs
// io.opentelemetry:opentelemetry-api
attributes.put(SemanticAttributes.EXCEPTION_TYPE, throwable.getClass().getName());
attributes.put(SemanticAttributes.EXCEPTION_MESSAGE, throwable.getMessage());
StringWriter writer = new StringWriter();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

package io.opentelemetry.javaagent.instrumentation.jbosslogmanager.appender.v1_1;

import static io.opentelemetry.sdk.testing.assertj.LogAssertions.assertThat;
import static io.opentelemetry.sdk.testing.assertj.OpenTelemetryAssertions.assertThat;
import static io.opentelemetry.sdk.testing.assertj.OpenTelemetryAssertions.equalTo;
import static io.opentelemetry.sdk.testing.assertj.OpenTelemetryAssertions.satisfies;
import static org.assertj.core.api.Assertions.assertThat;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class Jms2Test extends AgentInstrumentationSpecification {
server.stop()
}

def "sending a message to #destinationName #destinationType generates spans"() {
def "sending a message to #destinationName generates spans"() {
setup:
def producer = session.createProducer(destination)
def consumer = session.createConsumer(destination)
Expand All @@ -104,7 +104,7 @@ class Jms2Test extends AgentInstrumentationSpecification {
name "producer parent"
hasNoParent()
}
producerSpan(it, 1, destinationType, destinationName, span(0))
producerSpan(it, 1, destinationName, span(0))

producerSpanData = span(1)
}
Expand All @@ -113,7 +113,7 @@ class Jms2Test extends AgentInstrumentationSpecification {
name "consumer parent"
hasNoParent()
}
consumerSpan(it, 1, destinationType, destinationName, messageId, "receive", span(0), producerSpanData)
consumerSpan(it, 1, destinationName, messageId, "receive", span(0), producerSpanData)
}
}

Expand All @@ -122,14 +122,14 @@ class Jms2Test extends AgentInstrumentationSpecification {
consumer.close()

where:
destination | destinationType | destinationName
session.createQueue("someQueue") | "queue" | "someQueue"
session.createTopic("someTopic") | "topic" | "someTopic"
session.createTemporaryQueue() | "queue" | "(temporary)"
session.createTemporaryTopic() | "topic" | "(temporary)"
destination | destinationName
session.createQueue("someQueue") | "someQueue"
session.createTopic("someTopic") | "someTopic"
session.createTemporaryQueue() | "(temporary)"
session.createTemporaryTopic() | "(temporary)"
}

def "sending to a MessageListener on #destinationName #destinationType generates a span"() {
def "sending to a MessageListener on #destinationName generates a span"() {
setup:
def lock = new CountDownLatch(1)
def messageRef = new AtomicReference<TextMessage>()
Expand All @@ -155,8 +155,8 @@ class Jms2Test extends AgentInstrumentationSpecification {
name "parent"
hasNoParent()
}
producerSpan(it, 1, destinationType, destinationName, span(0))
consumerSpan(it, 2, destinationType, destinationName, messageRef.get().getJMSMessageID(), "process", span(1))
producerSpan(it, 1, destinationName, span(0))
consumerSpan(it, 2, destinationName, messageRef.get().getJMSMessageID(), "process", span(1))
}
}
// This check needs to go after all traces have been accounted for
Expand All @@ -167,14 +167,14 @@ class Jms2Test extends AgentInstrumentationSpecification {
consumer.close()

where:
destination | destinationType | destinationName
session.createQueue("someQueue") | "queue" | "someQueue"
session.createTopic("someTopic") | "topic" | "someTopic"
session.createTemporaryQueue() | "queue" | "(temporary)"
session.createTemporaryTopic() | "topic" | "(temporary)"
destination | destinationName
session.createQueue("someQueue") | "someQueue"
session.createTopic("someTopic") | "someTopic"
session.createTemporaryQueue() | "(temporary)"
session.createTemporaryTopic() | "(temporary)"
}

def "failing to receive message with receiveNoWait on #destinationName #destinationType works"() {
def "failing to receive message with receiveNoWait on #destinationName works"() {
setup:
def consumer = session.createConsumer(destination)

Expand All @@ -190,12 +190,12 @@ class Jms2Test extends AgentInstrumentationSpecification {
consumer.close()

where:
destination | destinationType | destinationName
session.createQueue("someQueue") | "queue" | "someQueue"
session.createTopic("someTopic") | "topic" | "someTopic"
destination | destinationName
session.createQueue("someQueue") | "someQueue"
session.createTopic("someTopic") | "someTopic"
}

def "failing to receive message with wait(timeout) on #destinationName #destinationType works"() {
def "failing to receive message with wait(timeout) on #destinationName works"() {
setup:
def consumer = session.createConsumer(destination)

Expand All @@ -211,12 +211,12 @@ class Jms2Test extends AgentInstrumentationSpecification {
consumer.close()

where:
destination | destinationType | destinationName
session.createQueue("someQueue") | "queue" | "someQueue"
session.createTopic("someTopic") | "topic" | "someTopic"
destination | destinationName
session.createQueue("someQueue") | "someQueue"
session.createTopic("someTopic") | "someTopic"
}

def "sending a message to #destinationName #destinationType with explicit destination propagates context"() {
def "sending a message to #destinationName with explicit destination propagates context"() {
given:
def producer = session.createProducer(null)
def consumer = session.createConsumer(destination)
Expand Down Expand Up @@ -244,8 +244,8 @@ class Jms2Test extends AgentInstrumentationSpecification {
name "parent"
hasNoParent()
}
producerSpan(it, 1, destinationType, destinationName, span(0))
consumerSpan(it, 2, destinationType, destinationName, messageRef.get().getJMSMessageID(), "process", span(1))
producerSpan(it, 1, destinationName, span(0))
consumerSpan(it, 2, destinationName, messageRef.get().getJMSMessageID(), "process", span(1))
}
}
// This check needs to go after all traces have been accounted for
Expand All @@ -256,14 +256,14 @@ class Jms2Test extends AgentInstrumentationSpecification {
consumer.close()

where:
destination | destinationType | destinationName
session.createQueue("someQueue") | "queue" | "someQueue"
session.createTopic("someTopic") | "topic" | "someTopic"
session.createTemporaryQueue() | "queue" | "(temporary)"
session.createTemporaryTopic() | "topic" | "(temporary)"
destination | destinationName
session.createQueue("someQueue") | "someQueue"
session.createTopic("someTopic") | "someTopic"
session.createTemporaryQueue() | "(temporary)"
session.createTemporaryTopic() | "(temporary)"
}

static producerSpan(TraceAssert trace, int index, String destinationType, String destinationName, SpanData parentSpan = null) {
static producerSpan(TraceAssert trace, int index, String destinationName, SpanData parentSpan = null) {
trace.span(index) {
name destinationName + " send"
kind PRODUCER
Expand All @@ -275,7 +275,6 @@ class Jms2Test extends AgentInstrumentationSpecification {
attributes {
"$SemanticAttributes.MESSAGING_SYSTEM" "jms"
"$SemanticAttributes.MESSAGING_DESTINATION_NAME" destinationName
"$SemanticAttributes.MESSAGING_DESTINATION_KIND" destinationType
if (destinationName == "(temporary)") {
"$SemanticAttributes.MESSAGING_DESTINATION_TEMPORARY" true
}
Expand All @@ -287,7 +286,7 @@ class Jms2Test extends AgentInstrumentationSpecification {
// passing messageId = null will verify message.id is not captured,
// passing messageId = "" will verify message.id is captured (but won't verify anything about the value),
// any other value for messageId will verify that message.id is captured and has that same value
static consumerSpan(TraceAssert trace, int index, String destinationType, String destinationName, String messageId, String operation, SpanData parentSpan, SpanData linkedSpan = null) {
static consumerSpan(TraceAssert trace, int index, String destinationName, String messageId, String operation, SpanData parentSpan, SpanData linkedSpan = null) {
trace.span(index) {
name destinationName + " " + operation
kind CONSUMER
Expand All @@ -304,7 +303,6 @@ class Jms2Test extends AgentInstrumentationSpecification {
attributes {
"$SemanticAttributes.MESSAGING_SYSTEM" "jms"
"$SemanticAttributes.MESSAGING_DESTINATION_NAME" destinationName
"$SemanticAttributes.MESSAGING_DESTINATION_KIND" destinationType
"$SemanticAttributes.MESSAGING_OPERATION" operation
if (messageId != null) {
//In some tests we don't know exact messageId, so we pass "" and verify just the existence of the attribute
Expand Down
Loading