1
0
mirror of https://github.com/prometheus-community/postgres_exporter.git synced 2025-08-09 15:42:47 +03:00

Replace another custom implementation of slices.Contains (#1180)

Followup of https://github.com/prometheus-community/postgres_exporter/pull/1176

Signed-off-by: Cristian Greco <cristian@regolo.cc>
This commit is contained in:
Cristian Greco
2025-07-16 18:51:53 +02:00
committed by GitHub
parent cac5d5220d
commit aa98bb30ef
2 changed files with 3 additions and 11 deletions

View File

@@ -18,6 +18,7 @@ import (
"net/url"
"os"
"regexp"
"slices"
"strings"
"github.com/prometheus/client_golang/prometheus"
@@ -64,11 +65,11 @@ func (e *Exporter) discoverDatabaseDSNs() []string {
continue
}
for _, databaseName := range databaseNames {
if contains(e.excludeDatabases, databaseName) {
if slices.Contains(e.excludeDatabases, databaseName) {
continue
}
if len(e.includeDatabases) != 0 && !contains(e.includeDatabases, databaseName) {
if len(e.includeDatabases) != 0 && !slices.Contains(e.includeDatabases, databaseName) {
continue
}

View File

@@ -24,15 +24,6 @@ import (
"github.com/lib/pq"
)
func contains(a []string, x string) bool {
for _, n := range a {
if x == n {
return true
}
}
return false
}
// convert a string to the corresponding ColumnUsage
func stringToColumnUsage(s string) (ColumnUsage, error) {
var u ColumnUsage