Skip to content

[8.17](backport #45408) [AWS Health] Improve error message reporting #45479

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.17
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
18 changes: 18 additions & 0 deletions CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,24 @@ https://github.com/elastic/beats/compare/v8.8.1\...main[Check the HEAD diff]
- Add support for `_nodes/stats` URIs that work with legacy versions of Elasticsearch {pull}44307[44307]
- 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
- Add support for Kibana status metricset in v8 format {pull}40275[40275]
Copy link
Contributor

Choose a reason for hiding this comment

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

This is not correct should be manually updated

- Mark system process metricsets as running if metrics are partially available {pull}40565[40565]
- Added back `elasticsearch.node.stats.jvm.mem.pools.*` to the `node_stats` metricset {pull}40571[40571]
- Add GCP organization and project details to ECS cloud fields. {pull}40461[40461]
- Add support for specifying a custom endpoint for GCP service clients. {issue}40848[40848] {pull}40918[40918]
- Fix incorrect handling of types in SQL module. {issue}40090[40090] {pull}41607[41607]
- Remove kibana.settings metricset since the API was removed in 8.0 {issue}30592[30592] {pull}42937[42937]
- Removed support for the Enterprise Search module {pull}42915[42915]
- Update NATS module compatibility. Oldest version supported is now 2.2.6 {pull}43310[43310]
- Fix the function to determine CPU cores on windows {issue}42593[42593] {pull}43409[43409]
- Updated list of supported vSphere versions in the documentation. {pull}43642[43642]
- 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]

*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.

Please fix merging steps

"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