Skip to content

Commit

Permalink
fix ecs cloud region and AZ bug
Browse files Browse the repository at this point in the history
  • Loading branch information
gpop63 committed Aug 15, 2023
1 parent 89f6ab5 commit 349bf6b
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions x-pack/metricbeat/module/gcp/timeseries_metadata_collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,23 +51,25 @@ func (s *StackdriverTimeSeriesMetadataCollector) Metadata(ctx context.Context, i
accountID = in.Resource.Labels[TimeSeriesResponsePathForECSAccountID]
}

ecs := mapstr.M{
ECSCloud: mapstr.M{
ECSCloudAccount: mapstr.M{
ECSCloudAccountID: accountID,
ECSCloudAccountName: accountID,
},
ECSCloudProvider: "gcp",
ecsCloud := mapstr.M{
ECSCloudAccount: mapstr.M{
ECSCloudAccountID: accountID,
ECSCloudAccountName: accountID,
},
ECSCloudProvider: "gcp",
}

ecs := mapstr.M{
ECSCloud: ecsCloud,
}

if availabilityZone != "" {
ecs[ECSCloud+"."+ECSCloudAvailabilityZone] = availabilityZone
_, _ = ecsCloud.Put(ECSCloudAvailabilityZone, availabilityZone)

// Get region name from availability zone name
region := getRegionName(availabilityZone)
if region != "" {
ecs[ECSCloud+"."+ECSCloudRegion] = region
_, _ = ecsCloud.Put(ECSCloudRegion, region)
}
}

Expand Down

0 comments on commit 349bf6b

Please sign in to comment.