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

fix: set sensible defaults #16

Merged
merged 1 commit into from
Feb 7, 2025
Merged
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
4 changes: 2 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ jobs:
uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Build
run: make crossbuild
- name: Set version
run: echo "${{ needs.calculate-tag.outputs.tag }}" | sed s/v//g > VERSION
- name: Build
run: make crossbuild
- name: Package
run: make crossbuild-tarballs
- name: Archive artifacts
Expand Down
1 change: 0 additions & 1 deletion VERSION

This file was deleted.

4 changes: 2 additions & 2 deletions cmd/postgres_exporter/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ var (
excludeDatabases = kingpin.Flag("exclude-databases", "A list of databases to remove when autoDiscoverDatabases is enabled (DEPRECATED)").Default("").Envar("PG_EXPORTER_EXCLUDE_DATABASES").String()
includeDatabases = kingpin.Flag("include-databases", "A list of databases to include when autoDiscoverDatabases is enabled (DEPRECATED)").Default("").Envar("PG_EXPORTER_INCLUDE_DATABASES").String()
metricPrefix = kingpin.Flag("metric-prefix", "A metric prefix can be used to have non-default (not \"pg\") prefixes for each of the metrics").Default("pg").Envar("PG_EXPORTER_METRIC_PREFIX").String()
maxOpenConnections = kingpin.Flag("max-connections", "the maximum number of opened connections").Default("-1").Envar("PG_MAX_CONNECTIONS").Int()
maxIdleConnections = kingpin.Flag("max-idle-connections", "the maximum number of idle connections").Default("-1").Envar("PG_MAX_IDLE_CONNECTIONS").Int()
maxOpenConnections = kingpin.Flag("max-connections", "the maximum number of opened connections").Default("10").Envar("PG_MAX_CONNECTIONS").Int()
maxIdleConnections = kingpin.Flag("max-idle-connections", "the maximum number of idle connections").Default("5").Envar("PG_MAX_IDLE_CONNECTIONS").Int()
collectorTimeout = kingpin.Flag("collector-timeout", "the single collector scrape timeout").Default("10s").Envar("PG_COLLECTOR_TIMEOUT").Duration()
logger = log.NewNopLogger()
)
Expand Down
7 changes: 6 additions & 1 deletion cmd/postgres_exporter/postgres_exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,12 @@ func NewExporter(dsn []string, opts ...ExporterOpt) *Exporter {
}

e.setupInternalMetrics()
e.servers = NewServers(ServerWithLabels(e.constantLabels))
e.servers = NewServers(
ServerWithLabels(e.constantLabels),
ServerWithMaxIdleConnections(*maxIdleConnections),
ServerWithMaxOpenConnections(*maxOpenConnections),
ServerWithScrapeTimeout(e.scrapeTimeout),
)

return e
}
Expand Down
Loading