Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add cloud.provider and cloud.platform to AWS detectors #1043

Merged
merged 3 commits into from
Sep 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions detectors/aws/ec2/ec2.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
2 changes: 2 additions & 0 deletions detectors/aws/ec2/ec2_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down Expand Up @@ -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"),
Expand Down
2 changes: 2 additions & 0 deletions detectors/aws/ecs/ecs.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
}
Expand Down
2 changes: 2 additions & 0 deletions detectors/aws/ecs/ecs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
}
Expand Down
5 changes: 4 additions & 1 deletion detectors/aws/eks/detector.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions detectors/aws/eks/detector_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
}
Expand Down