Skip to content

Commit

Permalink
Use cloud.namespace on AWS resourcedetection
Browse files Browse the repository at this point in the history
  • Loading branch information
pmm-sumo committed Feb 4, 2021
1 parent 53a2add commit e265860
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 0 deletions.
Expand Up @@ -74,6 +74,7 @@ func (d *Detector) Detect(ctx context.Context) (pdata.Resource, error) {
attr := res.Attributes()
attr.InsertString(conventions.AttributeCloudProvider, conventions.AttributeCloudProviderAWS)
attr.InsertString("cloud.infrastructure_service", "EC2")
attr.InsertString("cloud.namespace", "ec2")
attr.InsertString(conventions.AttributeCloudRegion, meta.Region)
attr.InsertString(conventions.AttributeCloudAccount, meta.AccountID)
attr.InsertString(conventions.AttributeCloudZone, meta.AvailabilityZone)
Expand Down
Expand Up @@ -136,6 +136,7 @@ func TestDetector_Detect(t *testing.T) {
attr.InsertString("cloud.account.id", "account1234")
attr.InsertString("cloud.provider", "aws")
attr.InsertString("cloud.infrastructure_service", "EC2")
attr.InsertString("cloud.namespace", "ec2")
attr.InsertString("cloud.region", "us-west-2")
attr.InsertString("cloud.zone", "us-west-2a")
attr.InsertString("host.id", "i-abcd1234")
Expand Down
Expand Up @@ -67,6 +67,7 @@ func (d *Detector) Detect(context.Context) (pdata.Resource, error) {
attr := res.Attributes()
attr.InsertString(conventions.AttributeCloudProvider, conventions.AttributeCloudProviderAWS)
attr.InsertString("cloud.infrastructure_service", "ECS")
attr.InsertString("cloud.namespace", "ecs")
attr.InsertString("aws.ecs.task.arn", tmdeResp.TaskARN)
attr.InsertString("aws.ecs.task.family", tmdeResp.Family)

Expand Down
Expand Up @@ -115,6 +115,7 @@ func Test_ecsDetectV4(t *testing.T) {
attr := want.Attributes()
attr.InsertString("cloud.provider", "aws")
attr.InsertString("cloud.infrastructure_service", "ECS")
attr.InsertString("cloud.namespace", "ecs")
attr.InsertString("aws.ecs.cluster.arn", "arn:aws:ecs:us-west-2:123456789123:cluster/my-cluster")
attr.InsertString("aws.ecs.task.arn", "arn:aws:ecs:us-west-2:123456789123:task/123")
attr.InsertString("aws.ecs.task.family", "family")
Expand Down Expand Up @@ -149,6 +150,7 @@ func Test_ecsDetectV3(t *testing.T) {
attr := want.Attributes()
attr.InsertString("cloud.provider", "aws")
attr.InsertString("cloud.infrastructure_service", "ECS")
attr.InsertString("cloud.namespace", "ecs")
attr.InsertString("aws.ecs.cluster.arn", "arn:aws:ecs:us-west-2:123456789123:cluster/my-cluster")
attr.InsertString("aws.ecs.task.arn", "arn:aws:ecs:us-west-2:123456789123:task/123")
attr.InsertString("aws.ecs.task.family", "family")
Expand Down
Expand Up @@ -79,6 +79,7 @@ func (d Detector) Detect(context.Context) (pdata.Resource, error) {
attr := res.Attributes()
attr.InsertString(conventions.AttributeCloudProvider, conventions.AttributeCloudProviderAWS)
attr.InsertString("cloud.infrastructure_service", "ElasticBeanstalk")
attr.InsertString("cloud.namespace", "ElasticBeanstalk")
attr.InsertString(conventions.AttributeServiceInstance, strconv.Itoa(ebmd.DeploymentID))
attr.InsertString(conventions.AttributeDeploymentEnvironment, ebmd.EnvironmentName)
attr.InsertString(conventions.AttributeServiceVersion, ebmd.VersionLabel)
Expand Down
Expand Up @@ -100,6 +100,7 @@ func Test_AttributesDetectedSuccessfully(t *testing.T) {
attr := want.Attributes()
attr.InsertString("cloud.provider", "aws")
attr.InsertString("cloud.infrastructure_service", "ElasticBeanstalk")
attr.InsertString("cloud.namespace", "ElasticBeanstalk")
attr.InsertString("deployment.environment", "BETA")
attr.InsertString("service.instance.id", "23")
attr.InsertString("service.version", "env-version-1234")
Expand Down

0 comments on commit e265860

Please sign in to comment.