Skip to content

Commit

Permalink
Normalize AWS RDS CPU Utilization values before metadata API call (#3…
Browse files Browse the repository at this point in the history
…9664)

* handle cpu normalization before the API call

* add changelog entry

* fix changelog pr id
  • Loading branch information
gpop63 authored May 24, 2024
1 parent d5bfebb commit 2d687ac
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ https://github.com/elastic/beats/compare/v8.8.1\...main[Check the HEAD diff]
- Fix timeout caused by the retrival of which indices are hidden {pull}39165[39165]
- Fix Azure Monitor support for multiple aggregation types {issue}39192[39192] {pull}39204[39204]
- Fix for MySQL/Performance - Query failure for MySQL versions below v8.0.1, for performance metric `quantile_95`. {pull}38710[38710]
- Normalize AWS RDS CPU Utilization values before making the metadata API call. {pull}39664[39664]

*Osquerybeat*

Expand Down
15 changes: 9 additions & 6 deletions x-pack/metricbeat/module/aws/cloudwatch/metadata/rds/rds.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,9 @@ func AddMetadata(regionName string, awsConfig awssdk.Config, fips_enabled bool,
}
})

// Get DBInstance IDs per region
dbDetailsMap, err := getDBInstancesPerRegion(svc)
if err != nil {
return events, fmt.Errorf("aws.rds.db_instance fields are not available, skipping region %s: %w", regionName, err)
}

// Normalize CPU Utilization values before making the API call,
// because the API call can fail, and we need to ensure the
// CPU values are correctly scaled regardless of the API call outcome.
for _, event := range events {
cpuValue, err := event.RootFields.GetValue("aws.rds.metrics.CPUUtilization.avg")
if err == nil {
Expand All @@ -42,6 +39,12 @@ func AddMetadata(regionName string, awsConfig awssdk.Config, fips_enabled bool,
}
}

// Get DBInstance IDs per region
dbDetailsMap, err := getDBInstancesPerRegion(svc)
if err != nil {
return events, fmt.Errorf("aws.rds.db_instance fields are not available, skipping region %s: %w", regionName, err)
}

for dbInstanceIdentifier, output := range dbDetailsMap {
for eventIdentifier := range events {
eventIdentifierComponents := strings.Split(eventIdentifier, "-")
Expand Down

0 comments on commit 2d687ac

Please sign in to comment.