Skip to content

Commit

Permalink
feat: added support for AWS AppRunner origin (#6141)
Browse files Browse the repository at this point in the history
  • Loading branch information
willarmiros authored Nov 9, 2021
1 parent 111e068 commit 14a6ff3
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions exporter/awsxrayexporter/internal/translator/segment.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ const (
OriginECSFargate = "AWS::ECS::Fargate"
OriginEB = "AWS::ElasticBeanstalk::Environment"
OriginEKS = "AWS::EKS::Container"
OriginAppRunner = "AWS::AppRunner::Service"
)

var (
Expand Down Expand Up @@ -231,16 +232,17 @@ func determineAwsOrigin(resource pdata.Resource) string {
}
}

// TODO(willarmiros): Only use platform for origin resolution once detectors for all AWS environments are
// implemented for robustness
if is, present := resource.Attributes().Get(conventions.AttributeCloudPlatform); present {
switch is.StringVal() {
// TODO: Replace with semantic convention const when aws_app_runner is included in an official semconv release
case "aws_app_runner":
return OriginAppRunner
case conventions.AttributeCloudPlatformAWSEKS:
return OriginEKS
case conventions.AttributeCloudPlatformAWSElasticBeanstalk:
return OriginEB
case conventions.AttributeCloudPlatformAWSECS:
lt, present := resource.Attributes().Get("aws.ecs.launchtype")
lt, present := resource.Attributes().Get(conventions.AttributeAWSECSLaunchtype)
if !present {
return OriginECS
}
Expand All @@ -255,7 +257,7 @@ func determineAwsOrigin(resource pdata.Resource) string {
case conventions.AttributeCloudPlatformAWSEC2:
return OriginEC2

// If infrastructure_service is defined with a non-AWS value, we should not assign it an AWS origin
// If cloud_platform is defined with a non-AWS value, we should not assign it an AWS origin
default:
return ""
}
Expand Down

0 comments on commit 14a6ff3

Please sign in to comment.