Skip to content

merge current upstream state #8

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

Open
wants to merge 38 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
6f36adf
Update pg_long_running_transactions.go (#1092)
jyothikirant-sayukth Dec 22, 2024
5bb1702
Fix to replace dashes with underscore in the metric names (#1103)
aagarwalla-fx Dec 22, 2024
5145620
Bump github.com/prometheus/exporter-toolkit from 0.13.1 to 0.13.2 (#1…
dependabot[bot] Jan 1, 2025
bea2609
Checkpoint related columns in PG 17 have been moved from pg_stat_bgwr…
n-rodriguez Jan 1, 2025
ecb5ec5
Update common Prometheus files (#1090)
prombot Jan 7, 2025
9de4f19
Update common Prometheus files (#1110)
prombot Jan 7, 2025
7d4c278
Add Postgres 17 for CI test (#1105)
khiemdoan Jan 13, 2025
3acc479
Bump github.com/prometheus/common from 0.61.0 to 0.62.0 (#1118)
dependabot[bot] Feb 13, 2025
d85a771
Update common Prometheus files (#1124)
prombot Feb 14, 2025
072864d
pg_stat_statements PG17 (#1114)
NevermindZ4 Feb 15, 2025
9e42fc0
fix: handle pg_replication_slots on pg<13 (#1098)
michael-todorovic Feb 15, 2025
2ee2a8f
feat: add wait/backend to pg_stat_activity (#1106)
fgalind1 Feb 15, 2025
c3885e8
Export last replay age in replication collector (#1085)
bitfehler Feb 15, 2025
99e1b51
Bump github.com/prometheus/exporter-toolkit from 0.13.2 to 0.14.0 (#1…
dependabot[bot] Feb 15, 2025
4c170ed
Fix missing dsn sanitization for logging (#1104)
sysadmind Feb 15, 2025
8bb1a41
Skip pg_stat_checkpointer collector if pg<17 (#1112)
n-rodriguez Feb 20, 2025
51006ab
Prep for v0.17 (#1127)
sysadmind Feb 21, 2025
2869087
Fix: Handle incoming labels with invalid UTF-8 (#1131)
vancwo Feb 26, 2025
1e574cf
Release v0.17.1 (#1132)
SuperQ Feb 26, 2025
457b6fa
Bump github.com/prometheus/client_golang from 1.20.5 to 1.21.0 (#1133)
dependabot[bot] Mar 3, 2025
602302f
Update common Prometheus files (#1137)
prombot Mar 8, 2025
b0e61bf
Bump golang.org/x/net from 0.33.0 to 0.36.0 (#1138)
dependabot[bot] Mar 16, 2025
2ce65c3
Update common Prometheus files (#1140)
prombot Mar 23, 2025
fca2ad8
Update common Prometheus files (#1142)
prombot Mar 30, 2025
9e86f1e
Adds pg_stat_progress_vacuum collector (#1141)
ianbibby Apr 3, 2025
8d5ec4b
Update Go (#1147)
SuperQ Apr 3, 2025
43576ac
Bump github.com/prometheus/client_golang from 1.21.0 to 1.21.1 (#1144)
dependabot[bot] Apr 3, 2025
f8b7139
Bump github.com/prometheus/common from 0.62.0 to 0.63.0 (#1143)
dependabot[bot] Apr 3, 2025
5edc331
Record table only size bytes as well in addition to the total size by…
Sticksman Apr 18, 2025
6526065
Bump golang.org/x/net from 0.36.0 to 0.38.0 (#1152)
dependabot[bot] Apr 23, 2025
5ade81c
Update common Prometheus files (#1155)
prombot May 7, 2025
bd8a613
Bump github.com/prometheus/client_golang from 1.21.1 to 1.22.0 (#1154)
dependabot[bot] May 7, 2025
de42ef7
Export query itself together with queryId in stat_statement metrics (…
Delorien84 May 16, 2025
d1a957f
Update common Prometheus files (#1159)
prombot May 17, 2025
94e8399
Feat: Improve Error Handling for Server.Scrape (#1158)
BoweFlex May 29, 2025
d8ba628
Add a collector for `pg_buffercache_summary`. (#1165)
sfc-gh-pnuttall Jun 19, 2025
f9a88f4
Update common Prometheus files (#1160)
prombot Jun 19, 2025
6d3078d
Bump github.com/prometheus/common from 0.63.0 to 0.64.0 (#1163)
dependabot[bot] Jun 19, 2025
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
Prev Previous commit
Next Next commit
* Update Go to 1.24.
* Update golangci-lint to v2.
* Fixup linting issues.

Signed-off-by: SuperQ <[email protected]>
  • Loading branch information
SuperQ authored Apr 3, 2025
commit 8d5ec4b3ea77033d5d2b50fad1bb8df3f495265e
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ executors:
# This must match .promu.yml.
golang:
docker:
- image: cimg/go:1.23
- image: cimg/go:1.24

jobs:
test:
Expand All @@ -23,7 +23,7 @@ jobs:

integration:
docker:
- image: cimg/go:1.23
- image: cimg/go:1.24
- image: << parameters.postgres_image >>
environment:
POSTGRES_DB: circle_test
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
run: sudo apt-get update && sudo apt-get -y install libsnmp-dev
if: github.repository == 'prometheus/snmp_exporter'
- name: Lint
uses: golangci/golangci-lint-action@55c2c1448f86e01eaae002a5a3a9624417608d84 # v6.5.2
uses: golangci/golangci-lint-action@1481404843c368bc19ca9406f87d6e0fc97bdcfd # v7.0.0
with:
args: --verbose
version: v1.64.6
version: v2.0.2
53 changes: 33 additions & 20 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,36 @@
---
version: "2"
linters:
enable:
- misspell
- revive

issues:
exclude-rules:
- path: _test.go
linters:
- errcheck

linters-settings:
errcheck:
exclude-functions:
# Never check for logger errors.
- (github.com/go-kit/log.Logger).Log
revive:
- misspell
- revive
settings:
errcheck:
exclude-functions:
- (github.com/go-kit/log.Logger).Log
revive:
rules:
- name: unused-parameter
severity: warning
disabled: true
exclusions:
generated: lax
presets:
- comments
- common-false-positives
- legacy
- std-error-handling
rules:
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#unused-parameter
- name: unused-parameter
severity: warning
disabled: true
- linters:
- errcheck
path: _test.go
paths:
- third_party$
- builtin$
- examples$
formatters:
exclusions:
generated: lax
paths:
- third_party$
- builtin$
- examples$
2 changes: 1 addition & 1 deletion .promu.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
go:
# This must match .circle/config.yml.
version: 1.23
version: 1.24
repository:
path: github.com/prometheus-community/postgres_exporter
build:
Expand Down
2 changes: 1 addition & 1 deletion Makefile.common
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ PROMU_URL := https://github.com/prometheus/promu/releases/download/v$(PROMU_
SKIP_GOLANGCI_LINT :=
GOLANGCI_LINT :=
GOLANGCI_LINT_OPTS ?=
GOLANGCI_LINT_VERSION ?= v1.64.6
GOLANGCI_LINT_VERSION ?= v2.0.2
# golangci-lint only supports linux, darwin and windows platforms on i386/amd64/arm64.
# windows isn't included here because of the path separator being different.
ifeq ($(GOHOSTOS),$(filter $(GOHOSTOS),linux darwin))
Expand Down
4 changes: 2 additions & 2 deletions cmd/postgres_exporter/pg_setting.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ type pgSetting struct {
func (s *pgSetting) metric(labels prometheus.Labels) prometheus.Metric {
var (
err error
name = strings.Replace(strings.Replace(s.name, ".", "_", -1), "-", "_", -1)
name = strings.ReplaceAll(strings.ReplaceAll(s.name, ".", "_"), "-", "_")
unit = s.unit // nolint: ineffassign
shortDesc = fmt.Sprintf("Server Parameter: %s", s.name)
subsystem = "settings"
Expand Down Expand Up @@ -131,7 +131,7 @@ func (s *pgSetting) normaliseUnit() (val float64, unit string, err error) {
case "B", "kB", "MB", "GB", "TB", "1kB", "2kB", "4kB", "8kB", "16kB", "32kB", "64kB", "16MB", "32MB", "64MB":
unit = "bytes"
default:
err = fmt.Errorf("Unknown unit for runtime variable: %q", s.unit)
err = fmt.Errorf("unknown unit for runtime variable: %q", s.unit)
return
}

Expand Down
4 changes: 2 additions & 2 deletions cmd/postgres_exporter/pg_setting_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ var fixtures = []fixture{
n: normalised{
val: 10,
unit: "",
err: `Unknown unit for runtime variable: "nonexistent"`,
err: `unknown unit for runtime variable: "nonexistent"`,
},
},
}
Expand All @@ -240,7 +240,7 @@ func (s *PgSettingSuite) TestNormaliseUnit(c *C) {
func (s *PgSettingSuite) TestMetric(c *C) {
defer func() {
if r := recover(); r != nil {
if r.(error).Error() != `Unknown unit for runtime variable: "nonexistent"` {
if r.(error).Error() != `unknown unit for runtime variable: "nonexistent"` {
panic(r)
}
}
Expand Down
20 changes: 10 additions & 10 deletions collector/collector_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,15 @@ func readMetric(m prometheus.Metric) MetricResult {

func sanitizeQuery(q string) string {
q = strings.Join(strings.Fields(q), " ")
q = strings.Replace(q, "(", "\\(", -1)
q = strings.Replace(q, "?", "\\?", -1)
q = strings.Replace(q, ")", "\\)", -1)
q = strings.Replace(q, "[", "\\[", -1)
q = strings.Replace(q, "]", "\\]", -1)
q = strings.Replace(q, "{", "\\{", -1)
q = strings.Replace(q, "}", "\\}", -1)
q = strings.Replace(q, "*", "\\*", -1)
q = strings.Replace(q, "^", "\\^", -1)
q = strings.Replace(q, "$", "\\$", -1)
q = strings.ReplaceAll(q, "(", "\\(")
q = strings.ReplaceAll(q, "?", "\\?")
q = strings.ReplaceAll(q, ")", "\\)")
q = strings.ReplaceAll(q, "[", "\\[")
q = strings.ReplaceAll(q, "]", "\\]")
q = strings.ReplaceAll(q, "{", "\\{")
q = strings.ReplaceAll(q, "}", "\\}")
q = strings.ReplaceAll(q, "*", "\\*")
q = strings.ReplaceAll(q, "^", "\\^")
q = strings.ReplaceAll(q, "$", "\\$")
return q
}
4 changes: 2 additions & 2 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,14 @@ func (ch *Handler) ReloadConfig(f string, logger *slog.Logger) error {

yamlReader, err := os.Open(f)
if err != nil {
return fmt.Errorf("Error opening config file %q: %s", f, err)
return fmt.Errorf("error opening config file %q: %s", f, err)
}
defer yamlReader.Close()
decoder := yaml.NewDecoder(yamlReader)
decoder.KnownFields(true)

if err = decoder.Decode(config); err != nil {
return fmt.Errorf("Error parsing config file %q: %s", f, err)
return fmt.Errorf("error parsing config file %q: %s", f, err)
}

ch.Lock()
Expand Down
6 changes: 3 additions & 3 deletions config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func TestLoadConfig(t *testing.T) {

err := ch.ReloadConfig("testdata/config-good.yaml", nil)
if err != nil {
t.Errorf("Error loading config: %s", err)
t.Errorf("error loading config: %s", err)
}
}

Expand All @@ -39,11 +39,11 @@ func TestLoadBadConfigs(t *testing.T) {
}{
{
input: "testdata/config-bad-auth-module.yaml",
want: "Error parsing config file \"testdata/config-bad-auth-module.yaml\": yaml: unmarshal errors:\n line 3: field pretendauth not found in type config.AuthModule",
want: "error parsing config file \"testdata/config-bad-auth-module.yaml\": yaml: unmarshal errors:\n line 3: field pretendauth not found in type config.AuthModule",
},
{
input: "testdata/config-bad-extra-field.yaml",
want: "Error parsing config file \"testdata/config-bad-extra-field.yaml\": yaml: unmarshal errors:\n line 8: field doesNotExist not found in type config.AuthModule",
want: "error parsing config file \"testdata/config-bad-extra-field.yaml\": yaml: unmarshal errors:\n line 8: field doesNotExist not found in type config.AuthModule",
},
}

Expand Down