Skip to content

Commit 803d855

Browse files
committed
Update container.image.tag to container.image.tags
1 parent 49f1b62 commit 803d855

File tree

3 files changed

+11
-15
lines changed

3 files changed

+11
-15
lines changed

aws-resources/src/main/java/io/opentelemetry/contrib/aws/resource/EcsResource.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,9 +192,8 @@ static void parseResponse(
192192
DockerImage parsedImage = DockerImage.parse(value);
193193
if (parsedImage != null) {
194194
attrBuilders.put(CONTAINER_IMAGE_NAME, parsedImage.getRepository());
195-
// TODO: CONTAINER_IMAGE_TAG has been replaced with CONTAINER_IMAGE_TAGS
196195
attrBuilders.put(
197-
io.opentelemetry.semconv.ResourceAttributes.CONTAINER_IMAGE_TAG,
196+
io.opentelemetry.contrib.aws.resource.IncubatingAttributes.CONTAINER_IMAGE_TAGS,
198197
parsedImage.getTag());
199198
}
200199
break;

aws-resources/src/main/java/io/opentelemetry/contrib/aws/resource/IncubatingAttributes.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ private IncubatingAttributes() {}
2626
public static final AttributeKey<String> CLOUD_REGION = AttributeKey.stringKey("cloud.region");
2727
public static final AttributeKey<String> CLOUD_RESOURCE_ID =
2828
AttributeKey.stringKey("cloud.resource_id");
29+
public static final AttributeKey<List<String>> CONTAINER_IMAGE_TAGS =
30+
AttributeKey.stringArrayKey("container.image.tags");
2931

3032
public static final class CloudPlatformIncubatingValues {
3133
public static final String AWS_EC2 = "aws_ec2";

aws-resources/src/test/java/io/opentelemetry/contrib/aws/resource/EcsResourceTest.java

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@
2424
import static io.opentelemetry.semconv.incubating.CloudIncubatingAttributes.CLOUD_RESOURCE_ID;
2525
import static io.opentelemetry.semconv.incubating.ContainerIncubatingAttributes.CONTAINER_ID;
2626
import static io.opentelemetry.semconv.incubating.ContainerIncubatingAttributes.CONTAINER_IMAGE_NAME;
27+
import static io.opentelemetry.semconv.incubating.ContainerIncubatingAttributes.CONTAINER_IMAGE_TAGS;
2728
import static io.opentelemetry.semconv.incubating.ContainerIncubatingAttributes.CONTAINER_NAME;
29+
import static java.util.Collections.singletonList;
2830
import static org.assertj.core.api.Assertions.entry;
2931
import static org.mockito.Mockito.when;
3032

@@ -52,8 +54,6 @@ class EcsResourceTest {
5254

5355
@Mock private SimpleHttpClient mockHttpClient;
5456

55-
// Suppression is required for CONTAINER_IMAGE_TAG until we are ready to upgrade.
56-
@SuppressWarnings("deprecation")
5757
@Test
5858
void testCreateAttributesV3() throws IOException {
5959
Map<String, String> mockSysEnv = new HashMap<>();
@@ -78,7 +78,7 @@ void testCreateAttributesV3() throws IOException {
7878
entry(CONTAINER_NAME, "ecs-nginx-5-nginx-curl-ccccb9f49db0dfe0d901"),
7979
entry(CONTAINER_ID, "43481a6ce4842eec8fe72fc28500c6b52edcc0917f105b83379f88cac1ff3946"),
8080
entry(CONTAINER_IMAGE_NAME, "nrdlngr/nginx-curl"),
81-
entry(io.opentelemetry.semconv.ResourceAttributes.CONTAINER_IMAGE_TAG, "latest"),
81+
entry(CONTAINER_IMAGE_TAGS, singletonList("latest")),
8282
entry(AWS_ECS_CLUSTER_ARN, "arn:aws:ecs:us-east-2:012345678910:cluster/default"),
8383
entry(
8484
AttributeKey.stringKey("aws.ecs.container.image.id"),
@@ -90,8 +90,6 @@ void testCreateAttributesV3() throws IOException {
9090
entry(AWS_ECS_TASK_REVISION, "5"));
9191
}
9292

93-
// Suppression is required for CONTAINER_IMAGE_TAG until we are ready to upgrade.
94-
@SuppressWarnings("deprecation")
9593
@Test
9694
void testCreateAttributesV4() throws IOException {
9795
Map<String, String> mockSysEnv = new HashMap<>();
@@ -119,25 +117,22 @@ void testCreateAttributesV4() throws IOException {
119117
entry(CONTAINER_NAME, "ecs-curltest-26-curl-cca48e8dcadd97805600"),
120118
entry(CONTAINER_ID, "ea32192c8553fbff06c9340478a2ff089b2bb5646fb718b4ee206641c9086d66"),
121119
entry(CONTAINER_IMAGE_NAME, "111122223333.dkr.ecr.us-west-2.amazonaws.com/curltest"),
122-
entry(io.opentelemetry.semconv.ResourceAttributes.CONTAINER_IMAGE_TAG, "latest"),
120+
entry(CONTAINER_IMAGE_TAGS, singletonList("latest")),
123121
entry(
124122
AttributeKey.stringKey("aws.ecs.container.image.id"),
125123
"sha256:d691691e9652791a60114e67b365688d20d19940dde7c4736ea30e660d8d3553"),
126124
entry(AWS_ECS_CLUSTER_ARN, "arn:aws:ecs:us-west-2:111122223333:cluster/default"),
127125
entry(
128126
AWS_ECS_CONTAINER_ARN,
129127
"arn:aws:ecs:us-west-2:111122223333:container/0206b271-b33f-47ab-86c6-a0ba208a70a9"),
130-
entry(AWS_LOG_GROUP_NAMES, Collections.singletonList("/ecs/metadata")),
128+
entry(AWS_LOG_GROUP_NAMES, singletonList("/ecs/metadata")),
131129
entry(
132130
AWS_LOG_GROUP_ARNS,
133-
Collections.singletonList(
134-
"arn:aws:logs:us-west-2:111122223333:log-group:/ecs/metadata")),
135-
entry(
136-
AWS_LOG_STREAM_NAMES,
137-
Collections.singletonList("ecs/curl/8f03e41243824aea923aca126495f665")),
131+
singletonList("arn:aws:logs:us-west-2:111122223333:log-group:/ecs/metadata")),
132+
entry(AWS_LOG_STREAM_NAMES, singletonList("ecs/curl/8f03e41243824aea923aca126495f665")),
138133
entry(
139134
AWS_LOG_STREAM_ARNS,
140-
Collections.singletonList(
135+
singletonList(
141136
"arn:aws:logs:us-west-2:111122223333:log-group:/ecs/metadata:log-stream:ecs/curl/8f03e41243824aea923aca126495f665")),
142137
entry(
143138
AWS_ECS_TASK_ARN,

0 commit comments

Comments
 (0)