diff --git a/detectors/aws/ecs/ecs.go b/detectors/aws/ecs/ecs.go index 46186f7bf9e..9d28f3f3cbf 100644 --- a/detectors/aws/ecs/ecs.go +++ b/detectors/aws/ecs/ecs.go @@ -168,10 +168,10 @@ func (detector *resourceDetector) getLogsAttributes(metadata *ecsmetadata.Contai awsAccount := r.FindStringSubmatch(containerArn)[1] return []attribute.KeyValue{ - semconv.AWSLogGroupNamesKey.String(logsOptions.AwsLogsGroup), - semconv.AWSLogGroupARNsKey.String(fmt.Sprintf("arn:aws:logs:%s:%s:log-group:%s:*", logsRegion, awsAccount, logsOptions.AwsLogsGroup)), - semconv.AWSLogStreamNamesKey.String(logsOptions.AwsLogsStream), - semconv.AWSLogStreamARNsKey.String(fmt.Sprintf("arn:aws:logs:%s:%s:log-group:%s:log-stream:%s", logsRegion, awsAccount, logsOptions.AwsLogsGroup, logsOptions.AwsLogsStream)), + semconv.AWSLogGroupNamesKey.StringSlice([]string{logsOptions.AwsLogsGroup}), + semconv.AWSLogGroupARNsKey.StringSlice([]string{fmt.Sprintf("arn:aws:logs:%s:%s:log-group:%s:*", logsRegion, awsAccount, logsOptions.AwsLogsGroup)}), + semconv.AWSLogStreamNamesKey.StringSlice([]string{logsOptions.AwsLogsStream}), + semconv.AWSLogStreamARNsKey.StringSlice([]string{fmt.Sprintf("arn:aws:logs:%s:%s:log-group:%s:log-stream:%s", logsRegion, awsAccount, logsOptions.AwsLogsGroup, logsOptions.AwsLogsStream)}), }, nil } diff --git a/detectors/aws/ecs/ecs_test.go b/detectors/aws/ecs/ecs_test.go index b0bb3bb86b1..99835e0dbb6 100644 --- a/detectors/aws/ecs/ecs_test.go +++ b/detectors/aws/ecs/ecs_test.go @@ -107,10 +107,10 @@ func TestDetectV4LaunchTypeEc2(t *testing.T) { semconv.AWSECSTaskARNKey.String("arn:aws:ecs:us-west-2:111122223333:task/default/158d1c8083dd49d6b527399fd6414f5c"), semconv.AWSECSTaskFamilyKey.String("curltest"), semconv.AWSECSTaskRevisionKey.String("26"), - semconv.AWSLogGroupNamesKey.String("/ecs/metadata"), - semconv.AWSLogGroupARNsKey.String("arn:aws:logs:us-west-2:111122223333:log-group:/ecs/metadata:*"), - semconv.AWSLogStreamNamesKey.String("ecs/curl/8f03e41243824aea923aca126495f665"), - semconv.AWSLogStreamARNsKey.String("arn:aws:logs:us-west-2:111122223333:log-group:/ecs/metadata:log-stream:ecs/curl/8f03e41243824aea923aca126495f665"), + semconv.AWSLogGroupNamesKey.StringSlice([]string{"/ecs/metadata"}), + semconv.AWSLogGroupARNsKey.StringSlice([]string{"arn:aws:logs:us-west-2:111122223333:log-group:/ecs/metadata:*"}), + semconv.AWSLogStreamNamesKey.StringSlice([]string{"ecs/curl/8f03e41243824aea923aca126495f665"}), + semconv.AWSLogStreamARNsKey.StringSlice([]string{"arn:aws:logs:us-west-2:111122223333:log-group:/ecs/metadata:log-stream:ecs/curl/8f03e41243824aea923aca126495f665"}), } expectedResource := resource.NewWithAttributes(semconv.SchemaURL, attributes...) detector := &resourceDetector{utils: detectorUtils} @@ -158,10 +158,10 @@ func TestDetectV4LaunchTypeFargate(t *testing.T) { semconv.AWSECSTaskARNKey.String("arn:aws:ecs:us-west-2:111122223333:task/default/e9028f8d5d8e4f258373e7b93ce9a3c3"), semconv.AWSECSTaskFamilyKey.String("curltest"), semconv.AWSECSTaskRevisionKey.String("3"), - semconv.AWSLogGroupNamesKey.String("/ecs/containerlogs"), - semconv.AWSLogGroupARNsKey.String("arn:aws:logs:us-west-2:111122223333:log-group:/ecs/containerlogs:*"), - semconv.AWSLogStreamNamesKey.String("ecs/curl/cd189a933e5849daa93386466019ab50"), - semconv.AWSLogStreamARNsKey.String("arn:aws:logs:us-west-2:111122223333:log-group:/ecs/containerlogs:log-stream:ecs/curl/cd189a933e5849daa93386466019ab50"), + semconv.AWSLogGroupNamesKey.StringSlice([]string{"/ecs/containerlogs"}), + semconv.AWSLogGroupARNsKey.StringSlice([]string{"arn:aws:logs:us-west-2:111122223333:log-group:/ecs/containerlogs:*"}), + semconv.AWSLogStreamNamesKey.StringSlice([]string{"ecs/curl/cd189a933e5849daa93386466019ab50"}), + semconv.AWSLogStreamARNsKey.StringSlice([]string{"arn:aws:logs:us-west-2:111122223333:log-group:/ecs/containerlogs:log-stream:ecs/curl/cd189a933e5849daa93386466019ab50"}), } expectedResource := resource.NewWithAttributes(semconv.SchemaURL, attributes...) detector := &resourceDetector{utils: detectorUtils}