Skip to content
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

chore: slice loop replace #874

Closed
wants to merge 1 commit into from
Closed
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
8 changes: 2 additions & 6 deletions pkg/prometheus-adapter/expression.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,7 @@ func ParsingExternalRules(mc config.MetricsDiscoveryConfig, mapper meta.RESTMapp
// SetExtensionLabels from opts.DataSourcePromConfig.AdapterExtensionLabels
func SetExtensionLabels(extensionLabels string) {
if extensionLabels != "" {
for _, label := range strings.Split(extensionLabels, ",") {
metricRules.ExtensionLabels = append(metricRules.ExtensionLabels, label)
}
metricRules.ExtensionLabels = append(metricRules.ExtensionLabels, strings.Split(extensionLabels, ",")...)
}
}

Expand Down Expand Up @@ -370,9 +368,7 @@ func GetLabelMatchersFromDiscoveryRule(rule config.DiscoveryRule) []string {
if len(regLabelMatchers.FindStringSubmatch(rule.SeriesQuery)) > 1 {
SeriesMatchers := regLabelMatchers.FindStringSubmatch(rule.SeriesQuery)[1]
if SeriesMatchers != "" {
for _, seriesMatcher := range strings.Split(SeriesMatchers, ",") {
labelMatchers = append(labelMatchers, seriesMatcher)
}
labelMatchers = append(labelMatchers, strings.Split(SeriesMatchers, ",")...)
}
}

Expand Down
4 changes: 1 addition & 3 deletions pkg/utils/expression_prom_default.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,7 @@ var extensionLabelsString string

func SetExtensionLabels(extensionLabels string) {
if extensionLabels != "" {
for _, label := range strings.Split(extensionLabels, ",") {
ExtensionLabelArray = append(ExtensionLabelArray, label)
}
ExtensionLabelArray = append(ExtensionLabelArray, strings.Split(extensionLabels, ",")...)

extensionLabelsString = ","
for index, label := range ExtensionLabelArray {
Expand Down
Loading