Skip to content

Commit

Permalink
removing uneeded if checks
Browse files Browse the repository at this point in the history
  • Loading branch information
gizas committed Apr 9, 2024
1 parent aa4dbf3 commit 96897fd
Showing 1 changed file with 14 additions and 18 deletions.
32 changes: 14 additions & 18 deletions utils/hints.go
Original file line number Diff line number Diff line change
Expand Up @@ -256,16 +256,14 @@ func GenerateHints(annotations mapstr.M, container, prefix string, allSupportedH
}
}

if len(enumeratedmodules) > 0 {
// We check if multiple metrcisets are defined and we retrieve the hints per metricset. Only applicable in beats
// See Metrics_multiple_modules_and_specific_config_per_module test case in hints_test.go
for _, metric := range enumeratedmodules {
_, incorrecthint = checkSupportedHints(metric, fmt.Sprintf("%s.%s", key, metric), allSupportedHints)
if incorrecthint != "" {
incorrecthints = append(incorrecthints, incorrecthint)
}

// We check if multiple metrcisets are defined and we retrieve the hints per metricset. Only applicable in beats
// See Metrics_multiple_modules_and_specific_config_per_module test case in hints_test.go
for _, metric := range enumeratedmodules {
_, incorrecthint = checkSupportedHints(metric, fmt.Sprintf("%s.%s", key, metric), allSupportedHints)
if incorrecthint != "" {
incorrecthints = append(incorrecthints, incorrecthint)
}

}
_, incorrecthint = checkSupportedHints(parts[1], key, allSupportedHints)

Expand Down Expand Up @@ -306,16 +304,14 @@ func GenerateHints(annotations mapstr.M, container, prefix string, allSupportedH
}
}

if len(enumeratedmodules) > 0 {
// We check if multiple metrcisets are defined and we retrieve the hints per metricset. Only applicable in beats
// See Metrics_multiple_modules_and_specific_config_per_module test case in hints_test.go
for _, metric := range enumeratedmodules {
_, incorrecthint = checkSupportedHints(metric, fmt.Sprintf("%s.%s", key, metric), allSupportedHints)
if incorrecthint != "" {
incorrecthints = append(incorrecthints, incorrecthint)
}

// We check if multiple metrcisets are defined and we retrieve the hints per metricset. Only applicable in beats
// See Metrics_multiple_modules_and_specific_config_per_module test case in hints_test.go
for _, metric := range enumeratedmodules {
_, incorrecthint = checkSupportedHints(metric, fmt.Sprintf("%s.%s", key, metric), allSupportedHints)
if incorrecthint != "" {
incorrecthints = append(incorrecthints, incorrecthint)
}

}
_, incorrecthint = checkSupportedHints(parts[1], key, allSupportedHints)

Expand Down

0 comments on commit 96897fd

Please sign in to comment.