diff --git a/processor/resourcedetectionprocessor/internal/gcp/documentation.md b/processor/resourcedetectionprocessor/internal/gcp/documentation.md index 0e1c1d056155..8e1a3a45d4f4 100644 --- a/processor/resourcedetectionprocessor/internal/gcp/documentation.md +++ b/processor/resourcedetectionprocessor/internal/gcp/documentation.md @@ -19,11 +19,11 @@ | faas.version | The faas.version | Any Str | true | | gcp.cloud_run.job.execution | The Job execution name | Any Str | true | | gcp.cloud_run.job.task_index | The Job execution task index | Any Str | true | -| gcp.gce.instance.group.manager.name | The name of an instanceGroupManager. | Any Str | true | -| gcp.gce.instance.group.manager.region | The region of a regional instanceGroupManager. | Any Str | true | -| gcp.gce.instance.group.manager.zone | The zone of a zonal instanceGroupManager. | Any Str | true | | gcp.gce.instance.hostname | The hostname of the GCE instance. | Any Str | false | | gcp.gce.instance.name | The name of the GCE instance. | Any Str | false | +| gcp.gce.instance_group_manager.name | The name of an instanceGroupManager. | Any Str | true | +| gcp.gce.instance_group_manager.region | The region of a regional instanceGroupManager. | Any Str | true | +| gcp.gce.instance_group_manager.zone | The zone of a zonal instanceGroupManager. | Any Str | true | | host.id | The host.id | Any Str | true | | host.name | The host.name | Any Str | true | | host.type | The host.type | Any Str | true | diff --git a/processor/resourcedetectionprocessor/internal/gcp/gcp_test.go b/processor/resourcedetectionprocessor/internal/gcp/gcp_test.go index 85ab66560812..6efec31368f3 100644 --- a/processor/resourcedetectionprocessor/internal/gcp/gcp_test.go +++ b/processor/resourcedetectionprocessor/internal/gcp/gcp_test.go @@ -168,8 +168,8 @@ func TestDetect(t *testing.T) { conventions.AttributeHostType: "n1-standard1", conventions.AttributeCloudRegion: "us-central1", conventions.AttributeCloudAvailabilityZone: "us-central1-c", - "gcp.gce.instance.group.manager.name": "my-gke-node", - "gcp.gce.instance.group.manager.region": "us-central1", + "gcp.gce.instance_group_manager.name": "my-gke-node", + "gcp.gce.instance_group_manager.region": "us-central1", }, }, { diff --git a/processor/resourcedetectionprocessor/internal/gcp/internal/metadata/generated_config.go b/processor/resourcedetectionprocessor/internal/gcp/internal/metadata/generated_config.go index 7b7b495b87e3..702430bd2245 100644 --- a/processor/resourcedetectionprocessor/internal/gcp/internal/metadata/generated_config.go +++ b/processor/resourcedetectionprocessor/internal/gcp/internal/metadata/generated_config.go @@ -38,11 +38,11 @@ type ResourceAttributesConfig struct { FaasVersion ResourceAttributeConfig `mapstructure:"faas.version"` GcpCloudRunJobExecution ResourceAttributeConfig `mapstructure:"gcp.cloud_run.job.execution"` GcpCloudRunJobTaskIndex ResourceAttributeConfig `mapstructure:"gcp.cloud_run.job.task_index"` - GcpGceInstanceGroupManagerName ResourceAttributeConfig `mapstructure:"gcp.gce.instance.group.manager.name"` - GcpGceInstanceGroupManagerRegion ResourceAttributeConfig `mapstructure:"gcp.gce.instance.group.manager.region"` - GcpGceInstanceGroupManagerZone ResourceAttributeConfig `mapstructure:"gcp.gce.instance.group.manager.zone"` GcpGceInstanceHostname ResourceAttributeConfig `mapstructure:"gcp.gce.instance.hostname"` GcpGceInstanceName ResourceAttributeConfig `mapstructure:"gcp.gce.instance.name"` + GcpGceInstanceGroupManagerName ResourceAttributeConfig `mapstructure:"gcp.gce.instance_group_manager.name"` + GcpGceInstanceGroupManagerRegion ResourceAttributeConfig `mapstructure:"gcp.gce.instance_group_manager.region"` + GcpGceInstanceGroupManagerZone ResourceAttributeConfig `mapstructure:"gcp.gce.instance_group_manager.zone"` HostID ResourceAttributeConfig `mapstructure:"host.id"` HostName ResourceAttributeConfig `mapstructure:"host.name"` HostType ResourceAttributeConfig `mapstructure:"host.type"` @@ -84,6 +84,12 @@ func DefaultResourceAttributesConfig() ResourceAttributesConfig { GcpCloudRunJobTaskIndex: ResourceAttributeConfig{ Enabled: true, }, + GcpGceInstanceHostname: ResourceAttributeConfig{ + Enabled: false, + }, + GcpGceInstanceName: ResourceAttributeConfig{ + Enabled: false, + }, GcpGceInstanceGroupManagerName: ResourceAttributeConfig{ Enabled: true, }, @@ -93,12 +99,6 @@ func DefaultResourceAttributesConfig() ResourceAttributesConfig { GcpGceInstanceGroupManagerZone: ResourceAttributeConfig{ Enabled: true, }, - GcpGceInstanceHostname: ResourceAttributeConfig{ - Enabled: false, - }, - GcpGceInstanceName: ResourceAttributeConfig{ - Enabled: false, - }, HostID: ResourceAttributeConfig{ Enabled: true, }, diff --git a/processor/resourcedetectionprocessor/internal/gcp/internal/metadata/generated_config_test.go b/processor/resourcedetectionprocessor/internal/gcp/internal/metadata/generated_config_test.go index 61dc0020dd90..fa49017971fe 100644 --- a/processor/resourcedetectionprocessor/internal/gcp/internal/metadata/generated_config_test.go +++ b/processor/resourcedetectionprocessor/internal/gcp/internal/metadata/generated_config_test.go @@ -35,11 +35,11 @@ func TestResourceAttributesConfig(t *testing.T) { FaasVersion: ResourceAttributeConfig{Enabled: true}, GcpCloudRunJobExecution: ResourceAttributeConfig{Enabled: true}, GcpCloudRunJobTaskIndex: ResourceAttributeConfig{Enabled: true}, + GcpGceInstanceHostname: ResourceAttributeConfig{Enabled: true}, + GcpGceInstanceName: ResourceAttributeConfig{Enabled: true}, GcpGceInstanceGroupManagerName: ResourceAttributeConfig{Enabled: true}, GcpGceInstanceGroupManagerRegion: ResourceAttributeConfig{Enabled: true}, GcpGceInstanceGroupManagerZone: ResourceAttributeConfig{Enabled: true}, - GcpGceInstanceHostname: ResourceAttributeConfig{Enabled: true}, - GcpGceInstanceName: ResourceAttributeConfig{Enabled: true}, HostID: ResourceAttributeConfig{Enabled: true}, HostName: ResourceAttributeConfig{Enabled: true}, HostType: ResourceAttributeConfig{Enabled: true}, @@ -60,11 +60,11 @@ func TestResourceAttributesConfig(t *testing.T) { FaasVersion: ResourceAttributeConfig{Enabled: false}, GcpCloudRunJobExecution: ResourceAttributeConfig{Enabled: false}, GcpCloudRunJobTaskIndex: ResourceAttributeConfig{Enabled: false}, + GcpGceInstanceHostname: ResourceAttributeConfig{Enabled: false}, + GcpGceInstanceName: ResourceAttributeConfig{Enabled: false}, GcpGceInstanceGroupManagerName: ResourceAttributeConfig{Enabled: false}, GcpGceInstanceGroupManagerRegion: ResourceAttributeConfig{Enabled: false}, GcpGceInstanceGroupManagerZone: ResourceAttributeConfig{Enabled: false}, - GcpGceInstanceHostname: ResourceAttributeConfig{Enabled: false}, - GcpGceInstanceName: ResourceAttributeConfig{Enabled: false}, HostID: ResourceAttributeConfig{Enabled: false}, HostName: ResourceAttributeConfig{Enabled: false}, HostType: ResourceAttributeConfig{Enabled: false}, diff --git a/processor/resourcedetectionprocessor/internal/gcp/internal/metadata/generated_resource.go b/processor/resourcedetectionprocessor/internal/gcp/internal/metadata/generated_resource.go index 82d3073d77c3..2180474867bf 100644 --- a/processor/resourcedetectionprocessor/internal/gcp/internal/metadata/generated_resource.go +++ b/processor/resourcedetectionprocessor/internal/gcp/internal/metadata/generated_resource.go @@ -98,38 +98,38 @@ func (rb *ResourceBuilder) SetGcpCloudRunJobTaskIndex(val string) { } } -// SetGcpGceInstanceGroupManagerName sets provided value as "gcp.gce.instance.group.manager.name" attribute. -func (rb *ResourceBuilder) SetGcpGceInstanceGroupManagerName(val string) { - if rb.config.GcpGceInstanceGroupManagerName.Enabled { - rb.res.Attributes().PutStr("gcp.gce.instance.group.manager.name", val) +// SetGcpGceInstanceHostname sets provided value as "gcp.gce.instance.hostname" attribute. +func (rb *ResourceBuilder) SetGcpGceInstanceHostname(val string) { + if rb.config.GcpGceInstanceHostname.Enabled { + rb.res.Attributes().PutStr("gcp.gce.instance.hostname", val) } } -// SetGcpGceInstanceGroupManagerRegion sets provided value as "gcp.gce.instance.group.manager.region" attribute. -func (rb *ResourceBuilder) SetGcpGceInstanceGroupManagerRegion(val string) { - if rb.config.GcpGceInstanceGroupManagerRegion.Enabled { - rb.res.Attributes().PutStr("gcp.gce.instance.group.manager.region", val) +// SetGcpGceInstanceName sets provided value as "gcp.gce.instance.name" attribute. +func (rb *ResourceBuilder) SetGcpGceInstanceName(val string) { + if rb.config.GcpGceInstanceName.Enabled { + rb.res.Attributes().PutStr("gcp.gce.instance.name", val) } } -// SetGcpGceInstanceGroupManagerZone sets provided value as "gcp.gce.instance.group.manager.zone" attribute. -func (rb *ResourceBuilder) SetGcpGceInstanceGroupManagerZone(val string) { - if rb.config.GcpGceInstanceGroupManagerZone.Enabled { - rb.res.Attributes().PutStr("gcp.gce.instance.group.manager.zone", val) +// SetGcpGceInstanceGroupManagerName sets provided value as "gcp.gce.instance_group_manager.name" attribute. +func (rb *ResourceBuilder) SetGcpGceInstanceGroupManagerName(val string) { + if rb.config.GcpGceInstanceGroupManagerName.Enabled { + rb.res.Attributes().PutStr("gcp.gce.instance_group_manager.name", val) } } -// SetGcpGceInstanceHostname sets provided value as "gcp.gce.instance.hostname" attribute. -func (rb *ResourceBuilder) SetGcpGceInstanceHostname(val string) { - if rb.config.GcpGceInstanceHostname.Enabled { - rb.res.Attributes().PutStr("gcp.gce.instance.hostname", val) +// SetGcpGceInstanceGroupManagerRegion sets provided value as "gcp.gce.instance_group_manager.region" attribute. +func (rb *ResourceBuilder) SetGcpGceInstanceGroupManagerRegion(val string) { + if rb.config.GcpGceInstanceGroupManagerRegion.Enabled { + rb.res.Attributes().PutStr("gcp.gce.instance_group_manager.region", val) } } -// SetGcpGceInstanceName sets provided value as "gcp.gce.instance.name" attribute. -func (rb *ResourceBuilder) SetGcpGceInstanceName(val string) { - if rb.config.GcpGceInstanceName.Enabled { - rb.res.Attributes().PutStr("gcp.gce.instance.name", val) +// SetGcpGceInstanceGroupManagerZone sets provided value as "gcp.gce.instance_group_manager.zone" attribute. +func (rb *ResourceBuilder) SetGcpGceInstanceGroupManagerZone(val string) { + if rb.config.GcpGceInstanceGroupManagerZone.Enabled { + rb.res.Attributes().PutStr("gcp.gce.instance_group_manager.zone", val) } } diff --git a/processor/resourcedetectionprocessor/internal/gcp/internal/metadata/generated_resource_test.go b/processor/resourcedetectionprocessor/internal/gcp/internal/metadata/generated_resource_test.go index e69645cae40b..5991c52b62ce 100644 --- a/processor/resourcedetectionprocessor/internal/gcp/internal/metadata/generated_resource_test.go +++ b/processor/resourcedetectionprocessor/internal/gcp/internal/metadata/generated_resource_test.go @@ -24,11 +24,11 @@ func TestResourceBuilder(t *testing.T) { rb.SetFaasVersion("faas.version-val") rb.SetGcpCloudRunJobExecution("gcp.cloud_run.job.execution-val") rb.SetGcpCloudRunJobTaskIndex("gcp.cloud_run.job.task_index-val") - rb.SetGcpGceInstanceGroupManagerName("gcp.gce.instance.group.manager.name-val") - rb.SetGcpGceInstanceGroupManagerRegion("gcp.gce.instance.group.manager.region-val") - rb.SetGcpGceInstanceGroupManagerZone("gcp.gce.instance.group.manager.zone-val") rb.SetGcpGceInstanceHostname("gcp.gce.instance.hostname-val") rb.SetGcpGceInstanceName("gcp.gce.instance.name-val") + rb.SetGcpGceInstanceGroupManagerName("gcp.gce.instance_group_manager.name-val") + rb.SetGcpGceInstanceGroupManagerRegion("gcp.gce.instance_group_manager.region-val") + rb.SetGcpGceInstanceGroupManagerZone("gcp.gce.instance_group_manager.zone-val") rb.SetHostID("host.id-val") rb.SetHostName("host.name-val") rb.SetHostType("host.type-val") @@ -104,30 +104,30 @@ func TestResourceBuilder(t *testing.T) { if ok { assert.EqualValues(t, "gcp.cloud_run.job.task_index-val", val.Str()) } - val, ok = res.Attributes().Get("gcp.gce.instance.group.manager.name") - assert.True(t, ok) + val, ok = res.Attributes().Get("gcp.gce.instance.hostname") + assert.Equal(t, tt == "all_set", ok) if ok { - assert.EqualValues(t, "gcp.gce.instance.group.manager.name-val", val.Str()) + assert.EqualValues(t, "gcp.gce.instance.hostname-val", val.Str()) } - val, ok = res.Attributes().Get("gcp.gce.instance.group.manager.region") - assert.True(t, ok) + val, ok = res.Attributes().Get("gcp.gce.instance.name") + assert.Equal(t, tt == "all_set", ok) if ok { - assert.EqualValues(t, "gcp.gce.instance.group.manager.region-val", val.Str()) + assert.EqualValues(t, "gcp.gce.instance.name-val", val.Str()) } - val, ok = res.Attributes().Get("gcp.gce.instance.group.manager.zone") + val, ok = res.Attributes().Get("gcp.gce.instance_group_manager.name") assert.True(t, ok) if ok { - assert.EqualValues(t, "gcp.gce.instance.group.manager.zone-val", val.Str()) + assert.EqualValues(t, "gcp.gce.instance_group_manager.name-val", val.Str()) } - val, ok = res.Attributes().Get("gcp.gce.instance.hostname") - assert.Equal(t, tt == "all_set", ok) + val, ok = res.Attributes().Get("gcp.gce.instance_group_manager.region") + assert.True(t, ok) if ok { - assert.EqualValues(t, "gcp.gce.instance.hostname-val", val.Str()) + assert.EqualValues(t, "gcp.gce.instance_group_manager.region-val", val.Str()) } - val, ok = res.Attributes().Get("gcp.gce.instance.name") - assert.Equal(t, tt == "all_set", ok) + val, ok = res.Attributes().Get("gcp.gce.instance_group_manager.zone") + assert.True(t, ok) if ok { - assert.EqualValues(t, "gcp.gce.instance.name-val", val.Str()) + assert.EqualValues(t, "gcp.gce.instance_group_manager.zone-val", val.Str()) } val, ok = res.Attributes().Get("host.id") assert.True(t, ok) diff --git a/processor/resourcedetectionprocessor/internal/gcp/internal/metadata/testdata/config.yaml b/processor/resourcedetectionprocessor/internal/gcp/internal/metadata/testdata/config.yaml index db22079a8c66..859e9bef440b 100644 --- a/processor/resourcedetectionprocessor/internal/gcp/internal/metadata/testdata/config.yaml +++ b/processor/resourcedetectionprocessor/internal/gcp/internal/metadata/testdata/config.yaml @@ -23,15 +23,15 @@ all_set: enabled: true gcp.cloud_run.job.task_index: enabled: true - gcp.gce.instance.group.manager.name: + gcp.gce.instance.hostname: enabled: true - gcp.gce.instance.group.manager.region: + gcp.gce.instance.name: enabled: true - gcp.gce.instance.group.manager.zone: + gcp.gce.instance_group_manager.name: enabled: true - gcp.gce.instance.hostname: + gcp.gce.instance_group_manager.region: enabled: true - gcp.gce.instance.name: + gcp.gce.instance_group_manager.zone: enabled: true host.id: enabled: true @@ -65,15 +65,15 @@ none_set: enabled: false gcp.cloud_run.job.task_index: enabled: false - gcp.gce.instance.group.manager.name: + gcp.gce.instance.hostname: enabled: false - gcp.gce.instance.group.manager.region: + gcp.gce.instance.name: enabled: false - gcp.gce.instance.group.manager.zone: + gcp.gce.instance_group_manager.name: enabled: false - gcp.gce.instance.hostname: + gcp.gce.instance_group_manager.region: enabled: false - gcp.gce.instance.name: + gcp.gce.instance_group_manager.zone: enabled: false host.id: enabled: false diff --git a/processor/resourcedetectionprocessor/internal/gcp/metadata.yaml b/processor/resourcedetectionprocessor/internal/gcp/metadata.yaml index b10fbae9a5b9..3026c6359447 100644 --- a/processor/resourcedetectionprocessor/internal/gcp/metadata.yaml +++ b/processor/resourcedetectionprocessor/internal/gcp/metadata.yaml @@ -71,15 +71,15 @@ resource_attributes: description: The hostname of the GCE instance. type: string enabled: false - gcp.gce.instance.group.manager.name: + gcp.gce.instance_group_manager.name: description: The name of an instanceGroupManager. type: string enabled: true - gcp.gce.instance.group.manager.zone: + gcp.gce.instance_group_manager.zone: description: The zone of a zonal instanceGroupManager. type: string enabled: true - gcp.gce.instance.group.manager.region: + gcp.gce.instance_group_manager.region: description: The region of a regional instanceGroupManager. type: string enabled: true