Skip to content

Commit

Permalink
fix: log group|stream Name|ARN need to be string slices
Browse files Browse the repository at this point in the history
  • Loading branch information
Michele Mancioppi committed Aug 17, 2022
1 parent 2e65071 commit 4e857dd
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
8 changes: 4 additions & 4 deletions detectors/aws/ecs/ecs.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
16 changes: 8 additions & 8 deletions detectors/aws/ecs/ecs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down Expand Up @@ -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}
Expand Down

0 comments on commit 4e857dd

Please sign in to comment.