Skip to content

Commit

Permalink
Fix for API changes in [email protected]
Browse files Browse the repository at this point in the history
  • Loading branch information
ho-ob committed Jan 22, 2024
1 parent 9b671ce commit 06ca37e
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions receivers/redfishReceiver.go
Original file line number Diff line number Diff line change
Expand Up @@ -328,15 +328,15 @@ func (r *RedfishReceiver) readProcessorMetrics(
return nil
}

resp, err := processor.Client.Get(URL)
resp, err := processor.GetClient().Get(URL)

Check failure on line 331 in receivers/redfishReceiver.go

View workflow job for this annotation

GitHub Actions / build-1-21

processor.GetClient undefined (type *redfish.Processor has no field or method GetClient)

Check failure on line 331 in receivers/redfishReceiver.go

View workflow job for this annotation

GitHub Actions / build-1-20

processor.GetClient undefined (type *redfish.Processor has no field or method GetClient)
if err != nil {
// Skip non existing URLs
if statusCode := err.(*common.Error).HTTPReturnedStatusCode; statusCode == http.StatusNotFound {
clientConfig.skipProcessorMetricsURL[URL] = true
return nil
}

return fmt.Errorf("processor.Client.Get(%v) failed: %+w", URL, err)
return fmt.Errorf("processor.GetClient().Get(%v) failed: %+w", URL, err)
}

var processorMetrics struct {
Expand All @@ -351,7 +351,7 @@ func (r *RedfishReceiver) readProcessorMetrics(
}
body, err := io.ReadAll(resp.Body)
if err != nil {
return fmt.Errorf("unable to read JSON for processor metrics: %+w", err)
return fmt.Errorf("unable to read response body for processor metrics: %+w", err)
}
err = json.Unmarshal(body, &processorMetrics)
if err != nil {
Expand All @@ -361,7 +361,6 @@ func (r *RedfishReceiver) readProcessorMetrics(
err,
)
}
processorMetrics.SetClient(processor.Client)

// Set tags
tags := map[string]string{
Expand Down Expand Up @@ -724,6 +723,7 @@ func NewRedfishReceiver(name string, config json.RawMessage) (Receiver, error) {

clientConfigJSON := &configJSON.ClientConfigs[i]

// Redfish endpoint
var endpoint_pattern string
if clientConfigJSON.Endpoint != nil {
endpoint_pattern = *clientConfigJSON.Endpoint
Expand All @@ -735,6 +735,7 @@ func NewRedfishReceiver(name string, config json.RawMessage) (Receiver, error) {
return nil, err
}

// Redfish username
var username string
if clientConfigJSON.Username != nil {
username = *clientConfigJSON.Username
Expand All @@ -746,6 +747,7 @@ func NewRedfishReceiver(name string, config json.RawMessage) (Receiver, error) {
return nil, err
}

// Redfish password
var password string
if clientConfigJSON.Password != nil {
password = *clientConfigJSON.Password
Expand Down Expand Up @@ -816,6 +818,7 @@ func NewRedfishReceiver(name string, config json.RawMessage) (Receiver, error) {
r.config.fanout = numClients
}

// Check that at least on client config exists
if numClients == 0 {
err := fmt.Errorf("at least one client config is required")
cclog.ComponentError(r.name, err)
Expand Down

0 comments on commit 06ca37e

Please sign in to comment.