Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Normalize AWS RDS CPU Utilization values before metadata API call #39664

Merged
merged 3 commits into from
May 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,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
Loading