diff --git a/CHANGELOG.md b/CHANGELOG.md index b9ae10df577..8d18c836d98 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Split `go.opentelemetry.io/contrib/propagators` module into `b3`, `jaeger`, `ot` modules. (#985) - `otelmongodb` span attributes, name and span status now conform to specification. (#769) - Migrated EC2 resource detector support from root module `go.opentelemetry.io/contrib/detectors/aws` to a separate EC2 resource detector module `go.opentelemetry.io/contrib/detectors/aws/ec2` (#1017) +- Add `cloud.provider` and `cloud.platform` to AWS detectors. (#1043) - `otelhttptrace.NewClientTrace` now redacts known sensitive headers by default. (#879) ### Fixed diff --git a/detectors/aws/ec2/ec2.go b/detectors/aws/ec2/ec2.go index a47f4d052b0..05d0bc40d48 100644 --- a/detectors/aws/ec2/ec2.go +++ b/detectors/aws/ec2/ec2.go @@ -60,6 +60,7 @@ func (aws *AWS) Detect(ctx context.Context) (*resource.Resource, error) { attributes := []attribute.KeyValue{ semconv.CloudProviderAWS, + semconv.CloudPlatformAWSEC2, semconv.CloudRegionKey.String(doc.Region), semconv.CloudAvailabilityZoneKey.String(doc.AvailabilityZone), semconv.CloudAccountIDKey.String(doc.AccountID), diff --git a/detectors/aws/ec2/ec2_test.go b/detectors/aws/ec2/ec2_test.go index 7ffa5c29b73..254d208a50d 100644 --- a/detectors/aws/ec2/ec2_test.go +++ b/detectors/aws/ec2/ec2_test.go @@ -63,6 +63,7 @@ func TestAWS_Detect(t *testing.T) { usWestIDLabels := []attribute.KeyValue{ semconv.CloudProviderAWS, + semconv.CloudPlatformAWSEC2, semconv.CloudRegionKey.String("us-west-2"), semconv.CloudAvailabilityZoneKey.String("us-west-2b"), semconv.CloudAccountIDKey.String("123456789012"), @@ -137,6 +138,7 @@ func TestAWS_Detect(t *testing.T) { Want: want{Resource: resource.NewWithAttributes( semconv.SchemaURL, semconv.CloudProviderAWS, + semconv.CloudPlatformAWSEC2, semconv.CloudRegionKey.String("us-west-2"), semconv.CloudAvailabilityZoneKey.String("us-west-2b"), semconv.CloudAccountIDKey.String("123456789012"), diff --git a/detectors/aws/ecs/ecs.go b/detectors/aws/ecs/ecs.go index 97392e25df8..7494f2c3efb 100644 --- a/detectors/aws/ecs/ecs.go +++ b/detectors/aws/ecs/ecs.go @@ -85,6 +85,8 @@ func (detector *resourceDetector) Detect(ctx context.Context) (*resource.Resourc return empty, err } attributes := []attribute.KeyValue{ + semconv.CloudProviderAWS, + semconv.CloudPlatformAWSECS, semconv.ContainerNameKey.String(hostName), semconv.ContainerIDKey.String(containerID), } diff --git a/detectors/aws/ecs/ecs_test.go b/detectors/aws/ecs/ecs_test.go index d547351601e..d0595c56030 100644 --- a/detectors/aws/ecs/ecs_test.go +++ b/detectors/aws/ecs/ecs_test.go @@ -54,6 +54,8 @@ func TestDetect(t *testing.T) { detectorUtils.On("getContainerID").Return("0123456789A", nil) attributes := []attribute.KeyValue{ + semconv.CloudProviderAWS, + semconv.CloudPlatformAWSECS, semconv.ContainerNameKey.String("container-Name"), semconv.ContainerIDKey.String("0123456789A"), } diff --git a/detectors/aws/eks/detector.go b/detectors/aws/eks/detector.go index aed1dfae2b1..873f2d92900 100644 --- a/detectors/aws/eks/detector.go +++ b/detectors/aws/eks/detector.go @@ -89,7 +89,10 @@ func (detector *resourceDetector) Detect(ctx context.Context) (*resource.Resourc } // Create variable to hold resource attributes - attributes := []attribute.KeyValue{} + attributes := []attribute.KeyValue{ + semconv.CloudProviderAWS, + semconv.CloudPlatformAWSEKS, + } // Get clusterName and append to attributes clusterName, err := getClusterName(ctx, detector.utils) diff --git a/detectors/aws/eks/detector_test.go b/detectors/aws/eks/detector_test.go index 621c1568442..33e4781d314 100644 --- a/detectors/aws/eks/detector_test.go +++ b/detectors/aws/eks/detector_test.go @@ -62,6 +62,8 @@ func TestEks(t *testing.T) { // Expected resource object eksResourceLabels := []attribute.KeyValue{ + semconv.CloudProviderAWS, + semconv.CloudPlatformAWSEKS, semconv.K8SClusterNameKey.String("my-cluster"), semconv.ContainerIDKey.String("0123456789A"), }