Skip to content

Commit 1a3f73f

Browse files
committed
Remove unnecessary Consul attributes.
1 parent c314342 commit 1a3f73f

File tree

3 files changed

+13
-67
lines changed

3 files changed

+13
-67
lines changed

component/otelcol/processor/resourcedetection/internal/consul/config.go

+9-30
Original file line numberDiff line numberDiff line change
@@ -45,16 +45,9 @@ type Config struct {
4545
// DefaultArguments holds default settings for Config.
4646
var DefaultArguments = Config{
4747
ResourceAttributes: ResourceAttributesConfig{
48-
AzureResourcegroupName: rac.ResourceAttributeConfig{Enabled: true},
49-
AzureVMName: rac.ResourceAttributeConfig{Enabled: true},
50-
AzureVMScalesetName: rac.ResourceAttributeConfig{Enabled: true},
51-
AzureVMSize: rac.ResourceAttributeConfig{Enabled: true},
52-
CloudAccountID: rac.ResourceAttributeConfig{Enabled: true},
53-
CloudPlatform: rac.ResourceAttributeConfig{Enabled: true},
54-
CloudProvider: rac.ResourceAttributeConfig{Enabled: true},
55-
CloudRegion: rac.ResourceAttributeConfig{Enabled: true},
56-
HostID: rac.ResourceAttributeConfig{Enabled: true},
57-
HostName: rac.ResourceAttributeConfig{Enabled: true},
48+
CloudRegion: rac.ResourceAttributeConfig{Enabled: true},
49+
HostID: rac.ResourceAttributeConfig{Enabled: true},
50+
HostName: rac.ResourceAttributeConfig{Enabled: true},
5851
},
5952
}
6053

@@ -87,29 +80,15 @@ func (args Config) Convert() map[string]interface{} {
8780

8881
// ResourceAttributesConfig provides config for consul resource attributes.
8982
type ResourceAttributesConfig struct {
90-
AzureResourcegroupName rac.ResourceAttributeConfig `river:"azure.resourcegroup.name,block,optional"`
91-
AzureVMName rac.ResourceAttributeConfig `river:"azure.vm.name,block,optional"`
92-
AzureVMScalesetName rac.ResourceAttributeConfig `river:"azure.vm.scaleset.name,block,optional"`
93-
AzureVMSize rac.ResourceAttributeConfig `river:"azure.vm.size,block,optional"`
94-
CloudAccountID rac.ResourceAttributeConfig `river:"cloud.account.id,block,optional"`
95-
CloudPlatform rac.ResourceAttributeConfig `river:"cloud.platform,block,optional"`
96-
CloudProvider rac.ResourceAttributeConfig `river:"cloud.provider,block,optional"`
97-
CloudRegion rac.ResourceAttributeConfig `river:"cloud.region,block,optional"`
98-
HostID rac.ResourceAttributeConfig `river:"host.id,block,optional"`
99-
HostName rac.ResourceAttributeConfig `river:"host.name,block,optional"`
83+
CloudRegion rac.ResourceAttributeConfig `river:"cloud.region,block,optional"`
84+
HostID rac.ResourceAttributeConfig `river:"host.id,block,optional"`
85+
HostName rac.ResourceAttributeConfig `river:"host.name,block,optional"`
10086
}
10187

10288
func (r *ResourceAttributesConfig) Convert() map[string]interface{} {
10389
return map[string]interface{}{
104-
"azure.resourcegroup.name": r.AzureResourcegroupName.Convert(),
105-
"azure.vm.name": r.AzureVMName.Convert(),
106-
"azure.vm.scaleset.name": r.AzureVMScalesetName.Convert(),
107-
"azure.vm.size": r.AzureVMSize.Convert(),
108-
"cloud.account.id": r.CloudAccountID.Convert(),
109-
"cloud.platform": r.CloudPlatform.Convert(),
110-
"cloud.provider": r.CloudProvider.Convert(),
111-
"cloud.region": r.CloudRegion.Convert(),
112-
"host.id": r.HostID.Convert(),
113-
"host.name": r.HostName.Convert(),
90+
"cloud.region": r.CloudRegion.Convert(),
91+
"host.id": r.HostID.Convert(),
92+
"host.name": r.HostName.Convert(),
11493
}
11594
}

component/otelcol/processor/resourcedetection/resourcedetection_test.go

+4-29
Original file line numberDiff line numberDiff line change
@@ -1050,12 +1050,8 @@ func TestArguments_UnmarshalRiver(t *testing.T) {
10501050
namespace = "test_namespace"
10511051
meta = ["test"]
10521052
resource_attributes {
1053-
azure.resourcegroup.name { enabled = true }
1054-
azure.vm.name { enabled = true }
1055-
azure.vm.scaleset.name { enabled = true }
1056-
azure.vm.size { enabled = true }
1057-
cloud.account.id { enabled = false }
1058-
cloud.platform { enabled = false }
1053+
cloud.region { enabled = false }
1054+
host.id { enabled = false }
10591055
}
10601056
}
10611057
output {}
@@ -1071,32 +1067,11 @@ func TestArguments_UnmarshalRiver(t *testing.T) {
10711067
"namespace": "test_namespace",
10721068
"meta": map[string]string{"test": ""},
10731069
"resource_attributes": map[string]interface{}{
1074-
"azure.resourcegroup.name": map[string]interface{}{
1075-
"enabled": true,
1076-
},
1077-
"azure.vm.name": map[string]interface{}{
1078-
"enabled": true,
1079-
},
1080-
"azure.vm.scaleset.name": map[string]interface{}{
1081-
"enabled": true,
1082-
},
1083-
"azure.vm.size": map[string]interface{}{
1084-
"enabled": true,
1085-
},
1086-
"cloud.account.id": map[string]interface{}{
1087-
"enabled": false,
1088-
},
1089-
"cloud.platform": map[string]interface{}{
1090-
"enabled": false,
1091-
},
1092-
"cloud.provider": map[string]interface{}{
1093-
"enabled": true,
1094-
},
10951070
"cloud.region": map[string]interface{}{
1096-
"enabled": true,
1071+
"enabled": false,
10971072
},
10981073
"host.id": map[string]interface{}{
1099-
"enabled": true,
1074+
"enabled": false,
11001075
},
11011076
"host.name": map[string]interface{}{
11021077
"enabled": true,

docs/sources/flow/reference/components/otelcol.processor.resourcedetection.md

-8
Original file line numberDiff line numberDiff line change
@@ -392,16 +392,8 @@ Block | Description
392392

393393
The `resource_attributes` block supports the following blocks:
394394

395-
<!-- TODO: Why are all these azure resource attributes here? -->
396395
Block | Description | Required
397396
--------------------------------------- | --------------------------------------------------------------------------------------------------- | --------
398-
[azure.resourcegroup.name][res-attr-cfg] | Toggles the `azure.resourcegroup.name` resource attribute. <br> Sets `enabled` to `true` by default. | no
399-
[azure.vm.name][res-attr-cfg] | Toggles the `azure.vm.name` resource attribute. <br> Sets `enabled` to `true` by default. | no
400-
[azure.vm.scaleset.name][res-attr-cfg] | Toggles the `azure.vm.scaleset.name` resource attribute. <br> Sets `enabled` to `true` by default. | no
401-
[azure.vm.size][res-attr-cfg] | Toggles the `azure.vm.size` resource attribute. <br> Sets `enabled` to `true` by default. | no
402-
[cloud.account.id][res-attr-cfg] | Toggles the `cloud.account.id` resource attribute. <br> Sets `enabled` to `true` by default. | no
403-
[cloud.platform][res-attr-cfg] | Toggles the `cloud.platform` resource attribute. <br> Sets `enabled` to `true` by default. | no
404-
[cloud.provider][res-attr-cfg] | Toggles the `cloud.provider` resource attribute. <br> Sets `enabled` to `true` by default. | no
405397
[cloud.region][res-attr-cfg] | Toggles the `cloud.region` resource attribute. <br> Sets `enabled` to `true` by default. | no
406398
[host.id][res-attr-cfg] | Toggles the `host.id` resource attribute. <br> Sets `enabled` to `true` by default. | no
407399
[host.name][res-attr-cfg] | Toggles the `host.name` resource attribute. <br> Sets `enabled` to `true` by default. | no

0 commit comments

Comments
 (0)