Skip to content

Commit a4e59e5

Browse files
Upgrade to OTel v2.23.0 and Contrib v1.52.0 (#1292)
### Background As part of the upgrade, we need to ensure our patches still apply appropriately to the code of the new versions. This PR serves to upgrade the version numbers of open-telemetry/opentelemetry-java-instrumentation and open-telemetry/opentelemetry-java-contrib. This will also speed up build times, as the open-telemetry/opentelemetry-java-instrumentation patch has been removed again. ### Process For both repos: 1. Check out current revision of repo 2. Apply patch file to it and commit, generating commit X 3. Check out the new version of the repo we want to upgrade to 4. `git cherry-pick X` 5. Handle cherry pick conflicts ### Testing PR build passes, once merged will verify that main-build also passes Main build from this branch: https://github.com/aws-observability/aws-otel-java-instrumentation/actions/runs/21277061991 ### AWS SDK Instrumentation changes https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/tag/v2.22.0 released the following AWS SDK V1/V2 changes: AWS SDK V1: - The following attributes have been renamed and are now emitted by default (no experimental flag required): - aws.bucket.name (S3) → aws.s3.bucket - aws.queue.url (SQS) → aws.sqs.queue.url - aws.stream.name (Kinesis) → aws.kinesis.stream_name - aws.table.name (DynamoDB) → aws.dynamodb.table_names AWS SDK V2: - The following attributes have been renamed: - aws.bucket.name (S3) → aws.s3.bucket - aws.queue.url (SQS) → aws.sqs.queue.url - aws.stream.name (Kinesis) → aws.kinesis.stream_name - aws.table.name (DynamoDB) → aws.dynamodb.table_names - The following attribute types have changed: - aws.dynamodb.table_names: string → string[] - The following attributes are no longer emitted by default but can be enabled with otel.instrumentation.aws-sdk.experimental-span-attributes=true: - aws.queue.name (SQS) - aws.lambda.function.name (Lambda) - aws.lambda.function.arn (Lambda) We DO specify `otel.instrumentation.aws-sdk.experimental-span-attributes=true`, so this is not a concern, but for all the renames, etc, we had to make some changes. Nothing critical was identified, this should be a no-op from customer perspective. By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license. --------- Co-authored-by: Thomas Pierce <thp@amazon.com>
1 parent 2244f92 commit a4e59e5

14 files changed

Lines changed: 265 additions & 3621 deletions

File tree

.github/patches/opentelemetry-java-contrib.patch

Lines changed: 64 additions & 3453 deletions
Large diffs are not rendered by default.

.github/patches/opentelemetry-java-instrumentation.patch

Lines changed: 0 additions & 26 deletions
This file was deleted.

.github/patches/versions

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
OTEL_JAVA_INSTRUMENTATION_VERSION=v2.20.1
2-
OTEL_JAVA_CONTRIB_VERSION=v1.48.0
1+
OTEL_JAVA_INSTRUMENTATION_VERSION=v2.23.0
2+
OTEL_JAVA_CONTRIB_VERSION=v1.52.0

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ If your change does not need a CHANGELOG entry, add the "skip changelog" label t
1313

1414
## Unreleased
1515

16+
- Ugrade to OTel v2.23.0 and Contrib v1.52.0
17+
([#1292](https://github.com/aws-observability/aws-otel-java-instrumentation/pull/1292))
1618
- Adaptive Sampling: Ensure the highest priority sampling rule is matched
1719
([#1290](https://github.com/aws-observability/aws-otel-java-instrumentation/pull/1290))
1820
- Sign Lambda layer by AWS Signer

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

Lines changed: 39 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,24 @@ protected ThrowingConsumer<KeyValue> assertAttribute(String key, String value) {
239239
};
240240
}
241241

242+
protected ThrowingConsumer<KeyValue> assertAttribute(String key, String[] valueArray) {
243+
return (attribute) -> {
244+
var actualKey = attribute.getKey();
245+
assertThat(actualKey).isEqualTo(key);
246+
247+
// For now, only handle arrays of length 1.
248+
var actualValueArray = attribute.getValue().getArrayValue();
249+
var actualCount = actualValueArray.getValuesCount();
250+
assertThat(actualCount).isEqualTo(1);
251+
assertThat(valueArray.length).isEqualTo(1);
252+
253+
var value = valueArray[0];
254+
var actualValue = actualValueArray.getValues(0).getStringValue();
255+
256+
assertThat(actualValue).isEqualTo(value);
257+
};
258+
}
259+
242260
protected ThrowingConsumer<KeyValue> assertAttributeStartsWith(String key, String value) {
243261
return (attribute) -> {
244262
assertThat(attribute.getKey()).isEqualTo(key);
@@ -714,7 +732,7 @@ protected void doTestS3CreateBucket() throws Exception {
714732
4566,
715733
"http://create-bucket.s3.localstack:4566",
716734
200,
717-
List.of(assertAttribute(SemanticConventionsConstants.AWS_BUCKET_NAME, "create-bucket")));
735+
List.of(assertAttribute(SemanticConventionsConstants.AWS_S3_BUCKET, "create-bucket")));
718736
assertMetricClientAttributes(
719737
metrics,
720738
AppSignalsConstants.LATENCY_METRIC,
@@ -794,7 +812,7 @@ protected void doTestS3CreateObject() throws Exception {
794812
4566,
795813
"http://put-object.s3.localstack:4566",
796814
200,
797-
List.of(assertAttribute(SemanticConventionsConstants.AWS_BUCKET_NAME, "put-object")));
815+
List.of(assertAttribute(SemanticConventionsConstants.AWS_S3_BUCKET, "put-object")));
798816
assertMetricClientAttributes(
799817
metrics,
800818
AppSignalsConstants.LATENCY_METRIC,
@@ -873,7 +891,7 @@ protected void doTestS3GetObject() throws Exception {
873891
4566,
874892
"http://get-object.s3.localstack:4566",
875893
200,
876-
List.of(assertAttribute(SemanticConventionsConstants.AWS_BUCKET_NAME, "get-object")));
894+
List.of(assertAttribute(SemanticConventionsConstants.AWS_S3_BUCKET, "get-object")));
877895
assertMetricClientAttributes(
878896
metrics,
879897
AppSignalsConstants.LATENCY_METRIC,
@@ -952,7 +970,7 @@ protected void doTestS3Error() {
952970
8080,
953971
"http://error-bucket.s3.test:8080",
954972
400,
955-
List.of(assertAttribute(SemanticConventionsConstants.AWS_BUCKET_NAME, "error-bucket")));
973+
List.of(assertAttribute(SemanticConventionsConstants.AWS_S3_BUCKET, "error-bucket")));
956974
assertMetricClientAttributes(
957975
metrics,
958976
AppSignalsConstants.LATENCY_METRIC,
@@ -1031,7 +1049,7 @@ protected void doTestS3Fault() {
10311049
8080,
10321050
"http://fault-bucket.s3.test:8080",
10331051
500,
1034-
List.of(assertAttribute(SemanticConventionsConstants.AWS_BUCKET_NAME, "fault-bucket")));
1052+
List.of(assertAttribute(SemanticConventionsConstants.AWS_S3_BUCKET, "fault-bucket")));
10351053
assertMetricClientAttributes(
10361054
metrics,
10371055
AppSignalsConstants.LATENCY_METRIC,
@@ -1079,7 +1097,8 @@ protected void doTestS3Fault() {
10791097
protected List<ThrowingConsumer<KeyValue>> dynamoDbAttributes(
10801098
String operation, String tableName) {
10811099
return List.of(
1082-
assertAttribute(SemanticConventionsConstants.AWS_TABLE_NAME, tableName),
1100+
assertAttribute(
1101+
SemanticConventionsConstants.AWS_DYNAMODB_TABLE_NAMES, new String[] {tableName}),
10831102
assertAttribute(SemanticConventionsConstants.DB_SYSTEM, "dynamodb"),
10841103
assertAttribute(SemanticConventionsConstants.DB_OPERATION, operation));
10851104
}
@@ -1603,7 +1622,8 @@ protected void doTestSQSSendMessage() throws Exception {
16031622
"http://localstack:4566",
16041623
200,
16051624
List.of(
1606-
assertAttribute(SemanticConventionsConstants.AWS_QUEUE_URL, response.contentUtf8())));
1625+
assertAttribute(
1626+
SemanticConventionsConstants.AWS_SQS_QUEUE_URL, response.contentUtf8())));
16071627
assertMetricProducerAttributes(
16081628
metrics,
16091629
AppSignalsConstants.LATENCY_METRIC,
@@ -1649,7 +1669,7 @@ protected void doTestSQSSendMessage() throws Exception {
16491669
}
16501670

16511671
protected List<ThrowingConsumer<KeyValue>> testSQSReceiveMessageExtraAssertions(String queueUrl) {
1652-
return List.of(assertAttribute(SemanticConventionsConstants.AWS_QUEUE_URL, queueUrl));
1672+
return List.of(assertAttribute(SemanticConventionsConstants.AWS_SQS_QUEUE_URL, queueUrl));
16531673
}
16541674

16551675
protected void doTestSQSReceiveMessage() throws Exception {
@@ -1749,7 +1769,8 @@ protected void doTestSQSError() throws Exception {
17491769
"http://error.test:8080",
17501770
400,
17511771
List.of(
1752-
assertAttribute(SemanticConventionsConstants.AWS_QUEUE_URL, "http://error.test:8080")));
1772+
assertAttribute(
1773+
SemanticConventionsConstants.AWS_SQS_QUEUE_URL, "http://error.test:8080")));
17531774
assertMetricProducerAttributes(
17541775
metrics,
17551776
AppSignalsConstants.LATENCY_METRIC,
@@ -1830,7 +1851,8 @@ protected void doTestSQSFault() throws Exception {
18301851
"http://fault.test:8080",
18311852
500,
18321853
List.of(
1833-
assertAttribute(SemanticConventionsConstants.AWS_QUEUE_URL, "http://fault.test:8080")));
1854+
assertAttribute(
1855+
SemanticConventionsConstants.AWS_SQS_QUEUE_URL, "http://fault.test:8080")));
18341856
assertMetricProducerAttributes(
18351857
metrics,
18361858
AppSignalsConstants.LATENCY_METRIC,
@@ -1909,7 +1931,8 @@ protected void doTestKinesisPutRecord() throws Exception {
19091931
4566,
19101932
"http://localstack:4566",
19111933
200,
1912-
List.of(assertAttribute(SemanticConventionsConstants.AWS_STREAM_NAME, "my-stream")));
1934+
List.of(
1935+
assertAttribute(SemanticConventionsConstants.AWS_KINESIS_STREAM_NAME, "my-stream")));
19131936
assertMetricClientAttributes(
19141937
metrics,
19151938
AppSignalsConstants.LATENCY_METRIC,
@@ -2073,7 +2096,8 @@ protected void doTestKinesisError() throws Exception {
20732096
"http://error.test:8080",
20742097
400,
20752098
List.of(
2076-
assertAttribute(SemanticConventionsConstants.AWS_STREAM_NAME, "nonexistantstream")));
2099+
assertAttribute(
2100+
SemanticConventionsConstants.AWS_KINESIS_STREAM_NAME, "nonexistantstream")));
20772101
assertMetricClientAttributes(
20782102
metrics,
20792103
AppSignalsConstants.LATENCY_METRIC,
@@ -2152,7 +2176,8 @@ protected void doTestKinesisFault() throws Exception {
21522176
8080,
21532177
"http://fault.test:8080",
21542178
500,
2155-
List.of(assertAttribute(SemanticConventionsConstants.AWS_STREAM_NAME, "faultstream")));
2179+
List.of(
2180+
assertAttribute(SemanticConventionsConstants.AWS_KINESIS_STREAM_NAME, "faultstream")));
21562181
assertMetricClientAttributes(
21572182
metrics,
21582183
AppSignalsConstants.LATENCY_METRIC,
@@ -4005,7 +4030,7 @@ protected void doTestCrossAccount(String remoteRegion) throws Exception {
40054030
"http://cross-account-bucket.s3.localstack:4566",
40064031
200,
40074032
List.of(
4008-
assertAttribute(SemanticConventionsConstants.AWS_BUCKET_NAME, "cross-account-bucket")));
4033+
assertAttribute(SemanticConventionsConstants.AWS_S3_BUCKET, "cross-account-bucket")));
40094034
assertMetricClientAttributes(
40104035
metrics,
40114036
AppSignalsConstants.LATENCY_METRIC,

appsignals-tests/contract-tests/src/test/java/software/amazon/opentelemetry/appsignals/test/awssdk/v1/AwsSdkV1Test.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,9 @@ void testS3Fault() {
168168
@Override
169169
protected List<ThrowingConsumer<KeyValue>> dynamoDbAttributes(
170170
String operation, String tableName) {
171-
return List.of(assertAttribute(SemanticConventionsConstants.AWS_TABLE_NAME, tableName));
171+
return List.of(
172+
assertAttribute(
173+
SemanticConventionsConstants.AWS_DYNAMODB_TABLE_NAMES, new String[] {tableName}));
172174
}
173175

174176
@Test

appsignals-tests/contract-tests/src/test/java/software/amazon/opentelemetry/appsignals/test/utils/SemanticConventionsConstants.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,12 @@ public class SemanticConventionsConstants {
5252
public static final String DB_SYSTEM = "db.system";
5353

5454
// These are not official semantic attributes
55-
public static final String AWS_BUCKET_NAME = "aws.bucket.name";
56-
public static final String AWS_TABLE_NAME = "aws.table.name";
57-
public static final String AWS_QUEUE_URL = "aws.queue.url";
55+
public static final String AWS_S3_BUCKET = "aws.s3.bucket";
56+
public static final String AWS_DYNAMODB_TABLE_NAMES = "aws.dynamodb.table_names";
57+
public static final String AWS_SQS_QUEUE_URL = "aws.sqs.queue.url";
5858
public static final String AWS_QUEUE_NAME = "aws.queue.name";
5959
public static final String AWS_STREAM_ARN = "aws.stream.arn";
60-
public static final String AWS_STREAM_NAME = "aws.stream.name";
60+
public static final String AWS_KINESIS_STREAM_NAME = "aws.kinesis.stream_name";
6161
public static final String AWS_KNOWLEDGE_BASE_ID = "aws.bedrock.knowledge_base.id";
6262
public static final String AWS_DATA_SOURCE_ID = "aws.bedrock.data_source.id";
6363
public static final String AWS_AGENT_ID = "aws.bedrock.agent.id";

awsagentprovider/src/main/java/software/amazon/opentelemetry/javaagent/providers/AwsAttributeKeys.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
package software.amazon.opentelemetry.javaagent.providers;
1717

1818
import io.opentelemetry.api.common.AttributeKey;
19+
import java.util.List;
1920

2021
/** Utility class holding attribute keys with special meaning to AWS components */
2122
final class AwsAttributeKeys {
@@ -110,12 +111,14 @@ private AwsAttributeKeys() {}
110111
// TODO: all AWS specific attributes should be defined in semconv package and reused cross all
111112
// otel packages. Related sim -
112113
// https://github.com/open-telemetry/opentelemetry-java-instrumentation/issues/8710
113-
static final AttributeKey<String> AWS_BUCKET_NAME = AttributeKey.stringKey("aws.bucket.name");
114-
static final AttributeKey<String> AWS_QUEUE_URL = AttributeKey.stringKey("aws.queue.url");
114+
static final AttributeKey<String> AWS_S3_BUCKET = AttributeKey.stringKey("aws.s3.bucket");
115+
static final AttributeKey<String> AWS_SQS_QUEUE_URL = AttributeKey.stringKey("aws.sqs.queue.url");
115116
static final AttributeKey<String> AWS_QUEUE_NAME = AttributeKey.stringKey("aws.queue.name");
116-
static final AttributeKey<String> AWS_STREAM_NAME = AttributeKey.stringKey("aws.stream.name");
117+
static final AttributeKey<String> AWS_KINESIS_STREAM_NAME =
118+
AttributeKey.stringKey("aws.kinesis.stream_name");
117119
static final AttributeKey<String> AWS_STREAM_ARN = AttributeKey.stringKey("aws.stream.arn");
118-
static final AttributeKey<String> AWS_TABLE_NAME = AttributeKey.stringKey("aws.table.name");
120+
static final AttributeKey<List<String>> AWS_DYNAMODB_TABLE_NAMES =
121+
AttributeKey.stringArrayKey("aws.dynamodb.table_names");
119122
static final AttributeKey<String> AWS_TABLE_ARN = AttributeKey.stringKey("aws.table.arn");
120123
static final AttributeKey<String> AWS_AGENT_ID = AttributeKey.stringKey("aws.bedrock.agent.id");
121124
static final AttributeKey<String> AWS_KNOWLEDGE_BASE_ID =

0 commit comments

Comments
 (0)