Skip to content

Commit 65e3eb3

Browse files
authored
Dependency Updates v1.32.x (#622)
* Updating Kafka Producer Contract Test to add messaging.operation attribute * Updating to v1.32.0 upstream * fix for failing sqs tests build * patch bug fix
1 parent f44e8d0 commit 65e3eb3

File tree

214 files changed

+1953
-1960
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

214 files changed

+1953
-1960
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
diff --git a/instrumentation/aws-sdk/aws-sdk-1.11/library/src/main/java/io/opentelemetry/instrumentation/awssdk/v1_11/SqsImpl.java b/instrumentation/aws-sdk/aws-sdk-1.11/library/src/main/java/io/opentelemetry/instrumentation/awssdk/v1_11/SqsImpl.java
2+
index a3e2d0e770..41c772692d 100644
3+
--- a/instrumentation/aws-sdk/aws-sdk-1.11/library/src/main/java/io/opentelemetry/instrumentation/awssdk/v1_11/SqsImpl.java
4+
+++ b/instrumentation/aws-sdk/aws-sdk-1.11/library/src/main/java/io/opentelemetry/instrumentation/awssdk/v1_11/SqsImpl.java
5+
@@ -137,7 +137,7 @@ final class SqsImpl {
6+
}
7+
8+
static String getMessageId(Response<?> response) {
9+
- if (response.getAwsResponse() instanceof SendMessageResult) {
10+
+ if (response != null && response.getAwsResponse() instanceof SendMessageResult) {
11+
return ((SendMessageResult) response.getAwsResponse()).getMessageId();
12+
}
13+
return null;
14+
diff --git a/version.gradle.kts b/version.gradle.kts
15+
index a2bacc6f04..0890062291 100644
16+
--- a/version.gradle.kts
17+
+++ b/version.gradle.kts
18+
@@ -1,5 +1,5 @@
19+
-val stableVersion = "1.32.0"
20+
-val alphaVersion = "1.32.0-alpha"
21+
+val stableVersion = "1.32.0-adot1"
22+
+val alphaVersion = "1.32.0-adot1-alpha"
23+
24+
allprojects {
25+
if (findProperty("otel.stable") != "true") {
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
OTEL_JAVA_INSTRUMENTATION_VERSION=v1.32.0

.github/workflows/main-build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ permissions:
2424
jobs:
2525
testpatch:
2626
name: Test patches applied to dependencies
27-
runs-on: ubuntu-latest
27+
runs-on: aws-otel-java-instrumentation_ubuntu-latest_32-core
2828
if: ${{ startsWith(github.ref_name, 'release/v') }}
2929
steps:
3030
- uses: actions/checkout@v4

.github/workflows/pr-build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ env:
1010
jobs:
1111
testpatch:
1212
name: Test patches applied to dependencies
13-
runs-on: ubuntu-latest
13+
runs-on: aws-otel-java-instrumentation_ubuntu-latest_32-core
1414
if: ${{ startsWith(github.event.pull_request.base.ref, 'release/v') }}
1515
steps:
1616
- uses: actions/checkout@v4

appsignals-tests/contract-tests/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ dependencies {
5656
testImplementation("software.amazon.awssdk:sts")
5757
testImplementation(kotlin("test"))
5858
implementation(project(":appsignals-tests:images:grpc:grpc-base"))
59-
testImplementation("org.testcontainers:kafka:1.19.1")
59+
testImplementation("org.testcontainers:kafka:1.19.3")
6060
}
6161

6262
project.evaluationDependsOn(":otelagent")

appsignals-tests/contract-tests/src/test/java/software/amazon/opentelemetry/appsignals/test/awssdk/base/AwsSdkBaseTest.java

Lines changed: 76 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,23 @@ private void assertSemanticConventionsAttributes(
171171
.satisfiesOnlyOnce(assertKeyIsPresent(SemanticConventionsConstants.THREAD_ID));
172172
}
173173

174+
/** All the spans of the AWS SDK Should have a RPC properties. */
175+
private void assertSemanticConventionsSqsConsumerAttributes(
176+
List<KeyValue> attributesList,
177+
String service,
178+
String method,
179+
String peerName,
180+
int peerPort,
181+
String url) {
182+
assertThat(attributesList)
183+
.satisfiesOnlyOnce(assertAttribute(SemanticConventionsConstants.RPC_METHOD, method))
184+
.satisfiesOnlyOnce(assertAttribute(SemanticConventionsConstants.RPC_SERVICE, service))
185+
.satisfiesOnlyOnce(assertAttribute(SemanticConventionsConstants.NET_PEER_NAME, peerName))
186+
.satisfiesOnlyOnce(assertAttribute(SemanticConventionsConstants.NET_PEER_PORT, peerPort))
187+
.satisfiesOnlyOnce(assertAttributeStartsWith(SemanticConventionsConstants.HTTP_URL, url))
188+
.satisfiesOnlyOnce(assertKeyIsPresent(SemanticConventionsConstants.THREAD_ID));
189+
}
190+
174191
private void assertSpanClientAttributes(
175192
List<ResourceScopeSpan> spans,
176193
String spanName,
@@ -256,8 +273,8 @@ private void assertSpanConsumerAttributes(
256273
var spanAttributes = span.getAttributesList();
257274
assertThat(span.getKind()).isEqualTo(SpanKind.SPAN_KIND_CONSUMER);
258275
assertThat(span.getName()).isEqualTo(spanName);
259-
assertSemanticConventionsAttributes(
260-
spanAttributes, rpcService, method, peerName, peerPort, url, statusCode);
276+
assertSemanticConventionsSqsConsumerAttributes(
277+
spanAttributes, rpcService, method, peerName, peerPort, url);
261278
assertSqsConsumerAwsAttributes(span.getAttributesList(), operation);
262279
for (var assertion : extraAssertions) {
263280
assertThat(spanAttributes).satisfiesOnlyOnce(assertion);
@@ -291,7 +308,7 @@ private void assertSpanAttributes(
291308
assertThat(span.getName()).isEqualTo(spanName);
292309
assertSemanticConventionsAttributes(
293310
spanAttributes, rpcService, method, peerName, peerPort, url, statusCode);
294-
assertProducerOrClientAwsAttributes(
311+
assertAwsAttributes(
295312
spanAttributes,
296313
localService,
297314
localOperation,
@@ -305,7 +322,7 @@ private void assertSpanAttributes(
305322
});
306323
}
307324

308-
private void assertProducerOrClientAwsAttributes(
325+
private void assertAwsAttributes(
309326
List<KeyValue> attributesList,
310327
String localService,
311328
String localOperation,
@@ -327,22 +344,16 @@ private void assertProducerOrClientAwsAttributes(
327344
}
328345
}
329346

330-
private void assertConsumerAwsAttributes(
331-
List<KeyValue> attributesList, String service, String operation) {
332-
assertThat(attributesList)
333-
.satisfiesOnlyOnce(assertAttribute(AppSignalsConstants.AWS_LOCAL_OPERATION, operation))
334-
.satisfiesOnlyOnce(assertAttribute(AppSignalsConstants.AWS_LOCAL_SERVICE, service))
335-
.satisfiesOnlyOnce(assertAttribute(AppSignalsConstants.AWS_SPAN_KIND, "LOCAL_ROOT"));
336-
}
337-
338347
private void assertSqsConsumerAwsAttributes(List<KeyValue> attributesList, String operation) {
339348
assertThat(attributesList)
340-
// AWS_LOCAL_OPERATION Is propagated from the parent
341349
.satisfiesOnlyOnce(assertAttribute(AppSignalsConstants.AWS_LOCAL_OPERATION, operation))
342-
.noneSatisfy(assertKeyIsPresent(AppSignalsConstants.AWS_LOCAL_SERVICE))
343-
.noneSatisfy(assertKeyIsPresent(AppSignalsConstants.AWS_REMOTE_OPERATION))
344-
.noneSatisfy(assertKeyIsPresent(AppSignalsConstants.AWS_REMOTE_SERVICE))
345-
.noneSatisfy(assertKeyIsPresent(AppSignalsConstants.AWS_SPAN_KIND));
350+
.satisfiesOnlyOnce(
351+
assertAttribute(AppSignalsConstants.AWS_LOCAL_SERVICE, getApplicationOtelServiceName()))
352+
.satisfiesOnlyOnce(assertAttribute(AppSignalsConstants.AWS_SPAN_KIND, "LOCAL_ROOT"))
353+
.satisfiesOnlyOnce(
354+
assertAttribute(AppSignalsConstants.AWS_REMOTE_OPERATION, "ReceiveMessage"))
355+
.satisfiesOnlyOnce(
356+
assertAttribute(AppSignalsConstants.AWS_REMOTE_SERVICE, getSqsServiceName()));
346357
}
347358

348359
protected void assertMetricClientAttributes(
@@ -387,6 +398,27 @@ protected void assertMetricProducerAttributes(
387398
expectedSum);
388399
}
389400

401+
protected void assertMetricConsumerAttributes(
402+
List<ResourceScopeMetric> resourceScopeMetrics,
403+
String metricName,
404+
String localService,
405+
String localOperation,
406+
String service,
407+
String method,
408+
String target,
409+
Double expectedSum) {
410+
assertMetricAttributes(
411+
resourceScopeMetrics,
412+
metricName,
413+
"CONSUMER",
414+
localService,
415+
localOperation,
416+
service,
417+
method,
418+
target,
419+
expectedSum);
420+
}
421+
390422
protected void assertMetricAttributes(
391423
List<ResourceScopeMetric> resourceScopeMetrics,
392424
String metricName,
@@ -407,7 +439,7 @@ protected void assertMetricAttributes(
407439
dataPoint -> {
408440
List<KeyValue> attributes = dataPoint.getAttributesList();
409441
assertThat(attributes).isNotNull();
410-
assertProducerOrClientAwsAttributes(
442+
assertAwsAttributes(
411443
attributes,
412444
localService,
413445
localOperation,
@@ -1032,7 +1064,7 @@ protected void doTestSQSSendMessage() throws Exception {
10321064

10331065
assertSpanProducerAttributes(
10341066
traces,
1035-
sqsSpanName("SendMessage"),
1067+
"some-queue publish",
10361068
getSqsRpcServiceName(),
10371069
localService,
10381070
localOperation,
@@ -1088,11 +1120,15 @@ protected void doTestSQSReceiveMessage() throws Exception {
10881120
AppSignalsConstants.FAULT_METRIC,
10891121
AppSignalsConstants.LATENCY_METRIC));
10901122

1123+
var localService = getApplicationOtelServiceName();
1124+
var localOperation = "InternalOperation";
1125+
// ReceiveMessage does not capture aws.queue.name
1126+
String target = null;
10911127
// Consumer traces for SQS behave like a Server span (they create the local aws service
10921128
// attributes), but have RPC attributes like a client span.
10931129
assertSpanConsumerAttributes(
10941130
traces,
1095-
sqsSpanName("ReceiveMessage"),
1131+
"some-queue process",
10961132
getSqsRpcServiceName(),
10971133
"InternalOperation",
10981134
getApplicationOtelServiceName(),
@@ -1103,27 +1139,24 @@ protected void doTestSQSReceiveMessage() throws Exception {
11031139
200,
11041140
testSQSReceiveMessageExtraAssertions(response.contentUtf8()));
11051141

1106-
// SQS consumer spans do not produce metrics.
1107-
// Checking that there is no metric that has a datapoint with consumer attributes
1108-
assertThat(metrics)
1109-
.noneSatisfy(
1110-
metric -> {
1111-
var dataPoints = metric.getMetric().getExponentialHistogram().getDataPointsList();
1112-
assertThat(dataPoints)
1113-
.anySatisfy(
1114-
dataPoint -> {
1115-
List<KeyValue> attributes = dataPoint.getAttributesList();
1116-
assertThat(attributes).isNotNull();
1117-
assertThat(attributes)
1118-
.anySatisfy(
1119-
attribute -> {
1120-
assertConsumerAwsAttributes(
1121-
attributes,
1122-
getApplicationOtelServiceName(),
1123-
"InternalOperation");
1124-
});
1125-
});
1126-
});
1142+
assertMetricConsumerAttributes(
1143+
metrics,
1144+
AppSignalsConstants.LATENCY_METRIC,
1145+
localService,
1146+
localOperation,
1147+
getSqsServiceName(),
1148+
"ReceiveMessage",
1149+
target,
1150+
5000.0);
1151+
assertMetricConsumerAttributes(
1152+
metrics,
1153+
AppSignalsConstants.ERROR_METRIC,
1154+
localService,
1155+
localOperation,
1156+
getSqsServiceName(),
1157+
"ReceiveMessage",
1158+
target,
1159+
0.0);
11271160
}
11281161

11291162
protected void doTestSQSError() throws Exception {
@@ -1143,7 +1176,7 @@ protected void doTestSQSError() throws Exception {
11431176

11441177
assertSpanProducerAttributes(
11451178
traces,
1146-
sqsSpanName("SendMessage"),
1179+
"error.test:8080 publish",
11471180
getSqsRpcServiceName(),
11481181
localService,
11491182
localOperation,
@@ -1202,7 +1235,7 @@ protected void doTestSQSFault() throws Exception {
12021235

12031236
assertSpanProducerAttributes(
12041237
traces,
1205-
sqsSpanName("SendMessage"),
1238+
"fault.test:8080 publish",
12061239
getSqsRpcServiceName(),
12071240
localService,
12081241
localOperation,

appsignals-tests/contract-tests/src/test/java/software/amazon/opentelemetry/appsignals/test/kafka/consumers/KafkaConsumersTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ protected List<Startable> getApplicationDependsOnContainers() {
7777
.withEnv("KAFKA_AUTO_CREATE_TOPICS_ENABLE", "false")
7878
.withNetworkAliases("kafkaBroker")
7979
.withNetwork(network)
80-
.waitingFor(Wait.forLogMessage(".*started (kafka.server.KafkaServer).*", 1))
80+
.waitingFor(Wait.forLogMessage(".* Kafka Server started .*", 1))
8181
.withKraft();
8282
return List.of(kafka);
8383
}

appsignals-tests/contract-tests/src/test/java/software/amazon/opentelemetry/appsignals/test/kafka/producers/KafkaProducersTest.java

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ public void testSuccess() {
5353
var kafkaTopic = "kafka_topic";
5454
var otelStatusCode = "STATUS_CODE_UNSET";
5555
var response = appClient.get(path).aggregate().join();
56-
5756
assertThat(response.status().isSuccess()).isTrue();
5857

5958
var resourceScopeSpans = mockCollectorClient.getTraces();
@@ -111,7 +110,7 @@ protected List<Startable> getApplicationDependsOnContainers() {
111110
.withEnv("KAFKA_AUTO_CREATE_TOPICS_ENABLE", "false")
112111
.withNetworkAliases("kafkaBroker")
113112
.withNetwork(network)
114-
.waitingFor(Wait.forLogMessage(".*started (kafka.server.KafkaServer).*", 1))
113+
.waitingFor(Wait.forLogMessage(".* Kafka Server started .*", 1))
115114
.withKraft();
116115
return List.of(kafka);
117116
}
@@ -188,7 +187,7 @@ protected void assertAwsAttributes(
188187
.satisfiesOnlyOnce(
189188
attribute -> {
190189
assertThat(attribute.getKey()).isEqualTo(AppSignalsConstants.AWS_REMOTE_OPERATION);
191-
assertThat(attribute.getValue().getStringValue()).isEqualTo("UnknownRemoteOperation");
190+
assertThat(attribute.getValue().getStringValue()).isEqualTo("publish");
192191
})
193192
.satisfiesOnlyOnce(
194193
attribute -> {
@@ -197,8 +196,6 @@ protected void assertAwsAttributes(
197196
});
198197
}
199198

200-
// TODO: SemanticConventionsConstants.MESSAGING_OPERATION is not currently present, however it
201-
// should be populated and we are currently following up on this.
202199
protected void assertSemanticConventionsAttributes(
203200
List<KeyValue> attributesList, String kafkaTopic) {
204201
assertThat(attributesList)
@@ -230,10 +227,11 @@ protected void assertSemanticConventionsAttributes(
230227
.isEqualTo(SemanticConventionsConstants.MESSAGING_SYSTEM);
231228
assertThat(attribute.getValue().getStringValue()).isEqualTo("kafka");
232229
})
233-
.allSatisfy(
230+
.satisfiesOnlyOnce(
234231
attribute -> {
235232
assertThat(attribute.getKey())
236-
.isNotEqualTo(SemanticConventionsConstants.MESSAGING_OPERATION);
233+
.isEqualTo(SemanticConventionsConstants.MESSAGING_OPERATION);
234+
assertThat(attribute.getValue().getStringValue()).isEqualTo("publish");
237235
})
238236
.satisfiesOnlyOnce(
239237
attribute -> {
@@ -296,7 +294,7 @@ protected void assertMetricAttributes(
296294
assertThat(attribute.getKey())
297295
.isEqualTo(AppSignalsConstants.AWS_REMOTE_OPERATION);
298296
assertThat(attribute.getValue().getStringValue())
299-
.isEqualTo("UnknownRemoteOperation");
297+
.isEqualTo("publish");
300298
});
301299

302300
if (expectedSum != null) {

appsignals-tests/images/aws-sdk/aws-sdk-v1/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ dependencies {
2727
implementation("com.sparkjava:spark-core")
2828
implementation("com.google.code.gson:gson:2.10.1")
2929
implementation("org.slf4j:slf4j-simple")
30-
implementation(platform("com.amazonaws:aws-java-sdk-bom:1.12.514"))
30+
implementation(enforcedPlatform("com.amazonaws:aws-java-sdk-bom:1.12.514"))
3131
implementation("com.amazonaws:aws-java-sdk-s3")
3232
implementation("com.amazonaws:aws-java-sdk-dynamodb")
3333
implementation("com.amazonaws:aws-java-sdk-sqs")

appsignals-tests/images/aws-sdk/aws-sdk-v1/src/main/java/com/amazon/sampleapp/App.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ private static void setupSqs() {
158158

159159
var readMessageRequest = new ReceiveMessageRequest(response.getQueueUrl());
160160
var messages = sqsClient.receiveMessage(readMessageRequest).getMessages();
161+
logger.info("Message Received: ", messages.toString());
161162
return response.getQueueUrl();
162163
});
163164

@@ -180,7 +181,8 @@ private static void setupSqs() {
180181
try {
181182
errorClient.sendMessage(sendMessageRequest);
182183
} catch (Exception ex) {
183-
184+
logger.info("Exception Caught in Sample App");
185+
ex.printStackTrace();
184186
}
185187
return "";
186188
});

0 commit comments

Comments
 (0)