Skip to content

[8.18](backport #45408) [AWS Health] Improve error message reporting #45480

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

Open
wants to merge 1 commit into
base: 8.18
Choose a base branch
from
Open
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
6 changes: 6 additions & 0 deletions CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ https://github.com/elastic/beats/compare/v8.8.1\...main[Check the HEAD diff]
- Setting period for counter cache for Prometheus remote_write at least to 60sec {pull}38553[38553]
- Remove fallback to the node limit for the `kubernetes.pod.cpu.usage.limit.pct` and `kubernetes.pod.memory.usage.limit.pct` metrics calculation
- Handle permission errors while collecting data from Windows services and don't interrupt the overall collection by skipping affected services {issue}40765[40765] {pull}43665[43665]
- Fixed a bug where `event.duration` could be missing from an event on Windows systems due to low-resolution clock. {pull}44440[44440]
- Add check for http error codes in the Metricbeat's Prometheus query submodule {pull}44493[44493]
- Sanitize error messages in Fetch method of SQL module {pull}44577[44577]
- Add NTP metricset to system module. {pull}44884[44884]
- Add VPN metrics to meraki module {pull}44851[44851]
- Improve error messages in AWS Health {pull}45408[45408]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only this line is correct. All rest should be removed


*Osquerybeat*

Expand Down
34 changes: 32 additions & 2 deletions x-pack/metricbeat/module/aws/awshealth/awshealth.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,18 @@

import (
"context"
<<<<<<< HEAD

Check failure on line 9 in x-pack/metricbeat/module/aws/awshealth/awshealth.go

View workflow job for this annotation

GitHub Actions / lint (ubuntu-latest)

missing import path (typecheck)
=======

Check failure on line 10 in x-pack/metricbeat/module/aws/awshealth/awshealth.go

View workflow job for this annotation

GitHub Actions / lint (ubuntu-latest)

missing import path (typecheck)
"crypto/fips140"
"errors"
>>>>>>> 1637c556c ([AWS Health] Improve error message reporting (#45408))

Check failure on line 13 in x-pack/metricbeat/module/aws/awshealth/awshealth.go

View workflow job for this annotation

GitHub Actions / lint (ubuntu-latest)

missing import path (typecheck)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also this needs fixing

"fmt"
"time"

awssdk "github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/service/health"
"github.com/aws/aws-sdk-go-v2/service/health/types"
"github.com/aws/smithy-go"

"github.com/elastic/beats/v7/libbeat/common/cfgwarn"
"github.com/elastic/beats/v7/metricbeat/mb"
Expand Down Expand Up @@ -117,13 +123,25 @@
return err
}

<<<<<<< HEAD

Check failure on line 126 in x-pack/metricbeat/module/aws/awshealth/awshealth.go

View workflow job for this annotation

GitHub Actions / lint (ubuntu-latest)

expected statement, found '<<' (typecheck)
awsConfig := m.MetricSet.AwsConfig.Copy()
=======
// Starting from Go 1.24, when FIPS 140-3 mode is active, fips140.Enabled() will return true.
// So, regardless of whether `fips_enabled` is set to true or false, when FIPS 140-3 mode is active, the
// resolver will resolve to the FIPS endpoint.
// See: https://go.dev/doc/security/fips140#fips-140-3-mode
if fips140.Enabled() {
config.AWSConfig.FIPSEnabled = true
}

awsConfig := m.AwsConfig.Copy()
>>>>>>> 1637c556c ([AWS Health] Improve error message reporting (#45408))

Check failure on line 138 in x-pack/metricbeat/module/aws/awshealth/awshealth.go

View workflow job for this annotation

GitHub Actions / lint (ubuntu-latest)

expected statement, found '>>' (typecheck)

health_client := health.NewFromConfig(awsConfig, func(o *health.Options) {
if config.AWSConfig.FIPSEnabled {
o.EndpointOptions.UseFIPSEndpoint = awssdk.FIPSEndpointStateEnabled
}
})

Check failure on line 144 in x-pack/metricbeat/module/aws/awshealth/awshealth.go

View workflow job for this annotation

GitHub Actions / lint (ubuntu-latest)

expected declaration, found ')' (typecheck)
events := m.getEventDetails(ctx, health_client)
for _, event := range events {
report.Event(event)
Expand Down Expand Up @@ -155,7 +173,7 @@
)

// Create an instance of DescribeEventsInput with desired parameters
deInputParams := health.DescribeEventsInput{

Check failure on line 176 in x-pack/metricbeat/module/aws/awshealth/awshealth.go

View workflow job for this annotation

GitHub Actions / lint (ubuntu-latest)

expected declaration, found deInputParams (typecheck)
Filter: &eventFilter,
}

Expand Down Expand Up @@ -191,7 +209,13 @@
// Perform actions for the current page
currentPage, err := dePage.NextPage(ctx)
if err != nil {
m.Logger().Errorf("[AWS Health] DescribeEvents failed with : %w", err)
var opErr *smithy.OperationError
if errors.As(err, &opErr) {
m.Logger().Errorf("[AWS Health] DescribeEvents failed with: Operation=%s, UnderlyingError=%v",
opErr.Operation(), opErr.Err)
} else {
m.Logger().Errorf("[AWS Health] DescribeEvents failed with: %w", err)
}
break
}
deEvents = currentPage.Events
Expand All @@ -218,7 +242,13 @@
Locale: &locale,
})
if err != nil {
m.Logger().Errorf("[AWS Health] DescribeEventDetails failed with : %w", err)
var opErr *smithy.OperationError
if errors.As(err, &opErr) {
m.Logger().Errorf("[AWS Health] DescribeEventDetails failed with: Operation=%s, UnderlyingError=%v",
opErr.Operation(), opErr.Err)
} else {
m.Logger().Errorf("[AWS Health] DescribeEventDetails failed with: %w", err)
}
break
}
// Fetch event description for the current page of events
Expand Down
Loading