mirror of
https://github.com/ClusterCockpit/cc-metric-collector.git
synced 2024-12-26 15:29:04 +01:00
Skip non existing processor metrics URLs
This commit is contained in:
parent
0dd430e7e9
commit
a8beec29cc
@ -30,6 +30,8 @@ type RedfishReceiverClientConfig struct {
|
|||||||
doProcessorMetrics bool
|
doProcessorMetrics bool
|
||||||
doThermalMetrics bool
|
doThermalMetrics bool
|
||||||
|
|
||||||
|
skipProcessorMetricsURL map[string]bool
|
||||||
|
|
||||||
gofish gofish.ClientConfig
|
gofish gofish.ClientConfig
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -314,12 +316,23 @@ func (r *RedfishReceiver) readProcessorMetrics(
|
|||||||
|
|
||||||
timestamp := time.Now()
|
timestamp := time.Now()
|
||||||
|
|
||||||
// Golang 1.19: URL, _ := url.JoinPath(processor.ODataID, "ProcessorMetrics")
|
// URL to processor metrics
|
||||||
URL := processor.ODataID + "/ProcessorMetrics"
|
URL := processor.ODataID + "/ProcessorMetrics"
|
||||||
|
|
||||||
|
// Skip previously detected non existing URLs
|
||||||
|
if clientConfig.skipProcessorMetricsURL[URL] {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
resp, err := processor.Client.Get(URL)
|
resp, err := processor.Client.Get(URL)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// Skip non existing URLs
|
// Skip non existing URLs
|
||||||
return nil
|
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)
|
||||||
}
|
}
|
||||||
|
|
||||||
var processorMetrics struct {
|
var processorMetrics struct {
|
||||||
@ -741,6 +754,8 @@ func NewRedfishReceiver(name string, config json.RawMessage) (Receiver, error) {
|
|||||||
!(configJSON.DisableThermalMetrics ||
|
!(configJSON.DisableThermalMetrics ||
|
||||||
clientConfigJSON.DisableThermalMetrics)
|
clientConfigJSON.DisableThermalMetrics)
|
||||||
|
|
||||||
|
clientConfig.skipProcessorMetricsURL = make(map[string]bool)
|
||||||
|
|
||||||
// Is metrics excluded globally or per client
|
// Is metrics excluded globally or per client
|
||||||
clientConfig.isExcluded = make(map[string]bool)
|
clientConfig.isExcluded = make(map[string]bool)
|
||||||
for _, key := range clientConfigJSON.ExcludeMetrics {
|
for _, key := range clientConfigJSON.ExcludeMetrics {
|
||||||
|
Loading…
Reference in New Issue
Block a user