Skip to content

Commit

Permalink
x-pack/metricbeat/module/gcp: Add omitted labels (elastic#40062)
Browse files Browse the repository at this point in the history
* gcp ommitted label fix

* added comments

* resolved comments

* CHANGELOG.next.asciidoc
  • Loading branch information
Linu-Elias authored Jul 17, 2024
1 parent 1ca6e2f commit 4301c0a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ https://github.com/elastic/beats/compare/v8.8.1\...main[Check the HEAD diff]
- Fix behavior of pagetypeinfo metrics {pull}39985[39985]
- Fix query logic for temp and non-temp tablespaces in Oracle module. {issue}38051[38051] {pull}39787[39787]
- Set GCP metrics config period to the default (60s) when the value is below the minimum allowed period. {issue}30434[30434] {pull}40020[40020]
- Add GCP 'instance_id' resource label in ECS cloud fields. {issue}40033[40033] {pull}40062[40062]
- Fix missing metrics from CloudWatch when include_linked_accounts set to false. {issue}40071[40071] {pull}40135[40135]
- Update beat module with apm-server monitoring metrics fields {pull}40127[40127]

Expand Down
10 changes: 9 additions & 1 deletion x-pack/metricbeat/module/gcp/timeseries_metadata_collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,15 @@ func (s *StackdriverTimeSeriesMetadataCollector) Metadata(ctx context.Context, i
// common.Mapstr seems to not work as expected when deleting keys so I have to iterate over all results to add
// the ones I want
for k, v := range s.timeSeries.Resource.Labels {
if k == TimeSeriesResponsePathForECSAvailabilityZone || k == TimeSeriesResponsePathForECSInstanceID || k == TimeSeriesResponsePathForECSAccountID {

// We are omitting some labels here because they are added separately for services with additional metadata logic.
// However, we explicitly include the instance_id label to ensure it is not missed for services without additional metadata logic.
if k == TimeSeriesResponsePathForECSInstanceID {
_, _ = ecs.Put(ECSCloudInstanceIDKey, v)
continue
}

if k == TimeSeriesResponsePathForECSAvailabilityZone || k == TimeSeriesResponsePathForECSAccountID {
continue
}

Expand Down

0 comments on commit 4301c0a

Please sign in to comment.