You've already forked postgres_exporter
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:
@@ -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
|
||||
}
|
||||
|
||||
|
@@ -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
|
||||
|
Reference in New Issue
Block a user