Skip to content

Commit

Permalink
Set Cloud Account ID default to false
Browse files Browse the repository at this point in the history
  • Loading branch information
tilakchowdary committed Jan 15, 2025
1 parent ba66b9c commit a31133b
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ func (d *detector) Detect(ctx context.Context) (resource pcommon.Resource, schem
d.rb.SetCloudProvider(conventions.AttributeCloudProviderAWS)
d.rb.SetCloudPlatform(conventions.AttributeCloudPlatformAWSEKS)
if d.ra.CloudAccountID.Enabled {
accountId := d.utils.getCloudAccountID(ctx, d.logger)
d.rb.SetCloudAccountID(accountId)
accountID := d.utils.getCloudAccountID(ctx, d.logger)
d.rb.SetCloudAccountID(accountID)
}

if d.ra.K8sClusterName.Enabled {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (

const (
clusterName = "my-cluster"
cloudAccountId = "cloud1234"
cloudAccountID = "cloud1234"
)

type MockDetectorUtils struct {
Expand All @@ -42,7 +42,7 @@ func (detectorUtils *MockDetectorUtils) getClusterNameTagFromReservations(_ []*e
}

func (detectorUtils *MockDetectorUtils) getCloudAccountID(_ context.Context, _ *zap.Logger) string {
return cloudAccountId
return cloudAccountID
}

func TestNewDetector(t *testing.T) {
Expand All @@ -65,9 +65,8 @@ func TestEKS(t *testing.T) {
require.NoError(t, err)

assert.Equal(t, map[string]any{
"cloud.provider": "aws",
"cloud.platform": "aws_eks",
"cloud.account.id": "cloud1234",
"cloud.provider": "aws",
"cloud.platform": "aws_eks",
}, res.Attributes().AsRaw(), "Resource object returned is incorrect")
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

| Name | Description | Values | Enabled |
| ---- | ----------- | ------ | ------- |
| cloud.account.id | The cloud account id | Any Str | true |
| cloud.account.id | The cloud account id | Any Str | false |
| cloud.platform | The cloud.platform | Any Str | true |
| cloud.provider | The cloud.provider | Any Str | true |
| k8s.cluster.name | The EKS cluster name. This attribute is currently only available when running on EC2 instances, and requires permission to run the EC2:DescribeInstances action. | Any Str | false |

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ resource_attributes:
cloud.account.id:
description: The cloud account id
type: string
enabled: true
enabled: false
k8s.cluster.name:
description: The EKS cluster name. This attribute is currently only available when running on EC2 instances, and requires permission to run the EC2:DescribeInstances action.
type: string
Expand Down

0 comments on commit a31133b

Please sign in to comment.