@@ -6,12 +6,18 @@ package awshealth
6
6
7
7
import (
8
8
"context"
9
+ << << << < HEAD
10
+ == == == =
11
+ "crypto/fips140"
12
+ "errors"
13
+ >> >> >> > 1637 c556c ([AWS Health ] Improve error message reporting (#45408 ))
9
14
"fmt"
10
15
"time"
11
16
12
17
awssdk "github.com/aws/aws-sdk-go-v2/aws"
13
18
"github.com/aws/aws-sdk-go-v2/service/health"
14
19
"github.com/aws/aws-sdk-go-v2/service/health/types"
20
+ "github.com/aws/smithy-go"
15
21
16
22
"github.com/elastic/beats/v7/libbeat/common/cfgwarn"
17
23
"github.com/elastic/beats/v7/metricbeat/mb"
@@ -117,7 +123,19 @@ func (m *MetricSet) Fetch(ctx context.Context, report mb.ReporterV2) error {
117
123
return err
118
124
}
119
125
126
+ << << << < HEAD
120
127
awsConfig := m .MetricSet .AwsConfig .Copy ()
128
+ == == == =
129
+ // Starting from Go 1.24, when FIPS 140-3 mode is active, fips140.Enabled() will return true.
130
+ // So, regardless of whether `fips_enabled` is set to true or false, when FIPS 140-3 mode is active, the
131
+ // resolver will resolve to the FIPS endpoint.
132
+ // See: https://go.dev/doc/security/fips140#fips-140-3-mode
133
+ if fips140 .Enabled () {
134
+ config .AWSConfig .FIPSEnabled = true
135
+ }
136
+
137
+ awsConfig := m .AwsConfig .Copy ()
138
+ >> >> >> > 1637 c556c ([AWS Health ] Improve error message reporting (#45408 ))
121
139
122
140
health_client := health .NewFromConfig (awsConfig , func (o * health.Options ) {
123
141
if config .AWSConfig .FIPSEnabled {
@@ -191,7 +209,13 @@ func (m *MetricSet) getEventDetails(
191
209
// Perform actions for the current page
192
210
currentPage , err := dePage .NextPage (ctx )
193
211
if err != nil {
194
- m .Logger ().Errorf ("[AWS Health] DescribeEvents failed with : %w" , err )
212
+ var opErr * smithy.OperationError
213
+ if errors .As (err , & opErr ) {
214
+ m .Logger ().Errorf ("[AWS Health] DescribeEvents failed with: Operation=%s, UnderlyingError=%v" ,
215
+ opErr .Operation (), opErr .Err )
216
+ } else {
217
+ m .Logger ().Errorf ("[AWS Health] DescribeEvents failed with: %w" , err )
218
+ }
195
219
break
196
220
}
197
221
deEvents = currentPage .Events
@@ -218,7 +242,13 @@ func (m *MetricSet) getEventDetails(
218
242
Locale : & locale ,
219
243
})
220
244
if err != nil {
221
- m .Logger ().Errorf ("[AWS Health] DescribeEventDetails failed with : %w" , err )
245
+ var opErr * smithy.OperationError
246
+ if errors .As (err , & opErr ) {
247
+ m .Logger ().Errorf ("[AWS Health] DescribeEventDetails failed with: Operation=%s, UnderlyingError=%v" ,
248
+ opErr .Operation (), opErr .Err )
249
+ } else {
250
+ m .Logger ().Errorf ("[AWS Health] DescribeEventDetails failed with: %w" , err )
251
+ }
222
252
break
223
253
}
224
254
// Fetch event description for the current page of events
0 commit comments