Skip to content

Commit 7dc5c37

Browse files
Merge pull request #16 from form3tech-oss/fix-core-timeouts
fix: set sensible defaults
2 parents 345f51f + af12c28 commit 7dc5c37

File tree

4 files changed

+10
-6
lines changed

4 files changed

+10
-6
lines changed

.github/workflows/ci.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ jobs:
3131
uses: actions/setup-go@v5
3232
with:
3333
go-version-file: go.mod
34-
- name: Build
35-
run: make crossbuild
3634
- name: Set version
3735
run: echo "${{ needs.calculate-tag.outputs.tag }}" | sed s/v//g > VERSION
36+
- name: Build
37+
run: make crossbuild
3838
- name: Package
3939
run: make crossbuild-tarballs
4040
- name: Archive artifacts

VERSION

Lines changed: 0 additions & 1 deletion
This file was deleted.

cmd/postgres_exporter/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ var (
5757
excludeDatabases = kingpin.Flag("exclude-databases", "A list of databases to remove when autoDiscoverDatabases is enabled (DEPRECATED)").Default("").Envar("PG_EXPORTER_EXCLUDE_DATABASES").String()
5858
includeDatabases = kingpin.Flag("include-databases", "A list of databases to include when autoDiscoverDatabases is enabled (DEPRECATED)").Default("").Envar("PG_EXPORTER_INCLUDE_DATABASES").String()
5959
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()
60-
maxOpenConnections = kingpin.Flag("max-connections", "the maximum number of opened connections").Default("-1").Envar("PG_MAX_CONNECTIONS").Int()
61-
maxIdleConnections = kingpin.Flag("max-idle-connections", "the maximum number of idle connections").Default("-1").Envar("PG_MAX_IDLE_CONNECTIONS").Int()
60+
maxOpenConnections = kingpin.Flag("max-connections", "the maximum number of opened connections").Default("10").Envar("PG_MAX_CONNECTIONS").Int()
61+
maxIdleConnections = kingpin.Flag("max-idle-connections", "the maximum number of idle connections").Default("5").Envar("PG_MAX_IDLE_CONNECTIONS").Int()
6262
collectorTimeout = kingpin.Flag("collector-timeout", "the single collector scrape timeout").Default("10s").Envar("PG_COLLECTOR_TIMEOUT").Duration()
6363
logger = log.NewNopLogger()
6464
)

cmd/postgres_exporter/postgres_exporter.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -540,7 +540,12 @@ func NewExporter(dsn []string, opts ...ExporterOpt) *Exporter {
540540
}
541541

542542
e.setupInternalMetrics()
543-
e.servers = NewServers(ServerWithLabels(e.constantLabels))
543+
e.servers = NewServers(
544+
ServerWithLabels(e.constantLabels),
545+
ServerWithMaxIdleConnections(*maxIdleConnections),
546+
ServerWithMaxOpenConnections(*maxOpenConnections),
547+
ServerWithScrapeTimeout(e.scrapeTimeout),
548+
)
544549

545550
return e
546551
}

0 commit comments

Comments
 (0)