diff --git a/README.md b/README.md index 94abb5d..80fe1c1 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ to the exact version in `go.mod`. - Site: - Product source: - Theme source: -- Latest stable release documented: `v1.5.0` +- Latest stable release documented: `v1.6.0` ## Content layout @@ -199,7 +199,7 @@ python3 bin/build_architecture_diagram.py This writes four homepage diagrams to `static/img/architecture*.svg`: English and Chinese, each with light and dark variants. Edit the generator rather than -the SVGs. The diagram describes stable v1.5.0: one process targets a PostgreSQL +the SVGs. The diagram describes stable v1.6.0: one process targets a PostgreSQL instance or PgBouncer and serves `/metrics`. Unreleased components belong in the Design archive. Product counts and their source boundary are recorded in `data/home/metrics.yaml`. diff --git a/bin/build_architecture_diagram.py b/bin/build_architecture_diagram.py index d3e9cdc..c18f4d2 100644 --- a/bin/build_architecture_diagram.py +++ b/bin/build_architecture_diagram.py @@ -9,7 +9,7 @@ static/img/architecture-{light,dark}.svg static/img/architecture-zh-{light,dark}.svg -Facts checked against pg_exporter v1.5.0: one process targets either a +Facts checked against pg_exporter v1.6.0: one process targets either a PostgreSQL instance or PgBouncer. PostgreSQL uses lib/pq; PgBouncer uses its administration console. The process serves metrics on :9630/metrics. Development-only components are described in the Design archive. @@ -128,7 +128,7 @@ EN = { "alt": ( - "PG Exporter v1.5.0: each process collects one PostgreSQL instance or " + "PG Exporter v1.6.0: each process collects one PostgreSQL instance or " "PgBouncer target and serves metrics on :9630/metrics for " "Prometheus or VictoriaMetrics." ), @@ -159,7 +159,7 @@ ZH = { "alt": ( - "PG Exporter v1.5.0:每个进程采集一个 PostgreSQL 实例或 PgBouncer 目标," + "PG Exporter v1.6.0:每个进程采集一个 PostgreSQL 实例或 PgBouncer 目标," "通过 :9630/metrics 供 Prometheus 或 VictoriaMetrics 抓取。" ), "cap_left": "每个进程连接一个目标", diff --git a/content/api.md b/content/api.md index 4821a83..3bc26ed 100644 --- a/content/api.md +++ b/content/api.md @@ -50,13 +50,21 @@ pg_in_recovery 0 A database failure can still produce HTTP 200 with `pg_up 0`. Check the metrics as well as the HTTP status. Non-fatal collector errors omit that collector’s results; other collectors continue. A fatal collector error stops further collection on that database. HTTP 500 indicates a gathering or encoding error, such as conflicting metric definitions. +Since v1.6.0, at most two metrics requests are admitted across collection, waiting, and response writing. Collection is serial; the second request waits within its remaining budget, and further requests receive HTTP 503. The budget is 30 seconds, shortened by a valid positive finite `X-Prometheus-Scrape-Timeout-Seconds` header. A canceled waiter executes no SQL. + +Cancellation stops work before the next collector or database. A started collector with a positive timeout finishes its predicate chain and main SQL within their shared deadline and caches the result normally. A negative timeout removes that deadline: the query then follows request cancellation. An interrupted collection returns 503 if the connection still permits a response. Driver/network delays mean these deadlines are not hard wall-clock limits; configure the DSN `connect_timeout` for connection handshakes. + +An interrupted pass does not increment `pg_exporter_scrape_error_count` or `pg_exporter_server_scrape_error_count`; its summary log is INFO `interrupted`. Query errors and fatal-query ERROR logs remain observable. A real failure coinciding with request cancellation can therefore be omitted from these two pass counters. Without request cancellation, connection/precheck failures and fatal query failures, including their own timeouts, retain their error accounting. Non-fatal failures remain query-level errors. + +Failed refreshes retain the existing failure TTL. In particular, canceling a negative-timeout fatal collector caches a fatal failure: a later live scrape can count that failure and report `pg_up 0` until a successful refresh. Keep a positive timeout on fatal collectors. See [scrape lifetime](/design/scrape-lifetime/) for the rationale. + ### Self-Monitoring Metrics The default built-in prefix is `pg` for PostgreSQL and `pgbouncer` for PgBouncer. `--namespace` changes this prefix. It does not change names defined in YAML. | Metric | Type | Labels | Meaning | |:---|:---|:---|:---| -| `pg_up` | Gauge | — | 1 when the main target’s last scrape completed without a connection or fatal collector error | +| `pg_up` | Gauge | — | Main target availability from collection; see the interruption rule below | | `pg_version` | Gauge | — | Main target’s version number | | `pg_in_recovery` | Gauge | — | 1 for a replica, 0 for a primary; use when `pg_up = 1` | | `pg_exporter_build_info` | Gauge | version, revision, branch, builddate, goversion, goos, goarch | Constant 1 with build metadata | @@ -83,11 +91,13 @@ Configured constant labels are added to these series. Cumulative per-database an `--disable-intro` hides all built-in metrics in this table, including `pg_up`. YAML metrics, Go/process metrics, and HTTP health checks remain available. +During interruption, `pg_up` preserves the previous main-target availability, or 1 if this pass completed its precheck. If the very first precheck is interrupted before success, it remains 0 until a later successful scrape. Child-database interruptions follow the same per-server rule and do not increment the main-target error counter. + ## Health Checks ### GET /up -`/up` reports the main target’s cached health state. The exporter probes the target once per second and also updates this state after a scrape. HTTP health requests read the cache without issuing SQL. +After initialization, only the once-per-second background health probe updates the HTTP health snapshot. Slow collection does not hold the probe lock, and completing a scrape cannot overwrite a newer probe result. HTTP health requests read the snapshot without executing SQL. `pg_up` and `pg_in_recovery` remain scrape metrics: a fatal collector can make `pg_up` zero while `/up` still returns 200 for a reachable database. The main PostgreSQL pool allows three connections, PgBouncer two, and each discovered database one. | State in response body | HTTP status | Meaning | |:---|:---|:---| diff --git a/content/api.zh.md b/content/api.zh.md index 6b50516..9da2980 100644 --- a/content/api.zh.md +++ b/content/api.zh.md @@ -50,13 +50,21 @@ pg_in_recovery 0 数据库故障时,端点仍可能返回 HTTP 200,正文中 `pg_up` 为 0。检查 HTTP 状态时也要检查指标。普通采集器出错后,本轮不输出该采集器的结果,其他采集器继续执行。致命采集器出错后,停止该数据库的后续采集。HTTP 500 表示指标汇总或编码失败,例如指标定义冲突。 +自 v1.6.0 起,采集、等待与响应写入阶段合计最多接纳两个指标请求。采集仍串行;第二个请求在剩余预算内等待,更多请求返回 HTTP 503。预算默认为 30 秒,合法、有限且为正数的 `X-Prometheus-Scrape-Timeout-Seconds` 请求头可以缩短它。等待期间取消的请求不执行 SQL。 + +请求取消后,不再启动下一个采集器或数据库。已启动且 timeout 为正数的采集器,其谓词链与主 SQL 共用同一期限,继续执行并正常缓存结果。负数 timeout 关闭该期限,此时查询随请求取消。中断的采集在连接仍允许响应时返回 503。驱动与网络阻塞意味着这些期限不是硬性的墙钟上限;建连握手需另行设置 DSN 的 `connect_timeout`。 + +中断轮次不增加 `pg_exporter_scrape_error_count` 和 `pg_exporter_server_scrape_error_count`,轮次汇总日志为 INFO `interrupted`;查询错误计数与 fatal 查询的 ERROR 日志仍然保留。因此,恰好与请求取消重叠的真实失败可能不计入这两个轮次计数。请求没有取消时,连接/预检失败和 fatal 查询失败(包括自身超时)仍按错误计数;非 fatal 失败仍体现在查询级计数中。 + +刷新失败沿用原有失败 TTL。尤其是负数 timeout 的 fatal 采集器,被取消后会缓存 fatal 失败;后续有效抓取可能对该失败计数并返回 `pg_up 0`,直到成功刷新。建议 fatal 采集器保留正数 timeout。设计理由见 [采集生命周期](/zh/design/scrape-lifetime/)。 + ### 自监控指标 PostgreSQL 的内置指标前缀默认为 `pg`,PgBouncer 默认为 `pgbouncer`。`--namespace` 可以修改此类前缀,但不会改变 YAML 中定义的指标名。 | 指标 | 类型 | 标签 | 含义 | |:---|:---|:---|:---| -| `pg_up` | Gauge | — | 主目标最近一次抓取没有连接错误或致命采集器错误时为 1 | +| `pg_up` | Gauge | — | 采集所见的主目标可用状态;中断规则见下文 | | `pg_version` | Gauge | — | 主目标的版本号 | | `pg_in_recovery` | Gauge | — | 从库为 1,主库为 0;在 `pg_up = 1` 时使用 | | `pg_exporter_build_info` | Gauge | version、revision、branch、builddate、goversion、goos、goarch | 恒为 1,标签记录构建信息 | @@ -83,11 +91,13 @@ PostgreSQL 的内置指标前缀默认为 `pg`,PgBouncer 默认为 `pgbouncer` `--disable-intro` 会隐藏表中所有内置指标,包括 `pg_up`。YAML 指标、Go/进程指标和 HTTP 健康检查仍然可用。 +中断时,`pg_up` 保留主目标此前的可用状态;若本轮预检已成功,则保留为 1。首次预检在成功前被中断时,保持为 0,后续成功抓取可恢复。子数据库中断采用相同的单库规则,不增加主目标的错误计数。 + ## 健康检查 ### GET /up -`/up` 返回主连接目标的缓存健康状态。exporter 每秒探测一次目标,抓取完成后也会更新状态。HTTP 健康请求只读取缓存,不执行 SQL。 +初始化后,HTTP 健康状态只由每秒一次的后台探测更新。慢采集不再占用探测所需的锁,采集完成也不会覆盖更新的探测结果。HTTP 健康请求只读取快照,不执行 SQL。`pg_up` 与 `pg_in_recovery` 仍属于采集指标:fatal 采集器失败可能使 `pg_up` 为 0,而数据库可达时 `/up` 仍返回 200。PostgreSQL 主连接池最多三个连接,PgBouncer 最多两个,每个发现数据库最多一个。 | 响应正文 | HTTP 状态 | 含义 | |:---|:---|:---| diff --git a/content/blog/design/container-trust.md b/content/blog/design/container-trust.md index bf44b2a..6f59420 100644 --- a/content/blog/design/container-trust.md +++ b/content/blog/design/container-trust.md @@ -2,17 +2,17 @@ title: "Container Trust Roots and Release Checks" linkTitle: "Container Trust" date: "2026-11-08T00:00:00+08:00" -lastmod: "2026-11-08T00:00:00+08:00" +lastmod: "2026-11-09T00:00:00+08:00" authors: [Vonng] categories: [design] tags: [Design, Security, Compatibility] -summary: "Unreleased: include CA roots and the license in both scratch images, and exercise TLS and DEB artifacts in release validation." +summary: "v1.6.0: include CA roots and the license in both scratch images, and exercise TLS and DEB artifacts in release validation." --- -> **Status:** Implemented but unreleased.
-> **Decision date / last verification:** 2026-11-08 / 2026-11-08.
+> **Status:** Implemented in v1.6.0.
+> **Decision date / last verification:** 2026-11-08 / 2026-11-09.
> **Scope:** Container and release-validation changes based on v1.5.0 source `1891254`, incorporating the packaging correction from `68c95ba`. No exporter runtime or driver change.
-> **Delivery:** Source is committed locally as `370b9fa`; the companion record is committed locally. Both Docker build paths, amd64/arm64 GoReleaser images, three DEB architectures, Go tests, static checks, and the documentation build are validated. Push, tag, published packages/images, deployment, and production verification have not occurred for this change. +> **Delivery:** Source `370b9fa` is included in v1.6.0 at `6bee809` and pushed. Both Docker build paths, amd64/arm64 GoReleaser images, three DEB architectures, Go tests, static checks, and the documentation build are validated. CI and draft artifacts are tracked by the v1.6.0 release gates; public tag, published images, deployment, and production verification remain separate. ## Problem @@ -44,4 +44,4 @@ The TLS cases use a local server and generated certificates, without depending o Release artifact checks retain RPM compatibility assertions and add DEB metadata, payload, configuration modes, conffiles, and installation checks. All DEB architectures are inspected; the container's native architecture is installed and its binary runs as `prometheus`. Checksums must verify successfully. -These gates validate a build candidate. Stable documentation and release notes must continue to describe v1.5.0 until a new tag and its artifacts actually ship this correction. +These gates validate a build candidate. The v1.6.0 manuals and release copy describe this correction; deploy them with the public release, after its artifacts are available. diff --git a/content/blog/design/container-trust.zh.md b/content/blog/design/container-trust.zh.md index 62c4b6b..81a870d 100644 --- a/content/blog/design/container-trust.zh.md +++ b/content/blog/design/container-trust.zh.md @@ -2,17 +2,17 @@ title: "容器信任根与发布检查" linkTitle: "容器信任根" date: "2026-11-08T00:00:00+08:00" -lastmod: "2026-11-08T00:00:00+08:00" +lastmod: "2026-11-09T00:00:00+08:00" authors: [Vonng] categories: [design] tags: [Design, Security, Compatibility] -summary: "尚未发布:为两条 scratch 镜像路径补齐 CA 根证书与许可证,并在发布验证中检查 TLS 连接和 DEB 产物。" +summary: "v1.6.0:为两条 scratch 镜像路径补齐 CA 根证书与许可证,并在发布验证中检查 TLS 连接和 DEB 产物。" --- -> **状态:** 已实现,未发布。
-> **决策日期/最后核验:** 2026-11-08/2026-11-08。
+> **状态:** 已实现,纳入 v1.6.0。
+> **决策日期/最后核验:** 2026-11-08/2026-11-09。
> **范围:** 基于 v1.5.0 源码 `1891254` 的容器与发布验证改动,吸收 `68c95ba` 的打包修正。不修改 exporter 运行时代码或数据库驱动。
-> **交付:** 源码已在本地提交为 `370b9fa`,配套设计记录也已在本地提交。两条 Docker 构建路径、amd64/arm64 GoReleaser 镜像、三个 DEB 架构、Go 测试、静态检查和文档构建均已验证。本次改动尚未推送、打标签、发布软件包或镜像、部署,也未完成生产验证。 +> **交付:** 源码 `370b9fa` 已纳入 v1.6.0 的 `6bee809` 并推送。两条 Docker 构建路径、amd64/arm64 GoReleaser 镜像、三个 DEB 架构、Go 测试、静态检查和文档构建均已验证。CI 与草稿制品以 v1.6.0 发布关卡为准;公开标签、镜像发布、部署和生产验证仍属独立步骤。 ## 问题 @@ -44,4 +44,4 @@ TLS 用例使用本地服务与临时生成的证书,不依赖公共 TLS 服 发布产物检查保留 RPM 兼容性断言,补充 DEB 元数据、文件内容、配置权限、conffiles 和安装检查。检查所有 DEB 架构的内容,在容器原生架构上安装软件包,并以 `prometheus` 身份运行二进制。校验和必须验证成功。 -这些检查只验收构建候选。新的标签与产物实际发布前,稳定版手册与发行说明仍应描述 v1.5.0 的行为。 +这些检查只验收构建候选。v1.6.0 手册与发布正文描述本次修正,在正式公开版本与制品可用时一同上线。 diff --git a/content/blog/design/progress-database-scope.md b/content/blog/design/progress-database-scope.md new file mode 100644 index 0000000..6f44b18 --- /dev/null +++ b/content/blog/design/progress-database-scope.md @@ -0,0 +1,41 @@ +--- +title: "Cluster Progress with Safe Relation Labels" +linkTitle: "Progress Database Scope" +date: "2026-11-09T00:00:00+08:00" +lastmod: "2026-11-09T00:00:00+08:00" +authors: [Vonng] +categories: [design] +tags: [Design, PostgreSQL, Compatibility] +summary: "v1.6.0: keep cluster-wide progress and use numeric OIDs for user relations in other databases." +--- + +> **Status:** Implemented in v1.6.0.
+> **Decision / last verification:** 2026-11-09.
+> **Scope:** v1.6.0 at source `6bee809` on main, [#115](https://github.com/pgsty/pg_exporter/issues/115); PostgreSQL 12+ vacuum, index creation, and cluster progress. Not shipped in v1.5.0.
+> **Delivery:** Source committed and pushed as `6bee809`; local validation and [Test Release](https://github.com/pgsty/pg_exporter/actions/runs/42549895870) passed. Versioned archives, RPM/DEB packages, and checksums are built for the draft. A public tag, public images, deployment, and production verification remain separate gates. + +## Decision + +The progress views report work across the instance, but `relid::regclass` resolves names only within the connected database. An OID from another database can resolve to an unrelated local relation. + +Keep `pg_vacuuming`, `pg_indexing`, and `pg_clustering` tagged `cluster, primary`. Resolve `relname` as `relid::regclass::text` when the row belongs to the connected database or the relation is a system catalog: OIDs below 16384 (`FirstNormalObjectId`) are assigned by initdb and name the same catalog in every database. For other relations in another database, emit the numeric OID as text, retaining `datname` and `pid` to identify the task. Do not filter out cross-database rows. + +Keep metric names, labels, types, version ranges, TTLs, and three cluster-level queries per refresh. Cross-database coverage continues when auto-discovery is disabled, a database is excluded, or the monitoring role cannot connect to it, subject to the progress view's existing visibility rules. No new connections or name lookups are required. + +## Tradeoff and rejected alternatives + +A numeric OID is less readable than a relation name, but accurately reports the identifier available from the main connection. This fixes false names without losing catalog names, such as a VACUUM of `pg_attribute` in another database; it deliberately does not promise cross-database name resolution for user relations. + +Per-database collection was rejected because it increases refresh queries from three to three per monitored database, including when no progress exists. It also loses progress from excluded or inaccessible databases. Adding lookup connections for active tasks duplicates discovery and permissions handling. Renaming labels would require a separate metric migration. Base-backup progress is unchanged. + +## Acceptance and upgrade + +Execute the PostgreSQL 12–16, 17, and 18+ SQL variants with local and foreign rows sharing the same relation OID. Verify the local name, the foreign numeric OID, and the name of a foreign system catalog, with one sample per task. Check primary/replica planning, that discovered connections do not duplicate cluster collectors, and cross-database coverage with discovery disabled or excluded databases. + +Update split YAML and generated configuration together. Existing installations must merge or replace these collector definitions; a binary-only upgrade does not apply this SQL correction. Local SQL tests do not establish production-load acceptance. + +## Local verification + +PostgreSQL 12, 17, and 18 passed monitoring-role SQL integration tests covering all three query-version branches. Temporary progress views include a local and foreign task with the same relation OID; the local task receives its name and the foreign task its numeric OID. A real PostgreSQL 18 index build remained visible once per metric with discovery disabled, with the database excluded, and when the monitoring role lacked CONNECT on that database. Planning tests cover PostgreSQL 12–19 and prevent duplicate collection on discovered connections. + +A review follow-up added a foreign `pg_catalog.pg_attribute` row to the fixture. On PostgreSQL 18.6 it reports `pg_attribute`; the earlier condition reported `1249`. A live throttled VACUUM of `pg_attribute` in another database confirmed the same, while a user table there still reported its OID. PostgreSQL 12 and 17 were not rerun for this follow-up. diff --git a/content/blog/design/progress-database-scope.zh.md b/content/blog/design/progress-database-scope.zh.md new file mode 100644 index 0000000..ab6d39b --- /dev/null +++ b/content/blog/design/progress-database-scope.zh.md @@ -0,0 +1,41 @@ +--- +title: "保留集群进度与准确的关系标识" +linkTitle: "进度指标的数据库范围" +date: "2026-11-09T00:00:00+08:00" +lastmod: "2026-11-09T00:00:00+08:00" +authors: [Vonng] +categories: [design] +tags: [Design, PostgreSQL, Compatibility] +summary: "v1.6.0:保留集群级进度采集,其他数据库的用户关系使用数字 OID。" +--- + +> **状态:** 已实现,纳入 v1.6.0。
+> **决策/最后核验:** 2026-11-09。
+> **范围:** main 上的 v1.6.0,源码 `6bee809`,解决 [#115](https://github.com/pgsty/pg_exporter/issues/115),涵盖 PostgreSQL 12+ 的 vacuum、建索引与 cluster 进度,未随 v1.5.0 发布。
+> **交付:** 源码已提交并推送为 `6bee809`,本地验证与 [Test Release](https://github.com/pgsty/pg_exporter/actions/runs/42549895870) 通过。带版本号的压缩包、RPM/DEB 与校验和已为草稿构建;公开标签、镜像发布、部署与生产验证仍是独立关卡。 + +## 决策 + +进度视图报告整个实例的任务,但 `relid::regclass` 只能在当前连接数据库中解析名称。其他数据库的 OID 可能被解析成不相关的本地关系。 + +保留 `pg_vacuuming`、`pg_indexing` 与 `pg_clustering` 的 `cluster, primary` 标签。记录属于当前连接数据库,或关系是系统目录时,用 `relid::regclass::text` 解析 `relname`:小于 16384(`FirstNormalObjectId`)的 OID 由 initdb 分配,在每个数据库中都指向同一系统目录。其他数据库的其余关系直接使用数字 OID 文本,并保留 `datname` 与 `pid` 标识任务。不滤除跨库记录。 + +保留指标名称、标签、类型、版本范围、TTL,以及每次刷新三条集群级查询。关闭自动发现、排除数据库或监控角色无法连接某库时,仍按进度视图原有的可见性规则覆盖跨库任务,不新增连接或名称查询。 + +## 权衡与未采用方案 + +数字 OID 可读性不如关系名,但准确表达了主连接能够获取的标识。本次解决错误表名,且不丢失系统目录名称(例如其他库中 `pg_attribute` 的 VACUUM),明确不承诺用户关系的跨库名称解析。 + +放弃逐库采集:它把每次刷新的查询数从三条增加为每库三条,即使没有进度任务也要执行,同时会丢失被排除或无法连接数据库的进度。额外为活跃任务创建名称查询连接会重复自动发现及权限处理;重命名标签则需要单独的指标迁移。基础备份进度保持不变。 + +## 验收与升级 + +执行 PostgreSQL 12–16、17、18+ 的 SQL 分支,用相同关系 OID 构造本地与外库记录,验证本地名称、外库数字 OID、外库系统目录名称及每个任务唯一的样本。检查主/备角色计划、发现连接不重复执行集群采集器,并确认关闭自动发现或排除数据库时仍有跨库进度。 + +同时更新分片 YAML 和生成配置。现有安装需要合并或替换这些定义,仅升级二进制不会应用 SQL 修正。本地 SQL 测试不代表生产负载验收。 + +## 本地验证 + +PostgreSQL 12、17、18 以监控角色通过 SQL 集成测试,覆盖三组查询版本分支。临时进度视图中,本地与外库任务使用相同关系 OID,本地任务输出名称,外库任务输出数字 OID。PostgreSQL 18 的真实建索引任务在关闭发现、数据库被排除,以及监控角色缺少该库 CONNECT 权限时均保持可见,每个指标只出现一次。计划测试覆盖 PostgreSQL 12–19,防止发现连接重复执行集群采集器。 + +评审跟进在测试数据中加入外库 `pg_catalog.pg_attribute` 记录。PostgreSQL 18.6 上输出 `pg_attribute`,此前的条件输出 `1249`。对其他库中 `pg_attribute` 的限速 VACUUM 实测结果相同,而该库用户表仍输出 OID。此次跟进未重跑 PostgreSQL 12 与 17。 diff --git a/content/blog/design/scrape-lifetime.md b/content/blog/design/scrape-lifetime.md new file mode 100644 index 0000000..5ac9dce --- /dev/null +++ b/content/blog/design/scrape-lifetime.md @@ -0,0 +1,49 @@ +--- +title: "Bounded SQL Scrapes and Client Cancellation" +linkTitle: "Scrape Lifetime" +date: "2026-11-09T00:00:00+08:00" +lastmod: "2026-11-09T00:00:00+08:00" +authors: [Vonng] +categories: [design] +tags: [Design, Reliability] +summary: "v1.6.0: bounded waiting for two scrapers, request cancellation, and the existing failure-cache policy." +--- + +> **Status:** Implemented in v1.6.0.
+> **Decision / last verification:** 2026-11-09.
+> **Scope:** v1.6.0 at source `6bee809` on main, addressing [#116](https://github.com/pgsty/pg_exporter/issues/116). Not shipped in v1.5.0.
+> **Delivery:** Source committed and pushed as `6bee809`; local validation and [Test Release](https://github.com/pgsty/pg_exporter/actions/runs/42549895870) passed. Versioned archives, RPM/DEB packages, and checksums are built for the draft. A public tag, public images, deployment, and production verification remain separate gates. + +## Decision + +Queries previously derived their contexts from `context.Background()`, allowing work to continue after the metrics client disconnected. More HTTP requests could wait indefinitely for the exporter lock. Bound this work while preserving failure isolation and cache reuse. + +Admit at most two metrics requests, including collection, waiting, and response writing. One request collects at a time; a second scraper can wait for the same collection lock within its remaining request budget. Further requests receive HTTP 503. Waiting is cancelable without starting another goroutine or executing SQL. This supports two Prometheus scrapers without an unbounded queue or shared cancellation ownership. + +Derive the request budget from the existing 30-second HTTP write timeout, shortened by a valid positive finite `X-Prometheus-Scrape-Timeout-Seconds` header. Queueing consumes this same budget. Prechecks inherit the context; collection checks it before each database and collector and starts no further collector once it expires. A collector already running with a timeout finishes its predicates and main query, which share that one deadline, even if the request ends, and its result is cached normally for later scrapers. A negative query timeout removes the per-query deadline, so only such a query is canceled with the request. + +Keep the existing failure-cache policy: a refresh that fails, including a canceled unbounded query, clears that collector's result and records its attempt for the normal TTL, so the next request does not immediately repeat it. A departing client never turns a healthy bounded refresh into a failure: a fatal collector does not report `pg_up 0` to other scrapers, and 60- or 300-second size and bloat collectors do not disappear for their TTL. A fatal collector with a negative timeout is the exception: canceling it caches a fatal failure for its TTL, so fatal collectors should keep a timeout. A pass ended by the client or the request budget has an INFO summary log and is not counted in `pg_exporter_scrape_error_count` or `pg_exporter_server_scrape_error_count`, which keep counting connection and fatal collector errors. Other collectors' caches remain intact. No partial result from the interrupted collector is published, and no expired value is silently served as fresh. TTL zero and `--disable-cache` still explicitly request refreshes on every scrape. A long TTL therefore also delays recovery from a failed refresh; this is the existing tradeoff, not a new retry scheduler. + +After gathering produces the response snapshot, release the collection lock before encoding and writing. The request still occupies an admission slot until its response finishes, bounding both waiting and slow responses. Keep Prometheus encoding, compression, Go/process metrics, and handler instrumentation. The normal collector interface remains usable without storing request context on the exporter. + +## Alternatives and boundaries + +Immediate rejection of every overlapping request causes avoidable gaps for two scrapers. Clearing the retry timestamp on cancellation repeatedly runs expensive queries and churns connections. Both were rejected during review. Canceling bounded queries with the request was also rejected: one client's disconnect became a failure cached for every scraper, and each lib/pq cancellation closes its connection. Letting the running collector finish normally costs up to its own timeout (2 seconds in the default configuration) of collection-lock time after the budget expires. Stopping between that collector's predicates and main query was rejected: it needs a separate not-attempted state and rollback, while saving only work bounded by the same deadline. Serving old results indefinitely would conceal stale measurements and needs a separate freshness contract. Background refresh, shared gathers, a parallel scheduler, new flags, and driver migration are outside this correction. + +The budget stops collection and cancels unbounded SQL. A running bounded collector can extend the response past the budget, normally by up to its own timeout. A stalled network can hold the driver longer, as in v1.5.0, so neither the budget nor a query timeout is a hard wall-clock limit, and no fixed encoding margin is reserved. The HTTP write deadline remains the transport limit. In particular, lib/pq connection handshakes need an appropriate DSN `connect_timeout`; a query context alone does not bound every network phase. See the [target-state record](/design/target-state-contracts/) for independent health probes. + +## Error Accounting + +An interrupted pass does not increment `pg_exporter_scrape_error_count` or `pg_exporter_server_scrape_error_count`; its summary log is INFO `interrupted`. Query errors and fatal-query ERROR logs remain observable. A real failure coinciding with request cancellation can therefore be omitted from these two pass counters. Without request cancellation, connection/precheck failures and fatal query failures, including their own timeouts, retain their error accounting. Non-fatal failures remain query-level errors. + +## Acceptance + +Verify repeated cancellation does not bypass TTL; healthy collectors and valid caches remain usable; retry resumes after TTL expiry. Exercise two overlapping scrapers, a canceled waiter, a full admission limit, cancellation of unbounded SQL, a client leaving during bounded SQL whose result must stay cached, an interrupted pass that must not increment error counters, and a slow response that must not hold the collection lock. Real PostgreSQL checks must confirm cancellation, bounded SQL attempts, and successful later scrapes. Validate PgBouncer separately. Local acceptance does not establish a release or production-load guarantee. + +## Local verification + +The full race suite and ten repeated runs of the focused concurrency tests passed. On PostgreSQL 18.6, a canceled refresh executed once during its TTL, while six following requests returned healthy metrics without repeating the failed SQL; expiry allowed a successful retry. Five rounds of two overlapping scrapers both returned HTTP 200, with one SQL refresh per round. Tests also cover canceled waiters, admission exhaustion, partial rows, predicate/precheck cancellation, and releasing the collection lock before a slow response finishes. No background refresh or stale-value fallback was added. + +These cancellation runs predate a review adjustment that changes only queries with a positive timeout. Afterward, on PostgreSQL 18.6, a client leaving or a 0.3-second budget during a 0.8-second bounded query let that query finish; the expired budget returned 503 after 0.8 seconds, and the next scrape reused the result without executing it again. A 3-second unbounded query was canceled by PostgreSQL (SQLSTATE 57014) when the client left at 1.5 seconds, left no active backend, and stayed absent within its TTL. Before the adjustment, the same bounded query was canceled and disappeared for its TTL. A regression test confirms that a client leaving during a fatal collector no longer gives the next scraper `pg_up 0`. + +A second review found that the running collector's later predicates and main query also continue after cancellation, and that interrupted passes incremented both error counters with an error log. The contract above now states the collector-level behavior, and interrupted passes are no longer counted. On PostgreSQL 18.6, a client leaving during a 0.8-second fatal bounded query previously left both counters at 1 with an error log; afterward both stayed at 0 and the pass was logged at info level, while the next scrape returned `pg_up 1` and the cached metric. Regression tests now use explicit synchronization instead of sleeps, and a real connection failure is still counted; the full suite passed 20 race-detector runs. diff --git a/content/blog/design/scrape-lifetime.zh.md b/content/blog/design/scrape-lifetime.zh.md new file mode 100644 index 0000000..43c30ce --- /dev/null +++ b/content/blog/design/scrape-lifetime.zh.md @@ -0,0 +1,49 @@ +--- +title: "SQL 采集的总时限与客户端取消" +linkTitle: "采集生命周期" +date: "2026-11-09T00:00:00+08:00" +lastmod: "2026-11-09T00:00:00+08:00" +authors: [Vonng] +categories: [design] +tags: [Design, Reliability] +summary: "v1.6.0:允许两个抓取者有界等待,传递请求取消,并沿用原有失败缓存策略。" +--- + +> **状态:** 已实现,纳入 v1.6.0。
+> **决策/最后核验:** 2026-11-09。
+> **范围:** main 上的 v1.6.0,源码 `6bee809`,解决 [#116](https://github.com/pgsty/pg_exporter/issues/116),未随 v1.5.0 发布。
+> **交付:** 源码已提交并推送为 `6bee809`,本地验证与 [Test Release](https://github.com/pgsty/pg_exporter/actions/runs/42549895870) 通过。带版本号的压缩包、RPM/DEB 与校验和已为草稿构建;公开标签、镜像发布、部署与生产验证仍是独立关卡。 + +## 决策 + +此前查询从 `context.Background()` 派生 context,指标客户端断开后工作仍可能继续,后续 HTTP 请求也可能无限等待 exporter 锁。本次限制这些工作,同时保留失败隔离与缓存复用。 + +最多接纳两个指标请求,涵盖采集、等待及响应写入。一次只执行一轮采集,第二个抓取者可以在剩余请求预算内等待同一把采集锁,更多请求返回 HTTP 503。等待可以取消,不启动额外 goroutine,也不执行 SQL。这样支持双 Prometheus 抓取,且不引入无界队列或共享任务的取消归属问题。 + +请求预算沿用现有 30 秒 HTTP 写入时限,合法、有限且为正数的 `X-Prometheus-Scrape-Timeout-Seconds` 请求头可以缩短它;排队也消耗同一预算。预检继承请求 context;采集在每个数据库和采集器开始前检查 context,过期后不再启动新的采集器。已开始执行且设有 timeout 的采集器,其谓词与主查询共用同一时限,即使请求结束也会执行完毕,结果照常缓存供后续抓取使用。负数 timeout 取消单查询期限,因此只有这类查询会随请求一起取消。 + +沿用原有失败缓存策略:刷新失败(包括被取消的无上限查询)时,清空该采集器结果,并按正常 TTL 记录此次尝试,下个请求不会立即重跑。客户端离开不会把健康的有界刷新变成失败:fatal 采集器不会向其他抓取者报告 `pg_up 0`,TTL 为 60 或 300 秒的容量与膨胀采集器也不会在整个 TTL 内缺失。例外是 timeout 为负数的 fatal 采集器:取消它会在 TTL 内缓存 fatal 失败,因此 fatal 采集器应保留 timeout。因客户端离开或请求预算耗尽而中断的采集轮次的汇总日志为 INFO,不计入 `pg_exporter_scrape_error_count` 与 `pg_exporter_server_scrape_error_count`,这两个计数继续只统计连接错误与 fatal 采集器错误。其他采集器的缓存保持有效。不发布中断采集器的部分结果,也不把过期值悄悄当作新数据返回。TTL 为零或 `--disable-cache` 仍表示每次抓取都刷新。因此较长 TTL 也会延迟失败后的恢复,这是已有权衡,不增加重试调度器。 + +采集形成响应快照后,在编码和网络写入前释放采集锁。请求直到响应结束仍占用接纳名额,从而同时限制等待和慢响应。保留 Prometheus 编码、压缩、Go/进程指标及 HTTP 自监控;标准采集器接口继续可用,不在 exporter 上保存可变请求 context。 + +## 备选方案与边界 + +一律立即拒绝重叠请求会给双抓取者制造不必要的缺口;取消后清零重试时间会反复运行昂贵查询并重建连接,评审后放弃这两个方案。同样放弃随请求取消有界查询:一个客户端断开会变成所有抓取者共享的失败缓存,而且 lib/pq 每次取消都会关闭连接。让正在执行的采集器执行完毕,代价通常是预算过期后最多再占用采集锁该采集器自身的 timeout(默认配置最长 2 秒)。也放弃在同一采集器的谓词与主查询之间中止:那需要单独的“未执行”状态和回滚,省下的工作仍受同一时限约束。无限返回旧结果会掩盖数据陈旧,需要单独的新鲜度契约。本次不增加后台刷新、共享 gather、并行调度、新参数,也不迁移驱动。 + +预算过期会停止采集并取消无上限 SQL。正在执行的有界采集器可能让响应超出预算,通常最多为其自身 timeout。网络阻塞时驱动可能占用更久,v1.5.0 亦然,因此预算与查询 timeout 都不是硬性的墙钟上限,也不预留固定编码余量;HTTP 写入期限仍是传输层限制。尤其是 lib/pq 建连握手需要合适的 DSN `connect_timeout`,仅有查询 context 无法约束每个网络阶段。独立健康探测见[目标状态记录](/zh/design/target-state-contracts/)。 + +## 错误计数边界 + +中断轮次不增加 `pg_exporter_scrape_error_count` 和 `pg_exporter_server_scrape_error_count`,轮次汇总日志为 INFO `interrupted`;查询错误计数与 fatal 查询的 ERROR 日志仍然保留。因此,恰好与请求取消重叠的真实失败可能不计入这两个轮次计数。请求没有取消时,连接/预检失败和 fatal 查询失败(包括自身超时)仍按错误计数;非 fatal 失败仍体现在查询级计数中。 + +## 验收 + +验证连续取消不会绕过 TTL,健康采集器及有效缓存仍可用,并在 TTL 过期后恢复尝试。覆盖双抓取重叠、取消等待者、接纳名额已满、取消无上限 SQL、有界 SQL 执行中客户端离开后结果仍须缓存、中断的采集轮次不得增加错误计数,以及慢响应不能占用采集锁。真实 PostgreSQL 须确认取消、SQL 尝试次数受限及后续抓取成功,另行验证 PgBouncer。本地验收不等于发布或生产负载保证。 + +## 本地验证 + +完整 race 测试与重点并发用例连续十轮通过。在 PostgreSQL 18.6 上,被取消的刷新在 TTL 内只执行一次;后续六次请求返回健康指标,没有重复失败 SQL,TTL 过期后可以成功重试。五轮双抓取均返回 HTTP 200,每轮只刷新一次 SQL。测试还覆盖取消等待者、接纳名额耗尽、部分行、谓词/预检取消,以及慢响应结束前释放采集锁。本次未增加后台刷新或旧值回退。 + +上述取消实测早于一项评审调整,该调整只影响 timeout 为正数的查询。调整后在 PostgreSQL 18.6 上,0.8 秒的有界查询执行期间客户端离开或 0.3 秒预算到期,查询都会执行完毕;预算到期的请求在 0.8 秒后返回 503,下一次抓取直接复用结果,不再执行。3 秒的无上限查询在客户端于 1.5 秒离开时被 PostgreSQL 取消(SQLSTATE 57014),没有残留活跃后端,并在 TTL 内保持缺失。调整前,同一有界查询会被取消,并在整个 TTL 内缺失。回归测试确认,fatal 采集器执行中客户端离开,下一个抓取者不再看到 `pg_up 0`。 + +第二轮评审发现,取消后正在执行的采集器还会继续执行其余谓词与主查询,并且中断的采集轮次会使两个错误计数增加、记录 error 日志。上文契约已改为按采集器描述这一行为,中断轮次也不再计数。在 PostgreSQL 18.6 上,0.8 秒的有界 fatal 查询执行中客户端离开,此前两个计数均为 1 并有 error 日志;修正后均保持 0,只记 info 日志,下一次抓取返回 `pg_up 1` 与缓存指标。回归测试改用显式同步而非 sleep,并确认真实连接失败仍会计数;完整测试在 race 检测下连续 20 轮通过。 diff --git a/content/blog/design/target-state-contracts.md b/content/blog/design/target-state-contracts.md index ba63b25..aed798e 100644 --- a/content/blog/design/target-state-contracts.md +++ b/content/blog/design/target-state-contracts.md @@ -2,15 +2,15 @@ title: "Target Identity and Consistent Health Responses" linkTitle: "Target State Contracts" date: "2026-10-23T00:00:00+08:00" -lastmod: "2026-10-23T00:00:00+08:00" +lastmod: "2026-11-09T00:00:00+08:00" authors: [Vonng] categories: [design] tags: [Design, PostgreSQL, Reliability] -summary: "Shipped in v1.5.0: validate connection URLs without disclosing credentials, preserve database identity, and publish coherent health responses." +summary: "v1.5.0 target-state guarantees, with the v1.6.0 amendment separating health probes from collection." --- -> **Status:** Shipped in v1.5.0.
-> **Decision and last verification:** 2026-10-23.
+> **Status:** Original contract shipped in v1.5.0; the 2026-11-09 health amendment is implemented in v1.6.0.
+> **Decision / last verification:** Original decision 2026-10-23; health amendment and local verification 2026-11-09.
> **Scope:** v1.5.0 at source `1891254` (fix baseline `9b378cb`). This decision covers target URL handling and database identity, metadata-driven collector selection, HTTP health snapshots, YAML durations, and metrics-route validation.
> **Delivery:** Source committed and pushed; tag v1.5.0 points to `18912540fe5edce0ed0ee81fac0d989738ecaa87`. CI and the release workflow passed; the GitHub Release, RPM/DEB packages, archives, and Docker images are published. This does not establish production deployment or production-load acceptance. @@ -30,7 +30,17 @@ Successful metadata prechecks invalidate the query plan when username, schema me Publish one atomic status enum: unknown, down, starting, primary, or replica. Derive `Up()` and `Recovery()` from that enum. Each health HTTP handler reads it once and derives both the response code and body from that value. Three separately atomic fields do not form one atomic snapshot, and repeated reads can combine different probe generations. -The existing routes, HTTP codes, background probe interval, and scrape-derived health updates remain. This guarantees internal response consistency; it does not make a cached probe a synchronous proof of database availability. A mutex is unnecessary because the entire state fits in one atomic integer. +In v1.5.0, the existing routes, HTTP codes, background probe interval, and scrape-derived health updates remained. This guarantees internal response consistency; it does not make a cached probe a synchronous proof of database availability. A mutex is unnecessary because the entire state fits in one atomic integer. + +## Health probe independence (v1.6.0, 2026-11-09) + +This amendment addresses [#112](https://github.com/pgsty/pg_exporter/issues/112) and [#113](https://github.com/pgsty/pg_exporter/issues/113), based on main at `9d9804f`. It is included in v1.6.0 at `6bee809`, after v1.5.0. Source is committed and pushed; CI and draft artifacts are separate release gates. A draft is not a public release or production deployment. + +Before v1.6.0, the main server's collection lock delayed background probes, and a scrape that finishes collecting child databases can overwrite a newer probe with an older main-target observation. Keep a separate short lock for database-handle initialization. Probes share the existing pool without waiting for the collection lock. The main PostgreSQL pool remains at three connections and discovered pools at one. Increase the main PgBouncer pool from one to two, allowing one serial collection and one serial probe without falsely reporting down because the exporter occupied its own connection. This costs at most one additional PgBouncer connection. Probes pass a connection-timeout context, but handshake phases still need an appropriate DSN `connect_timeout`; this is not a hard termination deadline. + +After the constructor's initial state, publish health only from serialized health probes. Scrape results continue to update `pg_up` and `pg_in_recovery`, but no longer write the HTTP health snapshot. Routes, response codes, and the one-second probe interval remain. Health describes the most recently completed reachability/role probe; a fatal collector failure is represented by scrape metrics rather than by a separate writer to health. + +This avoids timestamp arbitration between two writers and a second connection pool. No new health flag, worker, or synchronous SQL in HTTP health handlers is needed. Regression tests must keep probes responsive during a blocked collector, preserve newer role/failure observations when a child scrape finishes, and cover initialization, concurrent explicit/background probes, and shutdown under the race detector. ## Metrics route @@ -51,3 +61,5 @@ The final v1.5.0 pre-release checks add this evidence: The full certificate-chain/hostname/mTLS matrix, a real SQLSTATE `57P03` startup transition, and production load are outside this verification scope. Docker certificate verification still requires a mounted CA. Directory loading can skip invalid files; empty YAML is a valid zero-collector configuration; `SIGTERM` does not wait for active HTTP requests. These existing behaviors are unchanged. Related configuration validation rejects non-finite or positively overflowing YAML query TTL, query timeout, and predicate TTL seconds before conversion to `time.Duration`; zero/default and finite negative timeout semantics remain. No driver migration, optional-source integration, metric-name change, or general refactor is part of this decision. + +The amendment passes deterministic race tests for blocked collectors, newer primary/replica/down observations, pool exhaustion, concurrent DB initialization, and stopping the health loop during collection. On PgBouncer 1.26.1, a deliberately delayed statistics response did not block version probes or cause false down responses; stopping and restarting the service was detected. These checks do not establish PostgreSQL failover or production-load acceptance. diff --git a/content/blog/design/target-state-contracts.zh.md b/content/blog/design/target-state-contracts.zh.md index 063b5e6..366f606 100644 --- a/content/blog/design/target-state-contracts.zh.md +++ b/content/blog/design/target-state-contracts.zh.md @@ -2,15 +2,15 @@ title: "目标身份与一致的健康检查响应" linkTitle: "目标状态契约" date: "2026-10-23T00:00:00+08:00" -lastmod: "2026-10-23T00:00:00+08:00" +lastmod: "2026-11-09T00:00:00+08:00" authors: [Vonng] categories: [design] tags: [Design, PostgreSQL, Reliability] -summary: "已随 v1.5.0 发布:安全校验连接串,保持数据库身份准确,并让健康检查返回一致的状态。" +summary: "v1.5.0 的目标状态保证,以及v1.6.0 将健康探测与采集分离的修订。" --- -> **状态:** 已随 v1.5.0 发布。
-> **决策与最后核验日期:** 2026-10-23。
+> **状态:** 原始契约已随 v1.5.0 发布;2026-11-09 健康修订已纳入 v1.6.0。
+> **决策/最后核验日期:** 原始决策为 2026-10-23;健康修订与本地验证为 2026-11-09。
> **范围:** v1.5.0,源码 `1891254`(修复基线 `9b378cb`),涵盖连接串与数据库身份、由元数据驱动的采集器选择、HTTP 健康状态快照、YAML 时间配置及指标路由校验。
> **交付:** 源码已提交并推送,v1.5.0 标签指向 `18912540fe5edce0ed0ee81fac0d989738ecaa87`;CI 与正式发布工作流通过,GitHub Release、RPM/DEB/压缩包和 Docker 镜像已发布。未据此声称生产部署或生产负载验收完成。 @@ -30,7 +30,17 @@ URL 语法或查询参数转义错误必须阻止启动,且不能打印原始 只发布一个原子状态枚举:unknown、down、starting、primary、replica。`Up()` 和 `Recovery()` 从这个值推导。每个健康检查 HTTP 请求只读取一次,并同时推导状态码和响应正文。三个分别原子更新的字段并不是一份原子快照;重复读取也可能混合不同探测轮次的状态。 -沿用既有路由、HTTP 状态码、后台探测间隔和采集结果更新健康状态的方式。此决定保证单次响应内部一致,并不把缓存状态变成数据库实时可用性的同步证明。完整状态可存入一个原子整数,无需增加互斥锁。 +v1.5.0 沿用既有路由、HTTP 状态码、后台探测间隔和采集结果更新健康状态的方式。此决定保证单次响应内部一致,并不把缓存状态变成数据库实时可用性的同步证明。完整状态可存入一个原子整数,无需增加互斥锁。 + +## 健康探测独立性(v1.6.0,2026-11-09) + +本次修订基于 main 的 `9d9804f`,解决 [#112](https://github.com/pgsty/pg_exporter/issues/112) 与 [#113](https://github.com/pgsty/pg_exporter/issues/113),纳入 v1.6.0 的 `6bee809`,不属于 v1.5.0。源码已提交并推送;CI 与草稿制品是独立发布关卡,草稿不等于公开发布或生产部署。 + +v1.6.0 之前,主目标的采集锁会阻塞后台探测;子库采集完成后,旧的主目标观测又可能覆盖较新的探测结果。数据库句柄初始化改用独立的短锁,探测沿用现有连接池,不再等待采集锁。PostgreSQL 主目标池保持三个连接,发现连接保持一个;PgBouncer 主目标池由一个增为两个,容纳串行采集与串行探测各一条连接,避免仅因 exporter 自身占用连接而报告 down。代价是最多增加一个 PgBouncer 连接。探测仍传递连接超时 context,但握手等网络阶段需要合适的 DSN `connect_timeout`,不承诺硬终止时限。 + +构造阶段的初始状态之后,HTTP 健康状态只由串行的健康探测更新。采集继续更新 `pg_up` 与 `pg_in_recovery`,但不再写入 HTTP 健康快照。路由、状态码与一秒探测间隔不变。健康状态表示最近一次完成的连通性与角色探测;fatal 采集器失败通过采集指标反映,不再成为另一处健康状态写入来源。 + +这个方案避免引入两个写入来源之间的时间戳仲裁和第二个连接池,不新增健康参数、工作线程,也不在 HTTP 健康处理器中同步执行 SQL。回归测试须覆盖阻塞采集器期间的探测、新角色或失败状态不被子库完成事件覆盖,以及初始化、显式与后台探测并发、停止过程的 race 检查。 ## 指标路由 @@ -51,3 +61,7 @@ v1.5.0 发布前验收补充了以下验证: 证书链/主机名/双向 TLS 的全部组合、SQLSTATE `57P03` 的真实启动瞬态和生产负载不在本轮完整验证范围内。Docker 的证书验证仍需按手册挂载 CA。目录加载可跳过错误文件;空 YAML 是合法的零采集器配置;`SIGTERM` 不等待活跃 HTTP 请求。上述既有行为没有改变。 配套配置校验在转换为 `time.Duration` 前拒绝 YAML 主查询 TTL、查询 timeout 和谓词 TTL 中非有限或正向溢出的秒数,保留零值、默认值及有限负超时的既有语义。本次不迁移驱动,不整合可选组件,不修改指标名称,也不做通用重构。 + +本次修订通过了确定性的 race 测试,覆盖阻塞采集器、较新的 primary/replica/down 观测、连接池耗尽、数据库初始化并发,以及采集期间停止健康循环。这些测试不代表真实主备切换或生产负载验收。 + +PgBouncer 1.26.1 的统计响应被人为延迟时,版本探测仍成功,未误报 down;服务停止与重启也被正确识别。这不代表 PostgreSQL 故障切换或生产负载验收。 diff --git a/content/blog/release/v1.6.0.md b/content/blog/release/v1.6.0.md new file mode 100644 index 0000000..f34d39a --- /dev/null +++ b/content/blog/release/v1.6.0.md @@ -0,0 +1,45 @@ +--- +title: "PG Exporter v1.6.0" +linkTitle: "v1.6.0" +date: "2026-11-09T10:00:00+08:00" +authors: [Vonng] +description: "Independent health probes, bounded scrapes, correct cross-database progress labels, and container CA roots" +categories: [release] +tags: [Release, pg_exporter, Reliability] +weight: 4 +release_url: https://github.com/pgsty/pg_exporter/releases/tag/v1.6.0 +--- + +PG Exporter v1.6.0 separates health probes from collection, bounds overlapping metrics requests, preserves completed bounded refreshes after client cancellation, and corrects cross-database progress labels. It also supplies container trust roots and updates dependencies. The Go toolchain remains **1.27.3** and the PostgreSQL driver remains **lib/pq 1.12.3**. + +## Changes + +- **Independent health probes:** slow metrics collection no longer blocks the background probe. Completing a scrape no longer overwrites a newer reachability or role observation. After initialization, HTTP health is written only by the probe; `pg_up` and `pg_in_recovery` remain collection results. A reachable database can return `/up` HTTP 200 even when a fatal collector makes `pg_up` zero. +- **Controlled overlapping scrapes:** at most two metrics requests are admitted, including waiting and response writing. Collection remains serial. The second request can wait and reuse caches; extra requests receive HTTP 503. Waiting can be canceled without starting SQL. The request budget is 30 seconds, shortened by a valid positive finite Prometheus scrape-timeout header. +- **Collector-level cancellation:** request cancellation prevents the next collector or database from starting. A collector already running with a positive timeout continues its predicates and main SQL under one shared deadline, then caches its result normally. This prevents a departing client from turning a healthy bounded refresh into a failure cached for other scrapers. A negative timeout removes the collector deadline and lets the request cancel its SQL. +- **Clearer interruption accounting:** interrupted passes have an INFO `interrupted` summary and do not increment exporter/server scrape-error counts. Availability preserves the previous value, or becomes true after a successful precheck. Non-interrupted connection and fatal collector failures still count. Query-error statistics and fatal-query ERROR logs remain unchanged. +- **Correct progress labels:** `pg_vacuuming`, `pg_indexing`, and `pg_clustering` retain cluster-wide coverage and three queries per refresh. Relations in the connected database and system catalogs resolve to names; user relations in other databases use numeric OIDs in `relname`, retaining `datname` and `pid`. An unrelated local relation can no longer supply a misleading name. Discovery filters or a lack of CONNECT do not filter out visible progress rows. +- **Container trust:** both scratch-image build paths include the system CA bundle and license. Public CA verification can use the bundled trust store. Private CAs still require an explicit mount and `sslrootcert`; the default TLS mode is unchanged. +- **Dependencies and validation:** YAML moves from v3 to v4 with the existing collector syntax retained. Prometheus common/procfs, `golang.org/x/net`, and supporting dependencies are updated. CI verifies container payload/TLS behavior and inspects all DEB architectures, in addition to RPM compatibility and checksums. +- **Collector descriptions:** help text now distinguishes I/O bytes and operations, completed checkpoints, vacuum dead-tuple memory, and CLUSTER progress. SQL metric names, label keys, types, and units are unchanged on the same PostgreSQL version. + +## Upgrade notes {#metric-compatibility} + +1. **Upgrade the configuration with the binary.** Merge the new `pg_exporter.yml` or split YAML files; package upgrades preserve local configuration. A binary-only upgrade does not fix progress SQL. The bundle still contains 58 YAML files, 96 branches, 59 namespaces, and 460 distinct metric definitions, including disabled collectors and two unexpanded histograms. +2. **Check progress-label consumers.** Cross-database `relname` values can change from an incorrect name to an OID, creating new time series. Preserve database and task identity in dashboards. Names in the connected database and names of system catalogs remain readable. +3. **Choose the right health signal.** `/up` and role endpoints reflect the latest health probe. `pg_up` reflects main-target collection, including fatal collector failures. Non-fatal and child-database errors require their query/server metrics. `--disable-intro` hides all built-in metrics, including `pg_up`, while HTTP health remains available. +4. **Allow the PgBouncer probe connection.** The main PgBouncer pool maximum changes from one to two connections. PostgreSQL keeps three on the main target and one per discovered database. +5. **Keep positive timeouts on fatal collectors.** Canceling a negative-timeout fatal query caches its failure for the normal TTL. A subsequent live scrape can count that cached failure and return `pg_up 0` until a successful refresh. TTL zero or `--disable-cache` still forces a refresh on every scrape. +6. **Review scrape concurrency and budgets.** Excess requests or interrupted collection can return 503. A started bounded collector can extend work beyond the request budget, normally by up to its own timeout. Network stalls can last longer; neither timeout is a hard wall-clock guarantee, and connection handshakes need an appropriate DSN `connect_timeout`. + +A real error coinciding with request cancellation can be omitted from the two pass-error counters because classification uses both the pass error and the request context. Query-level failures remain visible. A first scrape interrupted before a successful precheck leaves `pg_up` at zero until later recovery. Failure TTL, reload behavior, and immediate SIGTERM exit remain unchanged; this release does not add background refresh or graceful shutdown. + +For upgrades from v1.4.1 or earlier, the [v1.5.0 migration notes](/release/v1.5.0/) still apply, including subscription labels, receiver-state mappings, and PostgreSQL 10–13 monitoring grants. See [metric compatibility](/compatibility/#exporter-160-metrics), [HTTP API](/api/), and [scrape lifetime](/design/scrape-lifetime/) for the operating contracts. + +## Verification scope + +Release validation covers the full race suite, both HTTP mux modes, module/generated-config consistency, static checks, six target builds, container TLS/payload checks, and package validation. Three cancellation regressions also passed 200 consecutive race-detector runs. The earlier reverse control failed with the interruption fix removed. On PostgreSQL 18.6, leaving during a bounded 0.8-second fatal query kept both pass-error counters at zero; the next scrape returned `pg_up 1` and the cached metric without repeating the SQL. + +Progress SQL variants were checked as a monitoring role on PostgreSQL 12, 17, and 18; the system-catalog follow-up and real cross-database VACUUM were verified on 18.6. These are scoped acceptance results, not a new exhaustive audit of every PostgreSQL release, extension, dashboard, or production workload. Composite, Patroni, pgBackRest, and PostgreSQL-log components remain on the separate `snort` development line and are not included in v1.6.0. + +{{< release-card >}} diff --git a/content/blog/release/v1.6.0.zh.md b/content/blog/release/v1.6.0.zh.md new file mode 100644 index 0000000..5f32082 --- /dev/null +++ b/content/blog/release/v1.6.0.zh.md @@ -0,0 +1,45 @@ +--- +title: "PG Exporter v1.6.0" +linkTitle: "v1.6.0" +date: "2026-11-09T10:00:00+08:00" +authors: [Vonng] +description: "独立健康探测、有界抓取、跨数据库进度标签修正与容器 CA 信任根" +categories: [release] +tags: [Release, pg_exporter, Reliability] +weight: 4 +release_url: https://github.com/pgsty/pg_exporter/releases/tag/v1.6.0 +--- + +PG Exporter v1.6.0 将健康探测与指标采集解耦,限制并发抓取与等待,保留客户端离开后已完成的有界刷新,并修正跨数据库进度标签。同时补齐容器信任根并更新依赖。构建工具链仍为 **Go 1.27.3**,PostgreSQL 驱动仍为 **lib/pq 1.12.3**。 + +## 修复与改进 + +- **健康探测独立运行:** 慢指标采集不再阻塞后台探测,采集完成不再覆盖更新的连通性或角色观测。初始化后,HTTP 健康状态只由探测写入;`pg_up` 和 `pg_in_recovery` 仍反映采集结果。数据库可达时,即使 fatal 采集器使 `pg_up` 为 0,`/up` 仍可返回 HTTP 200。 +- **限制重叠抓取:** 采集、等待和响应写入合计最多接纳两个指标请求。采集仍串行,第二个请求可以等待并复用缓存,更多请求返回 HTTP 503。等待可取消且不执行 SQL。请求预算为 30 秒,合法、有限且为正数的 Prometheus 抓取超时请求头可缩短它。 +- **按采集器取消:** 请求取消后不再启动下一个采集器或数据库。已经运行且 timeout 为正数的采集器,在同一期限内继续执行谓词链与主 SQL,然后正常缓存结果,避免一个客户端离开导致其他抓取者共享失败缓存。负数 timeout 关闭采集器期限,此时 SQL 随请求取消。 +- **区分中断与目标错误:** 中断轮次的汇总日志为 INFO `interrupted`,不增加 exporter/server 抓取错误计数。可用状态保留之前的值;本轮预检成功后视为 true。未中断的连接失败和 fatal 采集失败仍计数。查询级错误计数与 fatal 查询的 ERROR 日志保持原有行为。 +- **修正进度标签:** `pg_vacuuming`、`pg_indexing`、`pg_clustering` 保持集群级覆盖,每次刷新仍只执行三条查询。当前连接库与系统目录的关系解析为名称,其他库的用户关系在 `relname` 中使用数字 OID,并保留 `datname`、`pid`,避免误用本地同 OID 对象名称。自动发现过滤或缺少 CONNECT 权限不会滤除进度视图中可见的行。 +- **补齐容器信任:** 两条 scratch 镜像构建路径均包含系统 CA 证书包与许可证,公共 CA 校验可以使用内置信任库。私有 CA 仍需显式挂载并设置 `sslrootcert`;默认 TLS 模式不变。 +- **更新依赖与发布检查:** YAML 从 v3 升到 v4,保持既有采集器配置语法;更新 Prometheus common/procfs、`golang.org/x/net` 等依赖。CI 在 RPM 兼容性与校验和检查之外,验证容器文件/TLS 行为并检查三个 DEB 架构。 +- **校准帮助文本:** 区分 I/O 字节与操作次数、已完成检查点、VACUUM 死元组内存和 CLUSTER 进度。在相同 PostgreSQL 版本上,SQL 指标名、标签键、类型与单位不变。 + +## 升级注意事项 {#metric-compatibility} + +1. **同时升级配置与二进制。** 合并新版 `pg_exporter.yml` 或拆分 YAML,软件包升级会保留本地配置。只替换程序不会修正进度 SQL。默认配置仍包含 58 个 YAML 文件、96 个分支、59 个命名空间和 460 个去重指标定义,含默认禁用的采集器与两个未展开直方图。 +2. **检查进度标签的使用者。** 跨库 `relname` 可能从错误名称变为 OID,产生新的时序;面板应保留数据库与任务身份。当前库与系统目录的关系名称仍可读。 +3. **按目的选择健康信号。** `/up` 和角色端点反映最近一次健康探测;`pg_up` 反映主目标采集,包括 fatal 失败。非 fatal 与子数据库错误需查看查询/服务器指标。`--disable-intro` 会隐藏全部内置指标,包括 `pg_up`,但保留 HTTP 健康检查。 +4. **为 PgBouncer 探测预留连接。** PgBouncer 主连接池上限由一个增至两个。PostgreSQL 保持主目标三个连接,每个发现数据库一个连接。 +5. **fatal 采集器保留正数 timeout。** 取消负数 timeout 的 fatal 查询会按正常 TTL 缓存失败。后续有效抓取可能对该缓存失败计数,并返回 `pg_up 0`,直到成功刷新。TTL 为零或 `--disable-cache` 仍强制每次抓取刷新。 +6. **检查并发与预算。** 超额请求或中断采集可以返回 503。已经开始的有界采集器可能超出请求预算,通常最多再占用自身 timeout;网络阻塞可能更久,二者都不是硬性的墙钟上限。建连握手需配置合适的 DSN `connect_timeout`。 + +真实失败恰好与请求取消重叠时,可能不计入两个轮次错误计数,因为分类同时检查采集错误与请求 context;查询级失败仍可见。首次抓取在预检成功前中断时,`pg_up` 保持为 0,直到后续恢复。失败 TTL、重载和 SIGTERM 直接退出行为不变,本版本不增加后台刷新或优雅关闭。 + +从 v1.4.1 或更早版本升级时,仍需遵循 [v1.5.0 迁移说明](/zh/release/v1.5.0/),包括订阅标签、接收器状态映射和 PostgreSQL 10–13 监控授权。完整运行契约见 [指标兼容性](/zh/compatibility/#exporter-160-metrics)、[HTTP API](/zh/api/) 与 [采集生命周期](/zh/design/scrape-lifetime/)。 + +## 验证范围 + +发布验证覆盖完整 race 测试、两种 HTTP mux、模块与生成配置一致性、静态检查、六平台构建、容器 TLS/文件校验和软件包验证。三个取消回归用例还在 race 检测下连续 200 轮通过;此前移除中断修复的反向对照失败。PostgreSQL 18.6 上,客户端在 0.8 秒有界 fatal 查询期间离开,两个轮次错误计数保持为 0;下一次抓取返回 `pg_up 1` 与缓存指标,没有重跑 SQL。 + +进度 SQL 分支已使用监控角色在 PostgreSQL 12、17、18 上验证;系统目录补充场景与真实跨库 VACUUM 在 18.6 上验证。这些是限定场景的验收结果,不是对全部 PostgreSQL 版本、扩展、仪表盘和生产负载重新完成的完整审计。Composite、Patroni、pgBackRest 与 PostgreSQL 日志组件仍在独立的 `snort` 开发线上,不包含在 v1.6.0 中。 + +{{< release-card >}} diff --git a/content/collectors.md b/content/collectors.md index 19193a1..65071fb 100644 --- a/content/collectors.md +++ b/content/collectors.md @@ -7,11 +7,11 @@ icon: fa-solid fa-table-list categories: [Reference] --- -PG Exporter v{{< param version >}} ships **58 YAML files** (57 collector files and one schema reference) under [`config/`](https://github.com/pgsty/pg_exporter/tree/v1.5.0/config). They are merged in filename order into the default [`pg_exporter.yml`](https://github.com/pgsty/pg_exporter/blob/v1.5.0/pg_exporter.yml) by `make conf`. +PG Exporter v{{< param version >}} ships **58 YAML files** (57 collector files and one schema reference) under [`config/`](https://github.com/pgsty/pg_exporter/tree/v1.6.0/config). They are merged in filename order into the default [`pg_exporter.yml`](https://github.com/pgsty/pg_exporter/blob/v1.6.0/pg_exporter.yml) by `make conf`. The filename prefix is an ordering convention, not a metric name. A file can define multiple version- or role-specific branches with the same public metric namespace. On the first scrape, PG Exporter evaluates server facts and selects eligible branches; [`GET /explain`](/api/#get-explain) shows that plan for the connected target. -Across version branches, v1.5.0 defines **59 collector namespaces and 460 distinct metric names** before histogram expansion. This count includes disabled collectors and two `HISTOGRAM` definitions. The number of series in a scrape depends on the selected branches, rows, labels, and histogram buckets. +Across version branches, v1.6.0 defines **59 collector namespaces and 460 distinct metric names** before histogram expansion. This count includes disabled collectors and two `HISTOGRAM` definitions. The number of series in a scrape depends on the selected branches, rows, labels, and histogram buckets. Before upgrading PostgreSQL or replacing the collector configuration, review the [metric compatibility and migration tables](/compatibility/#metric-compatibility). They distinguish v1.5.0 label/state corrections, PG19 additions and semantic changes, and metrics removed at earlier PostgreSQL version boundaries, with checks for missing-series alerts. @@ -36,66 +36,68 @@ Before upgrading PostgreSQL or replacing the collector configuration, review the | File | Namespace | Scope and requirement | |:---|:---|:---| -| [`0000-doc.yml`](https://github.com/pgsty/pg_exporter/blob/v1.5.0/config/0000-doc.yml) | config reference | YAML schema and collector authoring guide; no executable collector | -| [`0110-pg.yml`](https://github.com/pgsty/pg_exporter/blob/v1.5.0/config/0110-pg.yml) | `pg` | Basic server information, with primary and replica branches | -| [`0120-pg_meta.yml`](https://github.com/pgsty/pg_exporter/blob/v1.5.0/config/0120-pg_meta.yml) | `pg_meta` | Cluster metadata; PG13+ includes `primary_conninfo` | -| [`0130-pg_setting.yml`](https://github.com/pgsty/pg_exporter/blob/v1.5.0/config/0130-pg_setting.yml) | `pg_setting` | Shared settings and capacity limits | -| [`0210-pg_repl.yml`](https://github.com/pgsty/pg_exporter/blob/v1.5.0/config/0210-pg_repl.yml) | `pg_repl` | Replication sender statistics | -| [`0220-pg_sync_standby.yml`](https://github.com/pgsty/pg_exporter/blob/v1.5.0/config/0220-pg_sync_standby.yml) | `pg_sync_standby` | Synchronous standby status | -| [`0230-pg_downstream.yml`](https://github.com/pgsty/pg_exporter/blob/v1.5.0/config/0230-pg_downstream.yml) | `pg_downstream` | Downstream replication client counts | -| [`0240-pg_slot.yml`](https://github.com/pgsty/pg_exporter/blob/v1.5.0/config/0240-pg_slot.yml) | `pg_slot` | Replication slots; standby-aware on PG16+, PG19 invalidation reason support | -| [`0250-pg_recv.yml`](https://github.com/pgsty/pg_exporter/blob/v1.5.0/config/0250-pg_recv.yml) | `pg_recv` | Replica WAL receiver; PG19 `connecting` status support | -| [`0260-pg_sub.yml`](https://github.com/pgsty/pg_exporter/blob/v1.5.0/config/0260-pg_sub.yml) | `pg_sub` | Subscription statistics; PG19 sync-error and conflict counters | -| [`0270-pg_origin.yml`](https://github.com/pgsty/pg_exporter/blob/v1.5.0/config/0270-pg_origin.yml) | `pg_origin` | Replication origins; disabled by default, may need extra privileges | -| [`0300-pg_io.yml`](https://github.com/pgsty/pg_exporter/blob/v1.5.0/config/0300-pg_io.yml) | `pg_io` | `pg_stat_io` on PG16+, with a PG18+ branch | -| [`0310-pg_size.yml`](https://github.com/pgsty/pg_exporter/blob/v1.5.0/config/0310-pg_size.yml) | `pg_size` | Database, WAL, and log sizes | -| [`0320-pg_archiver.yml`](https://github.com/pgsty/pg_exporter/blob/v1.5.0/config/0320-pg_archiver.yml) | `pg_archiver` | Archiver process statistics | -| [`0330-pg_bgwriter.yml`](https://github.com/pgsty/pg_exporter/blob/v1.5.0/config/0330-pg_bgwriter.yml) | `pg_bgwriter` | Background writer statistics, with a PG17+ branch | -| [`0331-pg_checkpointer.yml`](https://github.com/pgsty/pg_exporter/blob/v1.5.0/config/0331-pg_checkpointer.yml) | `pg_checkpointer` | Checkpointer statistics; PG18+ completion and SLRU counters | -| [`0340-pg_ssl.yml`](https://github.com/pgsty/pg_exporter/blob/v1.5.0/config/0340-pg_ssl.yml) | `pg_ssl` | SSL client connection counts | -| [`0350-pg_checkpoint.yml`](https://github.com/pgsty/pg_exporter/blob/v1.5.0/config/0350-pg_checkpoint.yml) | `pg_checkpoint` | Checkpoint control information | -| [`0355-pg_timeline.yml`](https://github.com/pgsty/pg_exporter/blob/v1.5.0/config/0355-pg_timeline.yml) | `pg_timeline` | Current timeline ID on primary or replica | -| [`0360-pg_recovery.yml`](https://github.com/pgsty/pg_exporter/blob/v1.5.0/config/0360-pg_recovery.yml) | `pg_recovery`, `pg_recovery_prefetch` | Replica recovery and recovery-prefetch statistics | -| [`0370-pg_recovery_state.yml`](https://github.com/pgsty/pg_exporter/blob/v1.5.0/config/0370-pg_recovery_state.yml) | `pg_recovery_state` | PG19 replica recovery state from `pg_stat_recovery` | -| [`0380-pg_slru.yml`](https://github.com/pgsty/pg_exporter/blob/v1.5.0/config/0380-pg_slru.yml) | `pg_slru` | SLRU cache statistics on PG13+ | -| [`0390-pg_shmem.yml`](https://github.com/pgsty/pg_exporter/blob/v1.5.0/config/0390-pg_shmem.yml) | `pg_shmem` | Shared memory allocation; disabled by default, requires `schema:monitor` | -| [`0400-pg_wal.yml`](https://github.com/pgsty/pg_exporter/blob/v1.5.0/config/0400-pg_wal.yml) | `pg_wal` | WAL statistics on PG14+; PG19 adds full-page-image byte counters | -| [`0410-pg_activity.yml`](https://github.com/pgsty/pg_exporter/blob/v1.5.0/config/0410-pg_activity.yml) | `pg_activity` | Backend counts by database and state | -| [`0420-pg_wait.yml`](https://github.com/pgsty/pg_exporter/blob/v1.5.0/config/0420-pg_wait.yml) | `pg_wait` | Backend waits by wait-event type | -| [`0430-pg_backend.yml`](https://github.com/pgsty/pg_exporter/blob/v1.5.0/config/0430-pg_backend.yml) | `pg_backend` | Backend counts grouped by `backend_type` | -| [`0440-pg_xact.yml`](https://github.com/pgsty/pg_exporter/blob/v1.5.0/config/0440-pg_xact.yml) | `pg_xact` | Transaction snapshot boundaries and active transaction count | -| [`0450-pg_xact_age.yml`](https://github.com/pgsty/pg_exporter/blob/v1.5.0/config/0450-pg_xact_age.yml) | `pg_xact_age` | PG10+ per-database open and idle-in-transaction age snapshot histograms | -| [`0460-pg_lock.yml`](https://github.com/pgsty/pg_exporter/blob/v1.5.0/config/0460-pg_lock.yml) | `pg_lock` | Lock distribution by database and mode | -| [`0470-pg_lock_stat.yml`](https://github.com/pgsty/pg_exporter/blob/v1.5.0/config/0470-pg_lock_stat.yml) | `pg_lock_stat` | PG19 cluster-wide lock wait and fast-path overflow counters | -| [`0480-pg_query.yml`](https://github.com/pgsty/pg_exporter/blob/v1.5.0/config/0480-pg_query.yml) | `pg_query` | Query statistics; requires `extension:pg_stat_statements` | -| [`0510-pg_vacuuming.yml`](https://github.com/pgsty/pg_exporter/blob/v1.5.0/config/0510-pg_vacuuming.yml) | `pg_vacuuming` | Primary-only VACUUM progress; PG18+ includes `delay_time` | -| [`0520-pg_indexing.yml`](https://github.com/pgsty/pg_exporter/blob/v1.5.0/config/0520-pg_indexing.yml) | `pg_indexing` | Primary-only `CREATE INDEX` progress | -| [`0530-pg_clustering.yml`](https://github.com/pgsty/pg_exporter/blob/v1.5.0/config/0530-pg_clustering.yml) | `pg_clustering` | Primary-only `CLUSTER` and `VACUUM FULL` progress | -| [`0540-pg_backup.yml`](https://github.com/pgsty/pg_exporter/blob/v1.5.0/config/0540-pg_backup.yml) | `pg_backup` | Base backup progress on PG13+ | -| [`0610-pg_db.yml`](https://github.com/pgsty/pg_exporter/blob/v1.5.0/config/0610-pg_db.yml) | `pg_db` | Per-database statistics; PG18+ parallel-worker counters | -| [`0620-pg_db_confl.yml`](https://github.com/pgsty/pg_exporter/blob/v1.5.0/config/0620-pg_db_confl.yml) | `pg_db_confl` | Replica database conflict counters | -| [`0640-pg_pubrel.yml`](https://github.com/pgsty/pg_exporter/blob/v1.5.0/config/0640-pg_pubrel.yml) | `pg_pubrel` | Publication and publication-relation counts | -| [`0650-pg_subrel.yml`](https://github.com/pgsty/pg_exporter/blob/v1.5.0/config/0650-pg_subrel.yml) | `pg_subrel` | Subscription relation counts grouped by state | -| [`0660-pg_vacuum_score.yml`](https://github.com/pgsty/pg_exporter/blob/v1.5.0/config/0660-pg_vacuum_score.yml) | `pg_vacuum_score` | PG19 primary-only autovacuum score summary from `pg_stat_autovacuum_scores` | -| [`0700-pg_table.yml`](https://github.com/pgsty/pg_exporter/blob/v1.5.0/config/0700-pg_table.yml) | `pg_table` | Per-table statistics; PG18+ maintenance-time and new-page counters | -| [`0710-pg_index.yml`](https://github.com/pgsty/pg_exporter/blob/v1.5.0/config/0710-pg_index.yml) | `pg_index` | Per-index statistics | -| [`0720-pg_func.yml`](https://github.com/pgsty/pg_exporter/blob/v1.5.0/config/0720-pg_func.yml) | `pg_func` | Function execution statistics | -| [`0730-pg_seq.yml`](https://github.com/pgsty/pg_exporter/blob/v1.5.0/config/0730-pg_seq.yml) | `pg_seq` | Sequence metrics | -| [`0740-pg_relkind.yml`](https://github.com/pgsty/pg_exporter/blob/v1.5.0/config/0740-pg_relkind.yml) | `pg_relkind` | Relation counts by kind | -| [`0750-pg_defpart.yml`](https://github.com/pgsty/pg_exporter/blob/v1.5.0/config/0750-pg_defpart.yml) | `pg_defpart` | Default partition tuple counts | -| [`0810-pg_table_size.yml`](https://github.com/pgsty/pg_exporter/blob/v1.5.0/config/0810-pg_table_size.yml) | `pg_table_size` | Per-table sizes; can be slow on large schemas | -| [`0820-pg_table_bloat.yml`](https://github.com/pgsty/pg_exporter/blob/v1.5.0/config/0820-pg_table_bloat.yml) | `pg_table_bloat` | Disabled by default; requires auxiliary view `pg_table_bloat` | -| [`0830-pg_index_bloat.yml`](https://github.com/pgsty/pg_exporter/blob/v1.5.0/config/0830-pg_index_bloat.yml) | `pg_index_bloat` | Disabled by default; requires auxiliary view `pg_index_bloat` | -| [`0910-pgbouncer_list.yml`](https://github.com/pgsty/pg_exporter/blob/v1.5.0/config/0910-pgbouncer_list.yml) | `pgbouncer_list` | PgBouncer list metrics from the admin database | -| [`0920-pgbouncer_database.yml`](https://github.com/pgsty/pg_exporter/blob/v1.5.0/config/0920-pgbouncer_database.yml) | `pgbouncer_database` | PgBouncer database metrics with version-specific branches | -| [`0930-pgbouncer_stat.yml`](https://github.com/pgsty/pg_exporter/blob/v1.5.0/config/0930-pgbouncer_stat.yml) | `pgbouncer_stat` | PgBouncer per-database statistics with version-specific branches | -| [`0940-pgbouncer_pool.yml`](https://github.com/pgsty/pg_exporter/blob/v1.5.0/config/0940-pgbouncer_pool.yml) | `pgbouncer_pool` | PgBouncer pool metrics with version-specific branches | -| [`1000-pg_wait_event.yml`](https://github.com/pgsty/pg_exporter/blob/v1.5.0/config/1000-pg_wait_event.yml) | `pg_wait_event`, `pg_wait_event_1s` | Wait sampling; requires `extension:pg_wait_sampling` | -| [`1800-pg_tsdb_hypertable.yml`](https://github.com/pgsty/pg_exporter/blob/v1.5.0/config/1800-pg_tsdb_hypertable.yml) | `pg_tsdb_hypertable` | Disabled by default; requires TimescaleDB and its information schema | -| [`1900-pg_citus.yml`](https://github.com/pgsty/pg_exporter/blob/v1.5.0/config/1900-pg_citus.yml) | `pg_citus_node` | Citus worker/coordinator inventory; requires `extension:citus` | -| [`2000-pg_heartbeat.yml`](https://github.com/pgsty/pg_exporter/blob/v1.5.0/config/2000-pg_heartbeat.yml) | `pg_heartbeat` | Disabled by default; requires `monitor.heartbeat` in the `postgres` database | +| [`0000-doc.yml`](https://github.com/pgsty/pg_exporter/blob/v1.6.0/config/0000-doc.yml) | config reference | YAML schema and collector authoring guide; no executable collector | +| [`0110-pg.yml`](https://github.com/pgsty/pg_exporter/blob/v1.6.0/config/0110-pg.yml) | `pg` | Basic server information, with primary and replica branches | +| [`0120-pg_meta.yml`](https://github.com/pgsty/pg_exporter/blob/v1.6.0/config/0120-pg_meta.yml) | `pg_meta` | Cluster metadata; PG13+ includes `primary_conninfo` | +| [`0130-pg_setting.yml`](https://github.com/pgsty/pg_exporter/blob/v1.6.0/config/0130-pg_setting.yml) | `pg_setting` | Shared settings and capacity limits | +| [`0210-pg_repl.yml`](https://github.com/pgsty/pg_exporter/blob/v1.6.0/config/0210-pg_repl.yml) | `pg_repl` | Replication sender statistics | +| [`0220-pg_sync_standby.yml`](https://github.com/pgsty/pg_exporter/blob/v1.6.0/config/0220-pg_sync_standby.yml) | `pg_sync_standby` | Synchronous standby status | +| [`0230-pg_downstream.yml`](https://github.com/pgsty/pg_exporter/blob/v1.6.0/config/0230-pg_downstream.yml) | `pg_downstream` | Downstream replication client counts | +| [`0240-pg_slot.yml`](https://github.com/pgsty/pg_exporter/blob/v1.6.0/config/0240-pg_slot.yml) | `pg_slot` | Replication slots; standby-aware on PG16+, PG19 invalidation reason support | +| [`0250-pg_recv.yml`](https://github.com/pgsty/pg_exporter/blob/v1.6.0/config/0250-pg_recv.yml) | `pg_recv` | Replica WAL receiver; PG19 `connecting` status support | +| [`0260-pg_sub.yml`](https://github.com/pgsty/pg_exporter/blob/v1.6.0/config/0260-pg_sub.yml) | `pg_sub` | Subscription statistics; PG19 sync-error and conflict counters | +| [`0270-pg_origin.yml`](https://github.com/pgsty/pg_exporter/blob/v1.6.0/config/0270-pg_origin.yml) | `pg_origin` | Replication origins; disabled by default, may need extra privileges | +| [`0300-pg_io.yml`](https://github.com/pgsty/pg_exporter/blob/v1.6.0/config/0300-pg_io.yml) | `pg_io` | `pg_stat_io` on PG16+, with a PG18+ branch | +| [`0310-pg_size.yml`](https://github.com/pgsty/pg_exporter/blob/v1.6.0/config/0310-pg_size.yml) | `pg_size` | Database, WAL, and log sizes | +| [`0320-pg_archiver.yml`](https://github.com/pgsty/pg_exporter/blob/v1.6.0/config/0320-pg_archiver.yml) | `pg_archiver` | Archiver process statistics | +| [`0330-pg_bgwriter.yml`](https://github.com/pgsty/pg_exporter/blob/v1.6.0/config/0330-pg_bgwriter.yml) | `pg_bgwriter` | Background writer statistics, with a PG17+ branch | +| [`0331-pg_checkpointer.yml`](https://github.com/pgsty/pg_exporter/blob/v1.6.0/config/0331-pg_checkpointer.yml) | `pg_checkpointer` | Checkpointer statistics; PG18+ completion and SLRU counters | +| [`0340-pg_ssl.yml`](https://github.com/pgsty/pg_exporter/blob/v1.6.0/config/0340-pg_ssl.yml) | `pg_ssl` | SSL client connection counts | +| [`0350-pg_checkpoint.yml`](https://github.com/pgsty/pg_exporter/blob/v1.6.0/config/0350-pg_checkpoint.yml) | `pg_checkpoint` | Checkpoint control information | +| [`0355-pg_timeline.yml`](https://github.com/pgsty/pg_exporter/blob/v1.6.0/config/0355-pg_timeline.yml) | `pg_timeline` | Current timeline ID on primary or replica | +| [`0360-pg_recovery.yml`](https://github.com/pgsty/pg_exporter/blob/v1.6.0/config/0360-pg_recovery.yml) | `pg_recovery`, `pg_recovery_prefetch` | Replica recovery and recovery-prefetch statistics | +| [`0370-pg_recovery_state.yml`](https://github.com/pgsty/pg_exporter/blob/v1.6.0/config/0370-pg_recovery_state.yml) | `pg_recovery_state` | PG19 replica recovery state from `pg_stat_recovery` | +| [`0380-pg_slru.yml`](https://github.com/pgsty/pg_exporter/blob/v1.6.0/config/0380-pg_slru.yml) | `pg_slru` | SLRU cache statistics on PG13+ | +| [`0390-pg_shmem.yml`](https://github.com/pgsty/pg_exporter/blob/v1.6.0/config/0390-pg_shmem.yml) | `pg_shmem` | Shared memory allocation; disabled by default, requires `schema:monitor` | +| [`0400-pg_wal.yml`](https://github.com/pgsty/pg_exporter/blob/v1.6.0/config/0400-pg_wal.yml) | `pg_wal` | WAL statistics on PG14+; PG19 adds full-page-image byte counters | +| [`0410-pg_activity.yml`](https://github.com/pgsty/pg_exporter/blob/v1.6.0/config/0410-pg_activity.yml) | `pg_activity` | Backend counts by database and state | +| [`0420-pg_wait.yml`](https://github.com/pgsty/pg_exporter/blob/v1.6.0/config/0420-pg_wait.yml) | `pg_wait` | Backend waits by wait-event type | +| [`0430-pg_backend.yml`](https://github.com/pgsty/pg_exporter/blob/v1.6.0/config/0430-pg_backend.yml) | `pg_backend` | Backend counts grouped by `backend_type` | +| [`0440-pg_xact.yml`](https://github.com/pgsty/pg_exporter/blob/v1.6.0/config/0440-pg_xact.yml) | `pg_xact` | Transaction snapshot boundaries and active transaction count | +| [`0450-pg_xact_age.yml`](https://github.com/pgsty/pg_exporter/blob/v1.6.0/config/0450-pg_xact_age.yml) | `pg_xact_age` | PG10+ per-database open and idle-in-transaction age snapshot histograms | +| [`0460-pg_lock.yml`](https://github.com/pgsty/pg_exporter/blob/v1.6.0/config/0460-pg_lock.yml) | `pg_lock` | Lock distribution by database and mode | +| [`0470-pg_lock_stat.yml`](https://github.com/pgsty/pg_exporter/blob/v1.6.0/config/0470-pg_lock_stat.yml) | `pg_lock_stat` | PG19 cluster-wide lock wait and fast-path overflow counters | +| [`0480-pg_query.yml`](https://github.com/pgsty/pg_exporter/blob/v1.6.0/config/0480-pg_query.yml) | `pg_query` | Query statistics; requires `extension:pg_stat_statements` | +| [`0510-pg_vacuuming.yml`](https://github.com/pgsty/pg_exporter/blob/v1.6.0/config/0510-pg_vacuuming.yml) | `pg_vacuuming` | Primary-only VACUUM progress; PG18+ includes `delay_time` | +| [`0520-pg_indexing.yml`](https://github.com/pgsty/pg_exporter/blob/v1.6.0/config/0520-pg_indexing.yml) | `pg_indexing` | Primary-only `CREATE INDEX` progress | +| [`0530-pg_clustering.yml`](https://github.com/pgsty/pg_exporter/blob/v1.6.0/config/0530-pg_clustering.yml) | `pg_clustering` | Primary-only `CLUSTER` and `VACUUM FULL` progress | +| [`0540-pg_backup.yml`](https://github.com/pgsty/pg_exporter/blob/v1.6.0/config/0540-pg_backup.yml) | `pg_backup` | Base backup progress on PG13+ | +| [`0610-pg_db.yml`](https://github.com/pgsty/pg_exporter/blob/v1.6.0/config/0610-pg_db.yml) | `pg_db` | Per-database statistics; PG18+ parallel-worker counters | +| [`0620-pg_db_confl.yml`](https://github.com/pgsty/pg_exporter/blob/v1.6.0/config/0620-pg_db_confl.yml) | `pg_db_confl` | Replica database conflict counters | +| [`0640-pg_pubrel.yml`](https://github.com/pgsty/pg_exporter/blob/v1.6.0/config/0640-pg_pubrel.yml) | `pg_pubrel` | Publication and publication-relation counts | +| [`0650-pg_subrel.yml`](https://github.com/pgsty/pg_exporter/blob/v1.6.0/config/0650-pg_subrel.yml) | `pg_subrel` | Subscription relation counts grouped by state | +| [`0660-pg_vacuum_score.yml`](https://github.com/pgsty/pg_exporter/blob/v1.6.0/config/0660-pg_vacuum_score.yml) | `pg_vacuum_score` | PG19 primary-only autovacuum score summary from `pg_stat_autovacuum_scores` | +| [`0700-pg_table.yml`](https://github.com/pgsty/pg_exporter/blob/v1.6.0/config/0700-pg_table.yml) | `pg_table` | Per-table statistics; PG18+ maintenance-time and new-page counters | +| [`0710-pg_index.yml`](https://github.com/pgsty/pg_exporter/blob/v1.6.0/config/0710-pg_index.yml) | `pg_index` | Per-index statistics | +| [`0720-pg_func.yml`](https://github.com/pgsty/pg_exporter/blob/v1.6.0/config/0720-pg_func.yml) | `pg_func` | Function execution statistics | +| [`0730-pg_seq.yml`](https://github.com/pgsty/pg_exporter/blob/v1.6.0/config/0730-pg_seq.yml) | `pg_seq` | Sequence metrics | +| [`0740-pg_relkind.yml`](https://github.com/pgsty/pg_exporter/blob/v1.6.0/config/0740-pg_relkind.yml) | `pg_relkind` | Relation counts by kind | +| [`0750-pg_defpart.yml`](https://github.com/pgsty/pg_exporter/blob/v1.6.0/config/0750-pg_defpart.yml) | `pg_defpart` | Default partition tuple counts | +| [`0810-pg_table_size.yml`](https://github.com/pgsty/pg_exporter/blob/v1.6.0/config/0810-pg_table_size.yml) | `pg_table_size` | Per-table sizes; can be slow on large schemas | +| [`0820-pg_table_bloat.yml`](https://github.com/pgsty/pg_exporter/blob/v1.6.0/config/0820-pg_table_bloat.yml) | `pg_table_bloat` | Disabled by default; requires auxiliary view `pg_table_bloat` | +| [`0830-pg_index_bloat.yml`](https://github.com/pgsty/pg_exporter/blob/v1.6.0/config/0830-pg_index_bloat.yml) | `pg_index_bloat` | Disabled by default; requires auxiliary view `pg_index_bloat` | +| [`0910-pgbouncer_list.yml`](https://github.com/pgsty/pg_exporter/blob/v1.6.0/config/0910-pgbouncer_list.yml) | `pgbouncer_list` | PgBouncer list metrics from the admin database | +| [`0920-pgbouncer_database.yml`](https://github.com/pgsty/pg_exporter/blob/v1.6.0/config/0920-pgbouncer_database.yml) | `pgbouncer_database` | PgBouncer database metrics with version-specific branches | +| [`0930-pgbouncer_stat.yml`](https://github.com/pgsty/pg_exporter/blob/v1.6.0/config/0930-pgbouncer_stat.yml) | `pgbouncer_stat` | PgBouncer per-database statistics with version-specific branches | +| [`0940-pgbouncer_pool.yml`](https://github.com/pgsty/pg_exporter/blob/v1.6.0/config/0940-pgbouncer_pool.yml) | `pgbouncer_pool` | PgBouncer pool metrics with version-specific branches | +| [`1000-pg_wait_event.yml`](https://github.com/pgsty/pg_exporter/blob/v1.6.0/config/1000-pg_wait_event.yml) | `pg_wait_event`, `pg_wait_event_1s` | Wait sampling; requires `extension:pg_wait_sampling` | +| [`1800-pg_tsdb_hypertable.yml`](https://github.com/pgsty/pg_exporter/blob/v1.6.0/config/1800-pg_tsdb_hypertable.yml) | `pg_tsdb_hypertable` | Disabled by default; requires TimescaleDB and its information schema | +| [`1900-pg_citus.yml`](https://github.com/pgsty/pg_exporter/blob/v1.6.0/config/1900-pg_citus.yml) | `pg_citus_node` | Citus worker/coordinator inventory; requires `extension:citus` | +| [`2000-pg_heartbeat.yml`](https://github.com/pgsty/pg_exporter/blob/v1.6.0/config/2000-pg_heartbeat.yml) | `pg_heartbeat` | Disabled by default; requires `monitor.heartbeat` in the `postgres` database | {.full-width .wide .expand} +> **v1.6.0:** VACUUM, index-build, and CLUSTER progress remains cluster-wide. `relname` resolves names in the connected database and for system catalogs, and uses numeric OIDs for other databases' relations; discovery filters do not remove this coverage. Existing installations must update their collector YAML. See [progress database scope](/design/progress-database-scope/). + ## Plan Before Enabling The planner selects branches by target type, server version, recovery role, database, extensions, schemas, username, and tags. Predicates run later, when a collector refreshes its results. After the first scrape, inspect the current plan for the main target: diff --git a/content/collectors.zh.md b/content/collectors.zh.md index 139c2d2..363234c 100644 --- a/content/collectors.zh.md +++ b/content/collectors.zh.md @@ -7,11 +7,11 @@ icon: fa-solid fa-table-list categories: [参考] --- -PG Exporter v{{< param version >}} 在 [`config/`](https://github.com/pgsty/pg_exporter/tree/v1.5.0/config) 中提供 **58 个 YAML 文件**(57 个采集器文件和 1 个配置参考文件),`make conf` 按文件名顺序将它们合并为默认的 [`pg_exporter.yml`](https://github.com/pgsty/pg_exporter/blob/v1.5.0/pg_exporter.yml)。 +PG Exporter v{{< param version >}} 在 [`config/`](https://github.com/pgsty/pg_exporter/tree/v1.6.0/config) 中提供 **58 个 YAML 文件**(57 个采集器文件和 1 个配置参考文件),`make conf` 按文件名顺序将它们合并为默认的 [`pg_exporter.yml`](https://github.com/pgsty/pg_exporter/blob/v1.6.0/pg_exporter.yml)。 文件名前缀只负责排序,并不是指标名。一个文件可以为同一指标命名空间定义多个版本或角色分支。PG Exporter 在首次抓取时根据目标实例信息选择符合条件的分支;对真实目标访问 [`GET /explain`](/zh/api/#get-explain),即可查看最终执行计划。 -按指标名称跨版本分支去重,v1.5.0 定义了 **59 个采集器命名空间、460 个指标名**,其中包含默认禁用的采集器和 2 个 `HISTOGRAM` 定义,尚未展开直方图。一次抓取的实际序列数取决于选中的分支、结果行、标签和桶数。 +按指标名称跨版本分支去重,v1.6.0 定义了 **59 个采集器命名空间、460 个指标名**,其中包含默认禁用的采集器和 2 个 `HISTOGRAM` 定义,尚未展开直方图。一次抓取的实际序列数取决于选中的分支、结果行、标签和桶数。 升级 PostgreSQL 或替换采集器配置前,请核对[指标兼容性与迁移对照表](/zh/compatibility/#metric-compatibility)。其中区分 v1.5.0 的标签/状态修正、PG19 的新增指标与语义变化、较早 PostgreSQL 版本已移除的指标,并提供避免告警因时序缺失而静默的检查方法。 @@ -36,66 +36,68 @@ PG Exporter v{{< param version >}} 在 [`config/`](https://github.com/pgsty/pg_e | 文件 | 命名空间 | 范围与前置条件 | |:---|:---|:---| -| [`0000-doc.yml`](https://github.com/pgsty/pg_exporter/blob/v1.5.0/config/0000-doc.yml) | 配置参考 | YAML 模式与采集器编写指南,不包含可执行采集器 | -| [`0110-pg.yml`](https://github.com/pgsty/pg_exporter/blob/v1.5.0/config/0110-pg.yml) | `pg` | 实例基础信息,区分主库与从库分支 | -| [`0120-pg_meta.yml`](https://github.com/pgsty/pg_exporter/blob/v1.5.0/config/0120-pg_meta.yml) | `pg_meta` | 集群元数据;PG13+ 包含 `primary_conninfo` | -| [`0130-pg_setting.yml`](https://github.com/pgsty/pg_exporter/blob/v1.5.0/config/0130-pg_setting.yml) | `pg_setting` | 共享参数与容量上限 | -| [`0210-pg_repl.yml`](https://github.com/pgsty/pg_exporter/blob/v1.5.0/config/0210-pg_repl.yml) | `pg_repl` | 复制发送端统计 | -| [`0220-pg_sync_standby.yml`](https://github.com/pgsty/pg_exporter/blob/v1.5.0/config/0220-pg_sync_standby.yml) | `pg_sync_standby` | 同步备库状态 | -| [`0230-pg_downstream.yml`](https://github.com/pgsty/pg_exporter/blob/v1.5.0/config/0230-pg_downstream.yml) | `pg_downstream` | 下游复制客户端数量 | -| [`0240-pg_slot.yml`](https://github.com/pgsty/pg_exporter/blob/v1.5.0/config/0240-pg_slot.yml) | `pg_slot` | 复制槽;PG16+ 支持备库,PG19 支持新的失效原因 | -| [`0250-pg_recv.yml`](https://github.com/pgsty/pg_exporter/blob/v1.5.0/config/0250-pg_recv.yml) | `pg_recv` | 备库 WAL 接收器;支持 PG19 `connecting` 状态 | -| [`0260-pg_sub.yml`](https://github.com/pgsty/pg_exporter/blob/v1.5.0/config/0260-pg_sub.yml) | `pg_sub` | 订阅统计;PG19 同步错误与冲突计数 | -| [`0270-pg_origin.yml`](https://github.com/pgsty/pg_exporter/blob/v1.5.0/config/0270-pg_origin.yml) | `pg_origin` | 复制源状态;默认禁用,可能需要额外权限 | -| [`0300-pg_io.yml`](https://github.com/pgsty/pg_exporter/blob/v1.5.0/config/0300-pg_io.yml) | `pg_io` | PG16+ 的 `pg_stat_io`,含 PG18+ 分支 | -| [`0310-pg_size.yml`](https://github.com/pgsty/pg_exporter/blob/v1.5.0/config/0310-pg_size.yml) | `pg_size` | 数据库、WAL 与日志大小 | -| [`0320-pg_archiver.yml`](https://github.com/pgsty/pg_exporter/blob/v1.5.0/config/0320-pg_archiver.yml) | `pg_archiver` | 归档进程统计 | -| [`0330-pg_bgwriter.yml`](https://github.com/pgsty/pg_exporter/blob/v1.5.0/config/0330-pg_bgwriter.yml) | `pg_bgwriter` | 后台写进程统计,包含 PG17+ 分支 | -| [`0331-pg_checkpointer.yml`](https://github.com/pgsty/pg_exporter/blob/v1.5.0/config/0331-pg_checkpointer.yml) | `pg_checkpointer` | 检查点进程统计;PG18+ 完成量与 SLRU 计数 | -| [`0340-pg_ssl.yml`](https://github.com/pgsty/pg_exporter/blob/v1.5.0/config/0340-pg_ssl.yml) | `pg_ssl` | SSL 客户端连接数量 | -| [`0350-pg_checkpoint.yml`](https://github.com/pgsty/pg_exporter/blob/v1.5.0/config/0350-pg_checkpoint.yml) | `pg_checkpoint` | 检查点控制信息 | -| [`0355-pg_timeline.yml`](https://github.com/pgsty/pg_exporter/blob/v1.5.0/config/0355-pg_timeline.yml) | `pg_timeline` | 主库或备库的当前时间线 ID | -| [`0360-pg_recovery.yml`](https://github.com/pgsty/pg_exporter/blob/v1.5.0/config/0360-pg_recovery.yml) | `pg_recovery`, `pg_recovery_prefetch` | 备库恢复与恢复预取统计 | -| [`0370-pg_recovery_state.yml`](https://github.com/pgsty/pg_exporter/blob/v1.5.0/config/0370-pg_recovery_state.yml) | `pg_recovery_state` | PG19 备库 `pg_stat_recovery` 恢复状态 | -| [`0380-pg_slru.yml`](https://github.com/pgsty/pg_exporter/blob/v1.5.0/config/0380-pg_slru.yml) | `pg_slru` | PG13+ SLRU 缓存统计 | -| [`0390-pg_shmem.yml`](https://github.com/pgsty/pg_exporter/blob/v1.5.0/config/0390-pg_shmem.yml) | `pg_shmem` | 共享内存分配;默认禁用,要求 `schema:monitor` | -| [`0400-pg_wal.yml`](https://github.com/pgsty/pg_exporter/blob/v1.5.0/config/0400-pg_wal.yml) | `pg_wal` | PG14+ WAL 统计;PG19 增加全页写字节计数 | -| [`0410-pg_activity.yml`](https://github.com/pgsty/pg_exporter/blob/v1.5.0/config/0410-pg_activity.yml) | `pg_activity` | 按数据库与状态统计后端连接 | -| [`0420-pg_wait.yml`](https://github.com/pgsty/pg_exporter/blob/v1.5.0/config/0420-pg_wait.yml) | `pg_wait` | 按等待事件类型统计后端等待 | -| [`0430-pg_backend.yml`](https://github.com/pgsty/pg_exporter/blob/v1.5.0/config/0430-pg_backend.yml) | `pg_backend` | 按 `backend_type` 汇总后端进程 | -| [`0440-pg_xact.yml`](https://github.com/pgsty/pg_exporter/blob/v1.5.0/config/0440-pg_xact.yml) | `pg_xact` | 事务快照边界与活跃事务数量 | -| [`0450-pg_xact_age.yml`](https://github.com/pgsty/pg_exporter/blob/v1.5.0/config/0450-pg_xact_age.yml) | `pg_xact_age` | PG10+ 各数据库未结束事务与事务内空闲的年龄快照直方图 | -| [`0460-pg_lock.yml`](https://github.com/pgsty/pg_exporter/blob/v1.5.0/config/0460-pg_lock.yml) | `pg_lock` | 按数据库与模式统计锁分布 | -| [`0470-pg_lock_stat.yml`](https://github.com/pgsty/pg_exporter/blob/v1.5.0/config/0470-pg_lock_stat.yml) | `pg_lock_stat` | PG19 全局锁等待与快速路径溢出计数 | -| [`0480-pg_query.yml`](https://github.com/pgsty/pg_exporter/blob/v1.5.0/config/0480-pg_query.yml) | `pg_query` | 查询统计;要求 `extension:pg_stat_statements` | -| [`0510-pg_vacuuming.yml`](https://github.com/pgsty/pg_exporter/blob/v1.5.0/config/0510-pg_vacuuming.yml) | `pg_vacuuming` | 仅主库的 VACUUM 进度;PG18+ 包含 `delay_time` | -| [`0520-pg_indexing.yml`](https://github.com/pgsty/pg_exporter/blob/v1.5.0/config/0520-pg_indexing.yml) | `pg_indexing` | 仅主库的 `CREATE INDEX` 进度 | -| [`0530-pg_clustering.yml`](https://github.com/pgsty/pg_exporter/blob/v1.5.0/config/0530-pg_clustering.yml) | `pg_clustering` | 仅主库的 `CLUSTER` 与 `VACUUM FULL` 进度 | -| [`0540-pg_backup.yml`](https://github.com/pgsty/pg_exporter/blob/v1.5.0/config/0540-pg_backup.yml) | `pg_backup` | PG13+ 基础备份进度 | -| [`0610-pg_db.yml`](https://github.com/pgsty/pg_exporter/blob/v1.5.0/config/0610-pg_db.yml) | `pg_db` | 各数据库统计;PG18+ 并行工作进程计数 | -| [`0620-pg_db_confl.yml`](https://github.com/pgsty/pg_exporter/blob/v1.5.0/config/0620-pg_db_confl.yml) | `pg_db_confl` | 备库数据库冲突计数 | -| [`0640-pg_pubrel.yml`](https://github.com/pgsty/pg_exporter/blob/v1.5.0/config/0640-pg_pubrel.yml) | `pg_pubrel` | 发布与发布关系数量 | -| [`0650-pg_subrel.yml`](https://github.com/pgsty/pg_exporter/blob/v1.5.0/config/0650-pg_subrel.yml) | `pg_subrel` | 按状态汇总订阅关系 | -| [`0660-pg_vacuum_score.yml`](https://github.com/pgsty/pg_exporter/blob/v1.5.0/config/0660-pg_vacuum_score.yml) | `pg_vacuum_score` | PG19 主库 `pg_stat_autovacuum_scores` 自动清理评分摘要 | -| [`0700-pg_table.yml`](https://github.com/pgsty/pg_exporter/blob/v1.5.0/config/0700-pg_table.yml) | `pg_table` | 每表统计;PG18+ 维护时间与新页面更新计数 | -| [`0710-pg_index.yml`](https://github.com/pgsty/pg_exporter/blob/v1.5.0/config/0710-pg_index.yml) | `pg_index` | 每索引统计 | -| [`0720-pg_func.yml`](https://github.com/pgsty/pg_exporter/blob/v1.5.0/config/0720-pg_func.yml) | `pg_func` | 函数执行统计 | -| [`0730-pg_seq.yml`](https://github.com/pgsty/pg_exporter/blob/v1.5.0/config/0730-pg_seq.yml) | `pg_seq` | 序列指标 | -| [`0740-pg_relkind.yml`](https://github.com/pgsty/pg_exporter/blob/v1.5.0/config/0740-pg_relkind.yml) | `pg_relkind` | 按关系类型统计对象数量 | -| [`0750-pg_defpart.yml`](https://github.com/pgsty/pg_exporter/blob/v1.5.0/config/0750-pg_defpart.yml) | `pg_defpart` | 默认分区元组数量 | -| [`0810-pg_table_size.yml`](https://github.com/pgsty/pg_exporter/blob/v1.5.0/config/0810-pg_table_size.yml) | `pg_table_size` | 每表大小;在超大模式中可能较慢 | -| [`0820-pg_table_bloat.yml`](https://github.com/pgsty/pg_exporter/blob/v1.5.0/config/0820-pg_table_bloat.yml) | `pg_table_bloat` | 默认禁用;要求辅助视图 `pg_table_bloat` | -| [`0830-pg_index_bloat.yml`](https://github.com/pgsty/pg_exporter/blob/v1.5.0/config/0830-pg_index_bloat.yml) | `pg_index_bloat` | 默认禁用;要求辅助视图 `pg_index_bloat` | -| [`0910-pgbouncer_list.yml`](https://github.com/pgsty/pg_exporter/blob/v1.5.0/config/0910-pgbouncer_list.yml) | `pgbouncer_list` | 从管理数据库获取 PgBouncer 列表指标 | -| [`0920-pgbouncer_database.yml`](https://github.com/pgsty/pg_exporter/blob/v1.5.0/config/0920-pgbouncer_database.yml) | `pgbouncer_database` | PgBouncer 数据库指标,含版本分支 | -| [`0930-pgbouncer_stat.yml`](https://github.com/pgsty/pg_exporter/blob/v1.5.0/config/0930-pgbouncer_stat.yml) | `pgbouncer_stat` | PgBouncer 各数据库统计,含版本分支 | -| [`0940-pgbouncer_pool.yml`](https://github.com/pgsty/pg_exporter/blob/v1.5.0/config/0940-pgbouncer_pool.yml) | `pgbouncer_pool` | PgBouncer 连接池指标,含版本分支 | -| [`1000-pg_wait_event.yml`](https://github.com/pgsty/pg_exporter/blob/v1.5.0/config/1000-pg_wait_event.yml) | `pg_wait_event`, `pg_wait_event_1s` | 等待事件采样;要求 `extension:pg_wait_sampling` | -| [`1800-pg_tsdb_hypertable.yml`](https://github.com/pgsty/pg_exporter/blob/v1.5.0/config/1800-pg_tsdb_hypertable.yml) | `pg_tsdb_hypertable` | 默认禁用;要求 TimescaleDB 及其信息模式 | -| [`1900-pg_citus.yml`](https://github.com/pgsty/pg_exporter/blob/v1.5.0/config/1900-pg_citus.yml) | `pg_citus_node` | Citus 工作节点/协调节点清单;要求 `extension:citus` | -| [`2000-pg_heartbeat.yml`](https://github.com/pgsty/pg_exporter/blob/v1.5.0/config/2000-pg_heartbeat.yml) | `pg_heartbeat` | 默认禁用;要求 `postgres` 库中的 `monitor.heartbeat` 表 | +| [`0000-doc.yml`](https://github.com/pgsty/pg_exporter/blob/v1.6.0/config/0000-doc.yml) | 配置参考 | YAML 模式与采集器编写指南,不包含可执行采集器 | +| [`0110-pg.yml`](https://github.com/pgsty/pg_exporter/blob/v1.6.0/config/0110-pg.yml) | `pg` | 实例基础信息,区分主库与从库分支 | +| [`0120-pg_meta.yml`](https://github.com/pgsty/pg_exporter/blob/v1.6.0/config/0120-pg_meta.yml) | `pg_meta` | 集群元数据;PG13+ 包含 `primary_conninfo` | +| [`0130-pg_setting.yml`](https://github.com/pgsty/pg_exporter/blob/v1.6.0/config/0130-pg_setting.yml) | `pg_setting` | 共享参数与容量上限 | +| [`0210-pg_repl.yml`](https://github.com/pgsty/pg_exporter/blob/v1.6.0/config/0210-pg_repl.yml) | `pg_repl` | 复制发送端统计 | +| [`0220-pg_sync_standby.yml`](https://github.com/pgsty/pg_exporter/blob/v1.6.0/config/0220-pg_sync_standby.yml) | `pg_sync_standby` | 同步备库状态 | +| [`0230-pg_downstream.yml`](https://github.com/pgsty/pg_exporter/blob/v1.6.0/config/0230-pg_downstream.yml) | `pg_downstream` | 下游复制客户端数量 | +| [`0240-pg_slot.yml`](https://github.com/pgsty/pg_exporter/blob/v1.6.0/config/0240-pg_slot.yml) | `pg_slot` | 复制槽;PG16+ 支持备库,PG19 支持新的失效原因 | +| [`0250-pg_recv.yml`](https://github.com/pgsty/pg_exporter/blob/v1.6.0/config/0250-pg_recv.yml) | `pg_recv` | 备库 WAL 接收器;支持 PG19 `connecting` 状态 | +| [`0260-pg_sub.yml`](https://github.com/pgsty/pg_exporter/blob/v1.6.0/config/0260-pg_sub.yml) | `pg_sub` | 订阅统计;PG19 同步错误与冲突计数 | +| [`0270-pg_origin.yml`](https://github.com/pgsty/pg_exporter/blob/v1.6.0/config/0270-pg_origin.yml) | `pg_origin` | 复制源状态;默认禁用,可能需要额外权限 | +| [`0300-pg_io.yml`](https://github.com/pgsty/pg_exporter/blob/v1.6.0/config/0300-pg_io.yml) | `pg_io` | PG16+ 的 `pg_stat_io`,含 PG18+ 分支 | +| [`0310-pg_size.yml`](https://github.com/pgsty/pg_exporter/blob/v1.6.0/config/0310-pg_size.yml) | `pg_size` | 数据库、WAL 与日志大小 | +| [`0320-pg_archiver.yml`](https://github.com/pgsty/pg_exporter/blob/v1.6.0/config/0320-pg_archiver.yml) | `pg_archiver` | 归档进程统计 | +| [`0330-pg_bgwriter.yml`](https://github.com/pgsty/pg_exporter/blob/v1.6.0/config/0330-pg_bgwriter.yml) | `pg_bgwriter` | 后台写进程统计,包含 PG17+ 分支 | +| [`0331-pg_checkpointer.yml`](https://github.com/pgsty/pg_exporter/blob/v1.6.0/config/0331-pg_checkpointer.yml) | `pg_checkpointer` | 检查点进程统计;PG18+ 完成量与 SLRU 计数 | +| [`0340-pg_ssl.yml`](https://github.com/pgsty/pg_exporter/blob/v1.6.0/config/0340-pg_ssl.yml) | `pg_ssl` | SSL 客户端连接数量 | +| [`0350-pg_checkpoint.yml`](https://github.com/pgsty/pg_exporter/blob/v1.6.0/config/0350-pg_checkpoint.yml) | `pg_checkpoint` | 检查点控制信息 | +| [`0355-pg_timeline.yml`](https://github.com/pgsty/pg_exporter/blob/v1.6.0/config/0355-pg_timeline.yml) | `pg_timeline` | 主库或备库的当前时间线 ID | +| [`0360-pg_recovery.yml`](https://github.com/pgsty/pg_exporter/blob/v1.6.0/config/0360-pg_recovery.yml) | `pg_recovery`, `pg_recovery_prefetch` | 备库恢复与恢复预取统计 | +| [`0370-pg_recovery_state.yml`](https://github.com/pgsty/pg_exporter/blob/v1.6.0/config/0370-pg_recovery_state.yml) | `pg_recovery_state` | PG19 备库 `pg_stat_recovery` 恢复状态 | +| [`0380-pg_slru.yml`](https://github.com/pgsty/pg_exporter/blob/v1.6.0/config/0380-pg_slru.yml) | `pg_slru` | PG13+ SLRU 缓存统计 | +| [`0390-pg_shmem.yml`](https://github.com/pgsty/pg_exporter/blob/v1.6.0/config/0390-pg_shmem.yml) | `pg_shmem` | 共享内存分配;默认禁用,要求 `schema:monitor` | +| [`0400-pg_wal.yml`](https://github.com/pgsty/pg_exporter/blob/v1.6.0/config/0400-pg_wal.yml) | `pg_wal` | PG14+ WAL 统计;PG19 增加全页写字节计数 | +| [`0410-pg_activity.yml`](https://github.com/pgsty/pg_exporter/blob/v1.6.0/config/0410-pg_activity.yml) | `pg_activity` | 按数据库与状态统计后端连接 | +| [`0420-pg_wait.yml`](https://github.com/pgsty/pg_exporter/blob/v1.6.0/config/0420-pg_wait.yml) | `pg_wait` | 按等待事件类型统计后端等待 | +| [`0430-pg_backend.yml`](https://github.com/pgsty/pg_exporter/blob/v1.6.0/config/0430-pg_backend.yml) | `pg_backend` | 按 `backend_type` 汇总后端进程 | +| [`0440-pg_xact.yml`](https://github.com/pgsty/pg_exporter/blob/v1.6.0/config/0440-pg_xact.yml) | `pg_xact` | 事务快照边界与活跃事务数量 | +| [`0450-pg_xact_age.yml`](https://github.com/pgsty/pg_exporter/blob/v1.6.0/config/0450-pg_xact_age.yml) | `pg_xact_age` | PG10+ 各数据库未结束事务与事务内空闲的年龄快照直方图 | +| [`0460-pg_lock.yml`](https://github.com/pgsty/pg_exporter/blob/v1.6.0/config/0460-pg_lock.yml) | `pg_lock` | 按数据库与模式统计锁分布 | +| [`0470-pg_lock_stat.yml`](https://github.com/pgsty/pg_exporter/blob/v1.6.0/config/0470-pg_lock_stat.yml) | `pg_lock_stat` | PG19 全局锁等待与快速路径溢出计数 | +| [`0480-pg_query.yml`](https://github.com/pgsty/pg_exporter/blob/v1.6.0/config/0480-pg_query.yml) | `pg_query` | 查询统计;要求 `extension:pg_stat_statements` | +| [`0510-pg_vacuuming.yml`](https://github.com/pgsty/pg_exporter/blob/v1.6.0/config/0510-pg_vacuuming.yml) | `pg_vacuuming` | 仅主库的 VACUUM 进度;PG18+ 包含 `delay_time` | +| [`0520-pg_indexing.yml`](https://github.com/pgsty/pg_exporter/blob/v1.6.0/config/0520-pg_indexing.yml) | `pg_indexing` | 仅主库的 `CREATE INDEX` 进度 | +| [`0530-pg_clustering.yml`](https://github.com/pgsty/pg_exporter/blob/v1.6.0/config/0530-pg_clustering.yml) | `pg_clustering` | 仅主库的 `CLUSTER` 与 `VACUUM FULL` 进度 | +| [`0540-pg_backup.yml`](https://github.com/pgsty/pg_exporter/blob/v1.6.0/config/0540-pg_backup.yml) | `pg_backup` | PG13+ 基础备份进度 | +| [`0610-pg_db.yml`](https://github.com/pgsty/pg_exporter/blob/v1.6.0/config/0610-pg_db.yml) | `pg_db` | 各数据库统计;PG18+ 并行工作进程计数 | +| [`0620-pg_db_confl.yml`](https://github.com/pgsty/pg_exporter/blob/v1.6.0/config/0620-pg_db_confl.yml) | `pg_db_confl` | 备库数据库冲突计数 | +| [`0640-pg_pubrel.yml`](https://github.com/pgsty/pg_exporter/blob/v1.6.0/config/0640-pg_pubrel.yml) | `pg_pubrel` | 发布与发布关系数量 | +| [`0650-pg_subrel.yml`](https://github.com/pgsty/pg_exporter/blob/v1.6.0/config/0650-pg_subrel.yml) | `pg_subrel` | 按状态汇总订阅关系 | +| [`0660-pg_vacuum_score.yml`](https://github.com/pgsty/pg_exporter/blob/v1.6.0/config/0660-pg_vacuum_score.yml) | `pg_vacuum_score` | PG19 主库 `pg_stat_autovacuum_scores` 自动清理评分摘要 | +| [`0700-pg_table.yml`](https://github.com/pgsty/pg_exporter/blob/v1.6.0/config/0700-pg_table.yml) | `pg_table` | 每表统计;PG18+ 维护时间与新页面更新计数 | +| [`0710-pg_index.yml`](https://github.com/pgsty/pg_exporter/blob/v1.6.0/config/0710-pg_index.yml) | `pg_index` | 每索引统计 | +| [`0720-pg_func.yml`](https://github.com/pgsty/pg_exporter/blob/v1.6.0/config/0720-pg_func.yml) | `pg_func` | 函数执行统计 | +| [`0730-pg_seq.yml`](https://github.com/pgsty/pg_exporter/blob/v1.6.0/config/0730-pg_seq.yml) | `pg_seq` | 序列指标 | +| [`0740-pg_relkind.yml`](https://github.com/pgsty/pg_exporter/blob/v1.6.0/config/0740-pg_relkind.yml) | `pg_relkind` | 按关系类型统计对象数量 | +| [`0750-pg_defpart.yml`](https://github.com/pgsty/pg_exporter/blob/v1.6.0/config/0750-pg_defpart.yml) | `pg_defpart` | 默认分区元组数量 | +| [`0810-pg_table_size.yml`](https://github.com/pgsty/pg_exporter/blob/v1.6.0/config/0810-pg_table_size.yml) | `pg_table_size` | 每表大小;在超大模式中可能较慢 | +| [`0820-pg_table_bloat.yml`](https://github.com/pgsty/pg_exporter/blob/v1.6.0/config/0820-pg_table_bloat.yml) | `pg_table_bloat` | 默认禁用;要求辅助视图 `pg_table_bloat` | +| [`0830-pg_index_bloat.yml`](https://github.com/pgsty/pg_exporter/blob/v1.6.0/config/0830-pg_index_bloat.yml) | `pg_index_bloat` | 默认禁用;要求辅助视图 `pg_index_bloat` | +| [`0910-pgbouncer_list.yml`](https://github.com/pgsty/pg_exporter/blob/v1.6.0/config/0910-pgbouncer_list.yml) | `pgbouncer_list` | 从管理数据库获取 PgBouncer 列表指标 | +| [`0920-pgbouncer_database.yml`](https://github.com/pgsty/pg_exporter/blob/v1.6.0/config/0920-pgbouncer_database.yml) | `pgbouncer_database` | PgBouncer 数据库指标,含版本分支 | +| [`0930-pgbouncer_stat.yml`](https://github.com/pgsty/pg_exporter/blob/v1.6.0/config/0930-pgbouncer_stat.yml) | `pgbouncer_stat` | PgBouncer 各数据库统计,含版本分支 | +| [`0940-pgbouncer_pool.yml`](https://github.com/pgsty/pg_exporter/blob/v1.6.0/config/0940-pgbouncer_pool.yml) | `pgbouncer_pool` | PgBouncer 连接池指标,含版本分支 | +| [`1000-pg_wait_event.yml`](https://github.com/pgsty/pg_exporter/blob/v1.6.0/config/1000-pg_wait_event.yml) | `pg_wait_event`, `pg_wait_event_1s` | 等待事件采样;要求 `extension:pg_wait_sampling` | +| [`1800-pg_tsdb_hypertable.yml`](https://github.com/pgsty/pg_exporter/blob/v1.6.0/config/1800-pg_tsdb_hypertable.yml) | `pg_tsdb_hypertable` | 默认禁用;要求 TimescaleDB 及其信息模式 | +| [`1900-pg_citus.yml`](https://github.com/pgsty/pg_exporter/blob/v1.6.0/config/1900-pg_citus.yml) | `pg_citus_node` | Citus 工作节点/协调节点清单;要求 `extension:citus` | +| [`2000-pg_heartbeat.yml`](https://github.com/pgsty/pg_exporter/blob/v1.6.0/config/2000-pg_heartbeat.yml) | `pg_heartbeat` | 默认禁用;要求 `postgres` 库中的 `monitor.heartbeat` 表 | {.full-width .wide .expand} +> **v1.6.0:** VACUUM、建索引与 CLUSTER 进度保持集群级采集;`relname` 在当前连接库及系统目录上解析名称,其他库的关系使用数字 OID,自动发现过滤不影响此覆盖。现有安装需更新采集器 YAML。详见[进度指标的数据库范围](/zh/design/progress-database-scope/)。 + ## 启用前先看计划 规划器根据目标类型、服务器版本、恢复角色、数据库、扩展、模式、用户名和标签筛选分支。谓词查询在之后刷新采集结果时执行。先完成一次抓取,再查看主连接的当前计划: diff --git a/content/compatibility.md b/content/compatibility.md index 4d718b7..6079b5e 100644 --- a/content/compatibility.md +++ b/content/compatibility.md @@ -32,6 +32,21 @@ The v1.5.0 candidate passed default primary collection as a non-superuser on Pos An exporter upgrade and a PostgreSQL major-version upgrade can change different parts of the metric contract. The comparisons below use the bundled SQL collectors at tags [`v1.4.1`](https://github.com/pgsty/pg_exporter/tree/v1.4.1/config) and [`v1.5.0`](https://github.com/pgsty/pg_exporter/tree/v1.5.0/config), including each column's `rename` setting. They describe exported metric names, not just PostgreSQL view columns or YAML filenames. Custom collectors and application-specific alert rules need their own review. +### Exporter v1.5.0 → v1.6.0 {#exporter-160-metrics} + +No built-in SQL metric names, label keys, types, or units change on the same PostgreSQL version. The bundle still has 460 distinct metric definitions. The following behavior and label values do change: + +| Surface | Change | Upgrade action | +|:---|:---|:---| +| `pg_vacuuming_*`, `pg_indexing_*`, `pg_clustering_*` | Foreign-database user relations use numeric OIDs in `relname`; connected-database and system-catalog names still resolve | Deploy the new YAML; retain `datname` and `pid` in dashboards and expect new label values | +| `/up` and role routes | Only health probes update HTTP state after initialization | A reachable target can return 200 even when a fatal collector makes `pg_up 0`; choose the signal appropriate to the alert | +| Scrape error counters | Interrupted passes do not add target errors | Use query-level errors and logs for individual query failures; see [API](/api/) | +| `/metrics` overlap | Two admitted requests; cancelable waiting; excess or expired collection returns 503 | Keep scrapers within the admission limit and check their time budgets | +| PgBouncer pool | Maximum connections increase from one to two | Allow one collection connection and one probe connection | +{.full-width .wide .expand} + +The historical v1.5.0 and PostgreSQL-version migrations below still apply when upgrading from older versions. v1.6.0 does not add the experimental `snort` components. + ### Exporter v1.4.1 → v1.5.0 {#exporter-150-metrics} With the same PostgreSQL version, **no bundled SQL metric names are added, removed, or renamed**, and metric types and units remain unchanged. The following changes still require dashboard and alert review: @@ -144,9 +159,7 @@ Release archives include the binary, merged default config, license, default env ## Container Constraints -The official image is built from `scratch`. It contains the static exporter binary, `/etc/pg_exporter.yml`, and the license, but no shell and no operating-system CA bundle. Mount required CA certificates explicitly when using `sslmode=verify-ca` or `verify-full`. - -This describes the published v1.5.0 image. The [unreleased container correction](/design/container-trust/) adds public CA roots to both build paths and includes the license in ordinary source builds as well. Private CA deployments still need an explicit CA file. +The `scratch` image includes the system CA bundle and license, but no shell. Publicly trusted certificates can use the bundled roots; mount your private CA and set `sslrootcert` when using a private PKI with `sslmode=verify-ca` or `verify-full`. ## Collector-Level Requirements diff --git a/content/compatibility.zh.md b/content/compatibility.zh.md index ed8a532..00c843e 100644 --- a/content/compatibility.zh.md +++ b/content/compatibility.zh.md @@ -32,6 +32,21 @@ v1.5.0 候选已以非超级用户通过 PostgreSQL 9.1–9.6、10–18、19 RC1 升级 Exporter 和升级 PostgreSQL 大版本,可能改变指标契约的不同部分。以下对照以 [`v1.4.1`](https://github.com/pgsty/pg_exporter/tree/v1.4.1/config) 与 [`v1.5.0`](https://github.com/pgsty/pg_exporter/tree/v1.5.0/config) 标签中的内置 SQL 采集器为准,包含各列的 `rename` 映射;列出的是实际导出的指标名,不只是 PostgreSQL 视图列名或 YAML 文件名。自定义采集器与业务告警规则仍需单独检查。 +### Exporter v1.5.0 → v1.6.0 {#exporter-160-metrics} + +在相同 PostgreSQL 版本上,内置 SQL 指标名、标签键、类型与单位不变,仍有 460 个去重指标定义。以下行为与标签取值发生变化: + +| 接口/指标 | 变化 | 升级处理 | +|:---|:---|:---| +| `pg_vacuuming_*`、`pg_indexing_*`、`pg_clustering_*` | 其他数据库的用户关系在 `relname` 中使用数字 OID;当前库与系统目录仍解析名称 | 更新 YAML;面板保留 `datname`、`pid`,接受新的标签取值 | +| `/up` 与角色路由 | 初始化后只由健康探测更新 HTTP 状态 | 数据库可达时可能返回 200,而 fatal 采集器让 `pg_up` 为 0;按告警目的选择信号 | +| 抓取错误计数 | 中断轮次不计作目标错误 | 单个查询失败查看查询级计数与日志,详见 [API](/zh/api/) | +| `/metrics` 并发 | 最多接纳两个请求,等待可取消,超额或采集预算耗尽返回 503 | 控制并发抓取者数量并检查时间预算 | +| PgBouncer 连接池 | 最大连接数由一个增为两个 | 为串行采集与后台探测各留一个连接 | +{.full-width .wide .expand} + +从更早版本升级时,下文 v1.5.0 和 PostgreSQL 大版本迁移规则仍然适用。v1.6.0 不包含 `snort` 的实验组件。 + ### Exporter v1.4.1 → v1.5.0 {#exporter-150-metrics} 保持 PostgreSQL 版本不变时,**内置 SQL 指标没有新增、删除或改名**,指标类型和单位也不变。不过,以下变化仍需检查仪表盘与告警: @@ -144,9 +159,7 @@ groups: ## 容器约束 -官方镜像基于 `scratch` 构建,只包含静态 exporter 二进制、`/etc/pg_exporter.yml` 与许可证;镜像内没有 Shell,也没有操作系统 CA 证书包。使用 `sslmode=verify-ca` 或 `verify-full` 时,需要显式挂载 CA 证书。 - -这里描述的是已发布的 v1.5.0 镜像。[尚未发布的容器修正](/zh/design/container-trust/)为两条构建路径补入公共 CA 根证书,并让普通源码构建也包含许可证。使用私有 CA 的部署仍需显式提供 CA 文件。 +镜像基于 `scratch`,包含系统 CA 证书包与许可证,但没有 shell。公共受信任证书可使用内置根证书;使用私有 CA 且启用 `sslmode=verify-ca` 或 `verify-full` 时,仍需挂载私有 CA 并设置 `sslrootcert`。 ## 采集器级前置条件 diff --git a/content/config.md b/content/config.md index 8e06fde..f588003 100644 --- a/content/config.md +++ b/content/config.md @@ -9,7 +9,7 @@ categories: [Reference] A YAML **collector** defines a SQL query, its metrics, and when to run it. This page describes the configuration used by stable **v{{< param version >}}**. For process flags and environment variables, see [Command Reference](/cmd/). -Load one YAML file or a directory of YAML files. The default `pg_exporter.yml` combines 57 collector files and one schema reference from [`config/`](https://github.com/pgsty/pg_exporter/tree/v1.5.0/config). +Load one YAML file or a directory of YAML files. The default `pg_exporter.yml` combines 57 collector files and one schema reference from [`config/`](https://github.com/pgsty/pg_exporter/tree/v1.6.0/config). ## Configuration Loading @@ -206,7 +206,7 @@ Usage notes: reject the collector result - `scale` is applied to the observation before bucket assignment; as with scalar columns, timestamp and boolean values are exempt from `scale` -- The [`pg_xact_age`](https://github.com/pgsty/pg_exporter/blob/v1.5.0/config/0450-pg_xact_age.yml) +- The [`pg_xact_age`](https://github.com/pgsty/pg_exporter/blob/v1.6.0/config/0450-pg_xact_age.yml) collector in the default bundle serves as the reference implementation For the example above, the 95th percentile is: @@ -252,6 +252,16 @@ the separate `--connect-timeout` flag, measured in milliseconds. Cache TTLs and timeouts reject NaN, infinity, and positive values that overflow Go's `time.Duration`. Cache TTLs remain nonnegative; finite negative timeouts still disable the deadline. +### Request Lifetime + +Since v1.6.0, at most two metrics requests are admitted across collection, waiting, and response writing. Collection is serial; the second request waits within its remaining budget, and further requests receive HTTP 503. The budget is 30 seconds, shortened by a valid positive finite `X-Prometheus-Scrape-Timeout-Seconds` header. A canceled waiter executes no SQL. + +Cancellation stops work before the next collector or database. A started collector with a positive timeout finishes its predicate chain and main SQL within their shared deadline and caches the result normally. A negative timeout removes that deadline: the query then follows request cancellation. An interrupted collection returns 503 if the connection still permits a response. Driver/network delays mean these deadlines are not hard wall-clock limits; configure the DSN `connect_timeout` for connection handshakes. + +An interrupted pass does not increment `pg_exporter_scrape_error_count` or `pg_exporter_server_scrape_error_count`; its summary log is INFO `interrupted`. Query errors and fatal-query ERROR logs remain observable. A real failure coinciding with request cancellation can therefore be omitted from these two pass counters. Without request cancellation, connection/precheck failures and fatal query failures, including their own timeouts, retain their error accounting. Non-fatal failures remain query-level errors. + +Failed refreshes retain the existing failure TTL. In particular, canceling a negative-timeout fatal collector caches a fatal failure: a later live scrape can count that failure and report `pg_up 0` until a successful refresh. Keep a positive timeout on fatal collectors. See [scrape lifetime](/design/scrape-lifetime/) for the rationale. + ### Version Compatibility Control which PostgreSQL versions can run this collector: diff --git a/content/config.zh.md b/content/config.zh.md index bb4e2d9..47200c8 100644 --- a/content/config.zh.md +++ b/content/config.zh.md @@ -9,7 +9,7 @@ categories: [参考] YAML **采集器** 定义 SQL 查询、输出指标和执行条件。本页适用于稳定版 **v{{< param version >}}**。进程参数和环境变量见[命令参考](/zh/cmd/)。 -配置可以是单个 YAML 文件或一个目录。默认 `pg_exporter.yml` 由 [`config/`](https://github.com/pgsty/pg_exporter/tree/v1.5.0/config) 目录下的 57 个采集器文件和 1 个配置参考文件合并而成。 +配置可以是单个 YAML 文件或一个目录。默认 `pg_exporter.yml` 由 [`config/`](https://github.com/pgsty/pg_exporter/tree/v1.6.0/config) 目录下的 57 个采集器文件和 1 个配置参考文件合并而成。 -------- @@ -210,7 +210,7 @@ pg_xact_age: 不要对这些快照序列使用 `rate()` 或 `increase()` - SQL `NULL` 默认不计入观测,配置 `default` 后按默认值计入。没有观测的标签组不输出直方图序列。无法转换的值、NaN 或无穷值会使整个采集器结果失败 - `scale` 在分桶前应用于观测值;与标量列一致,时间戳与布尔值不受 `scale` 影响 -- 默认配置包中的 [`pg_xact_age`](https://github.com/pgsty/pg_exporter/blob/v1.5.0/config/0450-pg_xact_age.yml) 采集器即为参考实现 +- 默认配置包中的 [`pg_xact_age`](https://github.com/pgsty/pg_exporter/blob/v1.6.0/config/0450-pg_xact_age.yml) 采集器即为参考实现 上例的 95 分位数可以这样计算: @@ -250,6 +250,16 @@ timeout: -1 # 关闭该采集器的查询超时 缓存 TTL 和超时配置拒绝 NaN、无穷大以及会使 Go `time.Duration` 溢出的正数。缓存 TTL 仍须非负;有限的负超时仍表示关闭查询期限。 +### 请求生命周期 + +自 v1.6.0 起,采集、等待与响应写入阶段合计最多接纳两个指标请求。采集仍串行;第二个请求在剩余预算内等待,更多请求返回 HTTP 503。预算默认为 30 秒,合法、有限且为正数的 `X-Prometheus-Scrape-Timeout-Seconds` 请求头可以缩短它。等待期间取消的请求不执行 SQL。 + +请求取消后,不再启动下一个采集器或数据库。已启动且 timeout 为正数的采集器,其谓词链与主 SQL 共用同一期限,继续执行并正常缓存结果。负数 timeout 关闭该期限,此时查询随请求取消。中断的采集在连接仍允许响应时返回 503。驱动与网络阻塞意味着这些期限不是硬性的墙钟上限;建连握手需另行设置 DSN 的 `connect_timeout`。 + +中断轮次不增加 `pg_exporter_scrape_error_count` 和 `pg_exporter_server_scrape_error_count`,轮次汇总日志为 INFO `interrupted`;查询错误计数与 fatal 查询的 ERROR 日志仍然保留。因此,恰好与请求取消重叠的真实失败可能不计入这两个轮次计数。请求没有取消时,连接/预检失败和 fatal 查询失败(包括自身超时)仍按错误计数;非 fatal 失败仍体现在查询级计数中。 + +刷新失败沿用原有失败 TTL。尤其是负数 timeout 的 fatal 采集器,被取消后会缓存 fatal 失败;后续有效抓取可能对该失败计数并返回 `pg_up 0`,直到成功刷新。建议 fatal 采集器保留正数 timeout。设计理由见 [采集生命周期](/zh/design/scrape-lifetime/)。 + ### 版本兼容性 控制哪些 PostgreSQL 版本可以运行此采集器: diff --git a/content/deploy.md b/content/deploy.md index c1bef2b..491fe84 100644 --- a/content/deploy.md +++ b/content/deploy.md @@ -164,7 +164,7 @@ services: - ./ca.crt:/run/secrets/pg-ca.crt:ro ``` -The image includes the default collector configuration. To replace it, add a read-only mount at `/etc/pg_exporter.yml`. It is a `scratch` image with no shell or CA bundle, so the CA mount above is required for this TLS example. +The image includes the default collector configuration. To replace it, add a read-only mount at `/etc/pg_exporter.yml`. The `scratch` image includes the system CA bundle and license, but no shell. Publicly trusted certificates can use the bundled roots; mount your private CA and set `sslrootcert` when using a private PKI with `sslmode=verify-ca` or `verify-full`. Check the running container: diff --git a/content/deploy.zh.md b/content/deploy.zh.md index 7989b29..204baff 100644 --- a/content/deploy.zh.md +++ b/content/deploy.zh.md @@ -164,7 +164,7 @@ services: - ./ca.crt:/run/secrets/pg-ca.crt:ro ``` -镜像已内置默认采集配置。需要替换时,将自定义文件只读挂载到 `/etc/pg_exporter.yml`。镜像基于 `scratch`,没有 Shell 和 CA 证书包,因此上面的 TLS 示例需要挂载 CA。 +镜像已内置默认采集配置。需要替换时,将自定义文件只读挂载到 `/etc/pg_exporter.yml`。镜像基于 `scratch`,包含系统 CA 证书包与许可证,但没有 shell。公共受信任证书可使用内置根证书;使用私有 CA 且启用 `sslmode=verify-ca` 或 `verify-full` 时,仍需挂载私有 CA 并设置 `sslrootcert`。 检查容器: diff --git a/content/development.md b/content/development.md index 9d63987..9f8cad3 100644 --- a/content/development.md +++ b/content/development.md @@ -9,7 +9,7 @@ categories: [Guide] PG Exporter keeps SQL and metric definitions in YAML. The Go runtime loads those definitions, collects results, and serves HTTP requests. Start a change in the layer that owns the behavior. -Stable **v{{< param version >}}** is the reference for the user manuals. Development commit `c0ba58a` also contains unreleased Composite, Patroni, pgBackRest, and PostgreSQL log features. Their contracts and status are recorded in [Design](/design/). +Stable **v{{< param version >}}** is the reference for the user manuals. The separate `snort` development branch contains experimental Composite, Patroni, pgBackRest, and PostgreSQL log features; they are absent from `main` and v1.6.0. Their contracts and status are recorded in [Design](/design/). ## Repository Layout @@ -28,7 +28,7 @@ Stable **v{{< param version >}}** is the reference for the user manuals. Develop ## Toolchain -The v1.5.0 tag declares Go **1.27.3**. Use the toolchain required by the revision you build. To build the stable tag: +The v1.6.0 tag declares Go **1.27.3**. Use the toolchain required by the revision you build. To build the stable tag: ```bash git clone --branch v{{< param version >}} https://github.com/pgsty/pg_exporter.git @@ -190,7 +190,7 @@ python3 bin/sync_pg_exporter_content.py \ Compare the generated files with `content/` and apply the relevant changes. Keep the standalone guides and Design archive authored here. -PG Exporter source contributions use [Apache 2.0](https://github.com/pgsty/pg_exporter/blob/v1.5.0/LICENSE). +PG Exporter source contributions use [Apache 2.0](https://github.com/pgsty/pg_exporter/blob/v1.6.0/LICENSE). This site’s original documentation uses [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/). Submit software changes to [pgsty/pg_exporter](https://github.com/pgsty/pg_exporter) and documentation changes to [pgsty/exp.pgsty.com](https://github.com/pgsty/exp.pgsty.com). diff --git a/content/development.zh.md b/content/development.zh.md index 00e5016..16c5282 100644 --- a/content/development.zh.md +++ b/content/development.zh.md @@ -9,7 +9,7 @@ categories: [指南] PG Exporter 将 SQL 和指标定义放在 YAML 中,由 Go 运行时加载定义、采集结果并提供 HTTP 服务。修改功能时,先确定行为由哪一层负责。 -用户手册以稳定版 **v{{< param version >}}** 为准。开发提交 `c0ba58a` 还包含尚未发布的 Composite、Patroni、pgBackRest 和 PostgreSQL 日志功能,其约定与状态见[设计归档](/zh/design/)。 +用户手册以稳定版 **v{{< param version >}}** 为准。独立的 `snort` 开发分支包含实验性的 Composite、Patroni、pgBackRest 和 PostgreSQL 日志功能,`main` 与 v1.6.0 不包含这些功能,其约定与状态见[设计归档](/zh/design/)。 ## 仓库结构 @@ -28,7 +28,7 @@ PG Exporter 将 SQL 和指标定义放在 YAML 中,由 Go 运行时加载定 ## 工具链 -v1.5.0 标签声明 Go **1.27.3**。按所构建版本的要求选择工具链。构建稳定标签: +v1.6.0 标签声明 Go **1.27.3**。按所构建版本的要求选择工具链。构建稳定标签: ```bash git clone --branch v{{< param version >}} https://github.com/pgsty/pg_exporter.git @@ -158,4 +158,4 @@ python3 bin/sync_pg_exporter_content.py \ 对照 `content/` 检查导入结果,只应用相关变更。本站扩展指南和设计归档在本仓库直接维护。 -PG Exporter 源码贡献使用 [Apache 2.0](https://github.com/pgsty/pg_exporter/blob/v1.5.0/LICENSE),本站原创文档使用 [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/)。软件改动提交到 [pgsty/pg_exporter](https://github.com/pgsty/pg_exporter),文档改动提交到 [pgsty/exp.pgsty.com](https://github.com/pgsty/exp.pgsty.com)。 +PG Exporter 源码贡献使用 [Apache 2.0](https://github.com/pgsty/pg_exporter/blob/v1.6.0/LICENSE),本站原创文档使用 [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/)。软件改动提交到 [pgsty/pg_exporter](https://github.com/pgsty/pg_exporter),文档改动提交到 [pgsty/exp.pgsty.com](https://github.com/pgsty/exp.pgsty.com)。 diff --git a/content/install.md b/content/install.md index a20edab..af952af 100644 --- a/content/install.md +++ b/content/install.md @@ -9,6 +9,8 @@ categories: [Reference] Use a Linux package for a managed service, a release archive for a standalone binary, or a container for Docker and Kubernetes. [Download](/download/) compares these options and provides installation commands. This page lists the release files and repository setup. +Repository installation follows the repository’s current package, which can lag the GitHub release. Use the versioned release artifacts below when you need exactly v1.6.0. + ## Pigsty [Pigsty](https://pigsty.io) deploys PG Exporter with metrics storage, alert rules, and Grafana dashboards. The command below downloads Pigsty; follow its [installation guide](https://pigsty.io/docs/setup/install/) to configure and deploy the monitoring stack. @@ -103,11 +105,11 @@ docker run --rm pgsty/pg_exporter:{{< param version >}} --version The image includes `/etc/pg_exporter.yml`. Mount a replacement there for custom collectors. Auto-discovery is already enabled; set `PG_EXPORTER_AUTO_DISCOVERY=false` to disable it. -Use the [Docker deployment example](/deploy/#docker-deployment) to mount the connection secret and start the container. The `scratch` image has no CA bundle; mount a CA file when using `sslmode=verify-ca` or `verify-full`. +Use the [Docker deployment example](/deploy/#docker-deployment) to mount the connection secret and start the container. The `scratch` image includes the system CA bundle and license, but no shell. Publicly trusted certificates can use the bundled roots; mount your private CA and set `sslrootcert` when using a private PKI with `sslmode=verify-ca` or `verify-full`. ## Build from Source -Check out the release tag and use the Go version declared by its `go.mod` (Go 1.27.3 or later for v1.5.0): +Check out the release tag and use the Go version declared by its `go.mod` (Go 1.27.3 or later for v1.6.0): ```bash git clone --depth 1 --branch v{{< param version >}} https://github.com/pgsty/pg_exporter.git pg_exporter-src diff --git a/content/install.zh.md b/content/install.zh.md index 61eacf6..8606a9a 100644 --- a/content/install.zh.md +++ b/content/install.zh.md @@ -9,6 +9,8 @@ categories: [参考] Linux 服务可选择软件包,独立运行可选择发布压缩包,Docker 与 Kubernetes 使用容器镜像。[下载页面](/zh/download/)提供各方式的对照与安装命令,本页列出发布文件和仓库配置。 +软件仓库安装使用仓库当前提供的包,可能晚于 GitHub Release。需要精确安装 v1.6.0 时,使用下方带版本号的发布制品。 + ## Pigsty [Pigsty](https://pigsty.cc) 将 PG Exporter 与指标存储、告警规则和 Grafana 仪表盘一起部署。以下命令下载 Pigsty;随后按[安装指南](https://pigsty.cc/docs/setup/install/)配置并部署监控栈。 @@ -102,11 +104,11 @@ docker run --rm pgsty/pg_exporter:{{< param version >}} --version 镜像内置 `/etc/pg_exporter.yml`,自定义采集器可挂载到该路径。自动发现默认启用,设置 `PG_EXPORTER_AUTO_DISCOVERY=false` 即可关闭。 -按 [Docker 部署示例](/zh/deploy/#docker-部署)挂载连接密钥并启动容器。镜像基于 `scratch`,没有 CA 证书包;使用 `sslmode=verify-ca` 或 `verify-full` 时,需挂载 CA 文件。 +按 [Docker 部署示例](/zh/deploy/#docker-部署)挂载连接密钥并启动容器。镜像基于 `scratch`,包含系统 CA 证书包与许可证,但没有 shell。公共受信任证书可使用内置根证书;使用私有 CA 且启用 `sslmode=verify-ca` 或 `verify-full` 时,仍需挂载私有 CA 并设置 `sslrootcert`。 ## 从源码构建 -检出发布标签,使用其 `go.mod` 声明的 Go 版本(v1.5.0 要求 Go 1.27.3 或更高版本): +检出发布标签,使用其 `go.mod` 声明的 Go 版本(v1.6.0 要求 Go 1.27.3 或更高版本): ```bash git clone --depth 1 --branch v{{< param version >}} https://github.com/pgsty/pg_exporter.git pg_exporter-src diff --git a/content/intro.md b/content/intro.md index fa34dae..0a9ed03 100644 --- a/content/intro.md +++ b/content/intro.md @@ -29,7 +29,7 @@ The exporter also reports its own state. For example, `pg_up` reports whether th ## Customize collection -Start with the bundled configuration, [`pg_exporter.yml`](https://github.com/pgsty/pg_exporter/blob/v1.5.0/pg_exporter.yml). Add queries when you need more metrics. Each collector can have its own selection conditions, timeout, and cache TTL. +Start with the bundled configuration, [`pg_exporter.yml`](https://github.com/pgsty/pg_exporter/blob/v1.6.0/pg_exporter.yml). Add queries when you need more metrics. Each collector can have its own selection conditions, timeout, and cache TTL. After you change the configuration, reload it through `/reload`. The exporter checks the new configuration before it replaces the current configuration. You do not need to compile or restart the program. diff --git a/content/intro.zh.md b/content/intro.zh.md index f117ff1..618ec1e 100644 --- a/content/intro.zh.md +++ b/content/intro.zh.md @@ -29,7 +29,7 @@ Prometheus 请求 `/metrics` 时,导出器执行选中的查询并返回指标 ## 自定义采集 -先使用内置配置 [`pg_exporter.yml`](https://github.com/pgsty/pg_exporter/blob/v1.5.0/pg_exporter.yml),需要更多指标时再添加查询。每个采集器都可以单独设置选择条件、超时与缓存 TTL。 +先使用内置配置 [`pg_exporter.yml`](https://github.com/pgsty/pg_exporter/blob/v1.6.0/pg_exporter.yml),需要更多指标时再添加查询。每个采集器都可以单独设置选择条件、超时与缓存 TTL。 修改配置后,通过 `/reload` 重载。导出器先检查新配置,再替换当前配置,无需重新编译或重启程序。 diff --git a/content/security.md b/content/security.md index 67485c7..209acf0 100644 --- a/content/security.md +++ b/content/security.md @@ -34,7 +34,7 @@ CREATE ROLE monitor GRANT pg_monitor TO monitor; ``` -On PostgreSQL 10–13, the default v1.5.0 subscription collector also needs this column grant in the exporter’s **main connection database**, not merely in the databases owning subscriptions: +On PostgreSQL 10–13, the default v1.6.0 subscription collector also needs this column grant in the exporter’s **main connection database**, not merely in the databases owning subscriptions: ```sql GRANT SELECT (oid) ON pg_catalog.pg_subscription TO monitor; @@ -101,7 +101,7 @@ export PG_EXPORTER_URL='postgres://monitor@db.example.com:5432/postgres?sslmode= `verify-full` checks both the certificate chain and the hostname. Use a hostname listed in the server certificate. `require` encrypts the connection but does not check the hostname. -The official Docker image is based on `scratch` and has no system CA bundle. Mount the required CA file into the container and reference that exact path in `sslrootcert`. +The `scratch` image includes the system CA bundle and license, but no shell. Publicly trusted certificates can use the bundled roots; mount your private CA and set `sslrootcert` when using a private PKI with `sslmode=verify-ca` or `verify-full`. ## Minimize HTTP Exposure @@ -169,4 +169,4 @@ See [Production Deployment](/deploy/) for service examples and [Troubleshooting] ## Toolchain security updates -v1.5.0 uses Go 1.27.3 and refreshed modules, including `x/net` 0.61.0. The [release security notes](/release/v1.5.0/#security-updates) list the fixed CVEs and distinguish static symbol/package matches from unimported module advisories. Upgrade the rebuilt binary as well as its collector configuration; updating the host compiler alone does not repair an existing binary. +v1.6.0 uses Go 1.27.3 and refreshed modules, including `x/net` 0.62.0. It retains the security fixes documented for v1.5.0. The [release security notes](/release/v1.5.0/#security-updates) list the fixed CVEs and distinguish static symbol/package matches from unimported module advisories. Upgrade the rebuilt binary as well as its collector configuration; updating the host compiler alone does not repair an existing binary. diff --git a/content/security.zh.md b/content/security.zh.md index 4a1a3ee..d51cae5 100644 --- a/content/security.zh.md +++ b/content/security.zh.md @@ -34,7 +34,7 @@ CREATE ROLE monitor GRANT pg_monitor TO monitor; ``` -PostgreSQL 10–13 的 v1.5.0 默认订阅采集器还需要在 Exporter 的 **主连接数据库** 中执行以下列级授权,不能只在订阅所属数据库授权: +PostgreSQL 10–13 的 v1.6.0 默认订阅采集器还需要在 Exporter 的 **主连接数据库** 中执行以下列级授权,不能只在订阅所属数据库授权: ```sql GRANT SELECT (oid) ON pg_catalog.pg_subscription TO monitor; @@ -101,7 +101,7 @@ export PG_EXPORTER_URL='postgres://monitor@db.example.com:5432/postgres?sslmode= `verify-full` 同时验证证书链与主机名,URL 中的主机名必须与服务器证书匹配。`require` 加密连接,但不校验主机名。 -官方 Docker 镜像基于 `scratch`,没有系统 CA 包。请将所需 CA 文件挂载进容器,并在 `sslrootcert` 中引用精确路径。 +镜像基于 `scratch`,包含系统 CA 证书包与许可证,但没有 shell。公共受信任证书可使用内置根证书;使用私有 CA 且启用 `sslmode=verify-ca` 或 `verify-full` 时,仍需挂载私有 CA 并设置 `sslrootcert`。 ## 缩小 HTTP 暴露面 @@ -169,4 +169,4 @@ curl --cacert /etc/prometheus/ca/pg_exporter-ca.crt \ ## 工具链安全更新 -v1.5.0 使用 Go 1.27.3 与更新后的依赖,包括 `x/net` 0.61.0。[发布安全说明](/zh/release/v1.5.0/#安全更新)列出了纳入的 CVE 修复,并区分静态符号/包匹配与未导入模块的公告。升级时替换重新构建的二进制及配套采集器配置;仅更新主机编译器不会修复已有二进制。 +v1.6.0 使用 Go 1.27.3 与更新后的依赖,包括 `x/net` 0.62.0,并保留 v1.5.0 已记录的安全修复。[发布安全说明](/zh/release/v1.5.0/#安全更新)列出了纳入的 CVE 修复,并区分静态符号/包匹配与未导入模块的公告。升级时替换重新构建的二进制及配套采集器配置;仅更新主机编译器不会修复已有二进制。 diff --git a/content/troubleshooting.md b/content/troubleshooting.md index 43903f5..5dc2d8c 100644 --- a/content/troubleshooting.md +++ b/content/troubleshooting.md @@ -137,6 +137,14 @@ Run the collector SQL manually as the monitoring user in the same database. Pres ## Scrapes Are Slow or Time Out +Since v1.6.0, at most two metrics requests are admitted across collection, waiting, and response writing. Collection is serial; the second request waits within its remaining budget, and further requests receive HTTP 503. The budget is 30 seconds, shortened by a valid positive finite `X-Prometheus-Scrape-Timeout-Seconds` header. A canceled waiter executes no SQL. + +Cancellation stops work before the next collector or database. A started collector with a positive timeout finishes its predicate chain and main SQL within their shared deadline and caches the result normally. A negative timeout removes that deadline: the query then follows request cancellation. An interrupted collection returns 503 if the connection still permits a response. Driver/network delays mean these deadlines are not hard wall-clock limits; configure the DSN `connect_timeout` for connection handshakes. + +An interrupted pass does not increment `pg_exporter_scrape_error_count` or `pg_exporter_server_scrape_error_count`; its summary log is INFO `interrupted`. Query errors and fatal-query ERROR logs remain observable. A real failure coinciding with request cancellation can therefore be omitted from these two pass counters. Without request cancellation, connection/precheck failures and fatal query failures, including their own timeouts, retain their error accounting. Non-fatal failures remain query-level errors. + +Failed refreshes retain the existing failure TTL. In particular, canceling a negative-timeout fatal collector caches a fatal failure: a later live scrape can count that failure and report `pg_up 0` until a successful refresh. Keep a positive timeout on fatal collectors. See [scrape lifetime](/design/scrape-lifetime/) for the rationale. + `/stat` reports query durations in milliseconds for the main target. `pg_exporter_query_scrape_duration` reports seconds for each `datname` and `query`. Error counts are available in both; error text is in the logs. Typical remedies: @@ -168,7 +176,7 @@ Collector YAML can also be reloaded with `SIGHUP`; Unix builds additionally acce | Symptom | Likely cause and fix | |:---|:---| -| TLS verification fails in Docker | `scratch` image has no CA bundle; mount the CA and set `sslrootcert` | +| TLS verification fails in Docker | v1.6.0 includes public CA roots; check hostname/trust and mount your private CA with `sslrootcert` when needed | | `.pgpass` is ignored in packaged service | Check the `prometheus` account home or `PGPASSFILE`; give the service user ownership and use mode `0600` | | RPM automation cannot find v1.4.1 artifact | Artifact prefix changed from `pg_exporter` to `pg-exporter` | | Config edits disappear after container replacement | Mount `/etc/pg_exporter.yml` from durable configuration | diff --git a/content/troubleshooting.zh.md b/content/troubleshooting.zh.md index 192334b..4936a6c 100644 --- a/content/troubleshooting.zh.md +++ b/content/troubleshooting.zh.md @@ -137,6 +137,14 @@ pg_exporter_query_scrape_error_count > 0 ## 抓取缓慢或超时 +自 v1.6.0 起,采集、等待与响应写入阶段合计最多接纳两个指标请求。采集仍串行;第二个请求在剩余预算内等待,更多请求返回 HTTP 503。预算默认为 30 秒,合法、有限且为正数的 `X-Prometheus-Scrape-Timeout-Seconds` 请求头可以缩短它。等待期间取消的请求不执行 SQL。 + +请求取消后,不再启动下一个采集器或数据库。已启动且 timeout 为正数的采集器,其谓词链与主 SQL 共用同一期限,继续执行并正常缓存结果。负数 timeout 关闭该期限,此时查询随请求取消。中断的采集在连接仍允许响应时返回 503。驱动与网络阻塞意味着这些期限不是硬性的墙钟上限;建连握手需另行设置 DSN 的 `connect_timeout`。 + +中断轮次不增加 `pg_exporter_scrape_error_count` 和 `pg_exporter_server_scrape_error_count`,轮次汇总日志为 INFO `interrupted`;查询错误计数与 fatal 查询的 ERROR 日志仍然保留。因此,恰好与请求取消重叠的真实失败可能不计入这两个轮次计数。请求没有取消时,连接/预检失败和 fatal 查询失败(包括自身超时)仍按错误计数;非 fatal 失败仍体现在查询级计数中。 + +刷新失败沿用原有失败 TTL。尤其是负数 timeout 的 fatal 采集器,被取消后会缓存 fatal 失败;后续有效抓取可能对该失败计数并返回 `pg_up 0`,直到成功刷新。建议 fatal 采集器保留正数 timeout。设计理由见 [采集生命周期](/zh/design/scrape-lifetime/)。 + `/stat` 以毫秒显示主目标各查询的耗时;`pg_exporter_query_scrape_duration` 按 `datname`、`query` 标签以秒报告耗时。两者都提供错误次数,具体错误内容在日志中。 常见处理顺序: @@ -168,7 +176,7 @@ curl -i -X POST http://127.0.0.1:9630/reload | 现象 | 可能原因与修复 | |:---|:---| -| Docker 中 TLS 校验失败 | `scratch` 镜像没有 CA 包;挂载 CA 并设置 `sslrootcert` | +| Docker 中 TLS 校验失败 | v1.6.0 包含公共 CA 根证书;检查主机名与信任链,私有 CA 仍需挂载并设置 `sslrootcert` | | 软件包服务忽略 `.pgpass` | 检查 `prometheus` 的主目录或 `PGPASSFILE`,将文件归属服务用户并设为 `0600` | | RPM 自动化找不到 v1.4.1 产物 | 产物前缀从 `pg_exporter` 改为 `pg-exporter` | | 容器替换后配置修改消失 | 将 `/etc/pg_exporter.yml` 从持久配置挂载 | diff --git a/data/download/pg-exporter.yaml b/data/download/pg-exporter.yaml index 8514df5..debfe06 100644 --- a/data/download/pg-exporter.yaml +++ b/data/download/pg-exporter.yaml @@ -137,13 +137,13 @@ channels: url: https://hub.docker.com/r/pgsty/pg_exporter note: >- A multi-architecture amd64/arm64 image. It is a scratch image: it carries - the static binary, the merged config, and the license, but no shell and no - operating-system CA bundle, so mount a CA explicitly for `verify-full`. + the static binary, the merged config, the license, and the system CA bundle, + but no shell. Mount a private CA and set `sslrootcert` for private PKI. Replace `postgres` in the example URL with a hostname reachable from the container, and set the monitoring credentials. note_zh: >- - 多架构 amd64/arm64 镜像。它基于 scratch 构建,只包含静态二进制、合并配置与许可证, - 没有 shell 也没有系统 CA 证书;使用 `verify-full` 时请显式挂载 CA。 + 多架构 amd64/arm64 镜像。它基于 scratch 构建,包含静态二进制、合并配置、许可证与系统 CA 证书, + 没有 shell;使用私有 CA 时仍需挂载证书并设置 `sslrootcert`。 将示例 URL 中的 `postgres` 替换为容器可达的数据库主机名,并设置监控凭据。 steps: - title: Run a pinned image @@ -229,15 +229,15 @@ channels: 发布压缩包、软件包及其 SHA-256 摘要。在 macOS 上使用 `shasum -a 256 <文件>` 与对应条目比对。 checksums: | - 4cb1dfbbc6d22101d43e0841f6d5d86042a15f3894bd6e935151a1b94b94b980 pg-exporter-1.5.0-1.aarch64.rpm - c7efed8ab2062b873c87664987d73b8ff37fde89943b98a7f1967aef7961f7eb pg-exporter-1.5.0-1.ppc64le.rpm - 6788c7cbb83e4708199f00a1ddf8057f74ba3606e28e3aa26eeaf1a453a1e1b3 pg-exporter-1.5.0-1.x86_64.rpm - 91f705bbeba67a6a4c4e6a4595efb3d214f787d38d7e310c3121a594ecdce28f pg-exporter_1.5.0-1_amd64.deb - 75dd27cdd734a84d703d594d0b4173d21ff302c95cb04320da528f8789f147bd pg-exporter_1.5.0-1_arm64.deb - f41acf7693172d5e843df2c5e49e5173e74f9519f84b5453b0dcfa834c1efaf1 pg-exporter_1.5.0-1_ppc64le.deb - f3e5d03d3c3ca7df5e50e017e1c18ec78ccdc099f610296f674349acc1466975 pg_exporter-1.5.0.darwin-amd64.tar.gz - 3fb47e285c2700227b0437c827fdbf0d87a93e24befb5e94f439082073700e8d pg_exporter-1.5.0.darwin-arm64.tar.gz - e372f6defb844b4bfbe3286b40dba3d4aae2ce72c4bed9980e3b9a56507aef56 pg_exporter-1.5.0.linux-amd64.tar.gz - 19f34db9e034d1437791af52676cf32e60a669d4a5036e0cc3efbe14efb61cde pg_exporter-1.5.0.linux-arm64.tar.gz - aef7e910480656ddc744c4d6f1cdb3448299e6c63a469d9110fdf280d0c15ac2 pg_exporter-1.5.0.linux-ppc64le.tar.gz - cf39b3ecfeeac7d088e348ab24e717e600e3f61c98611b0815fb18fef1db1d9f pg_exporter-1.5.0.windows-amd64.tar.gz + 1bb4bfeb40f215a6ad3998d4399b12074bacfe03920a38784599b04eb1ca3028 pg-exporter-1.6.0-1.aarch64.rpm + 87b248e8eab5e872146c63e7c8fff86eb8f4dcd4db5505957aff2e17043bd3a2 pg-exporter-1.6.0-1.ppc64le.rpm + 955ee5549aebc347fa1bd4e0517812c687d037faf17054a678fbc5bfffc4eb03 pg-exporter-1.6.0-1.x86_64.rpm + 448c9dfc738e1425ace8cafdf44bbc677c2aee21fb89ec49faec5a8d6b3c35ef pg-exporter_1.6.0-1_amd64.deb + e10a3823b2fb30c44eba1d6b1f833af3244a2451221c8d65071eaad32673c001 pg-exporter_1.6.0-1_arm64.deb + 61bc7efd5ac9a7a3bef2860a67bfa1ee0b379a09e85389ca75306aec3dee209a pg-exporter_1.6.0-1_ppc64le.deb + f7a57acb1ccd9fd074e6a41a8811ae0fc482a7d8db34aec508415ff0ee93f5b2 pg_exporter-1.6.0.darwin-amd64.tar.gz + 6c8e475ba675fa86921c07e5031db8073ddd012f198e88f66548be0d246baab7 pg_exporter-1.6.0.darwin-arm64.tar.gz + e392328ca27fd7a84e3273f2cfe70d28d2e7f162dcc735fb9fb96182368a59e3 pg_exporter-1.6.0.linux-amd64.tar.gz + 3795371d53388757778eea180ea91e71e51945a4864ccef315a93a230d8729fe pg_exporter-1.6.0.linux-arm64.tar.gz + ec2b7c7419a6f111494ccc777cfb86825e421b0f494aa68623e05e3c31d681f4 pg_exporter-1.6.0.linux-ppc64le.tar.gz + 92fc6b5e58fcaa120473f59856874b8a44ea0e7388d417c5de0fbc709d6687f2 pg_exporter-1.6.0.windows-amd64.tar.gz diff --git a/data/home/en.yaml b/data/home/en.yaml index 3df446d..485582c 100644 --- a/data/home/en.yaml +++ b/data/home/en.yaml @@ -13,7 +13,7 @@ hero: eyebrow: PostgreSQL + PgBouncer → Prometheus title: PG Exporter desc: 'Export PostgreSQL and PgBouncer metrics to Prometheus. Define collectors in YAML and SQL. PG Exporter selects queries for the target version, role, and installed extensions.' - note: v1.5.0 · 460 metric definitions · PostgreSQL and PgBouncer + note: v1.6.0 · 460 metric definitions · PostgreSQL and PgBouncer actions: - label: Download url: download/ @@ -26,7 +26,7 @@ hero: image: light: img/architecture-light.svg dark: img/architecture-dark.svg - alt: 'PG Exporter v1.5.0: each process collects one PostgreSQL instance or PgBouncer target and serves metrics to Prometheus or VictoriaMetrics' + alt: 'PG Exporter v1.6.0: each process collects one PostgreSQL instance or PgBouncer target and serves metrics to Prometheus or VictoriaMetrics' media: ratio: 1fr 0.94fr max_width: 500px diff --git a/data/home/metrics.yaml b/data/home/metrics.yaml index 6a613cf..10080c3 100644 --- a/data/home/metrics.yaml +++ b/data/home/metrics.yaml @@ -1,4 +1,4 @@ -# Product facts verified against pg_exporter v1.5.0 (1891254) on 2026-10-23. +# Product facts verified against pg_exporter v1.6.0 source (6bee809) on 2026-11-09. # These values describe the configuration, not the output of one scrape. # Count distinct _ for GAUGE, # COUNTER, and HISTOGRAM columns in the tagged pg_exporter.yml. Each SQL @@ -13,9 +13,9 @@ collector_files: 58 # Version branches in the stable configuration; not a future-version guarantee. postgres_range: "10-19" -# One release article per Git tag, in each language. -tagged_versions: 36 +# Release articles prepared for the stable version, in each language. +tagged_versions: 37 # Keep params.version, download checksums, homepage notes, and quick-start # VERSION examples in sync. Landing YAML does not interpolate Hugo params. -release_version: "v1.5.0" +release_version: "v1.6.0" diff --git a/data/home/zh.yaml b/data/home/zh.yaml index 52bc521..20b998e 100644 --- a/data/home/zh.yaml +++ b/data/home/zh.yaml @@ -13,7 +13,7 @@ hero: eyebrow: PostgreSQL + PgBouncer → Prometheus title: PG Exporter desc: '将 PostgreSQL 与 PgBouncer 指标导出到 Prometheus。用 YAML 和 SQL 定义采集器,PG Exporter 根据目标版本、角色与已安装的扩展选择查询。' - note: v1.5.0 · 460 指标定义 · PostgreSQL 与 PgBouncer + note: v1.6.0 · 460 指标定义 · PostgreSQL 与 PgBouncer actions: - label: 下载安装 url: download/ @@ -26,7 +26,7 @@ hero: image: light: img/architecture-zh-light.svg dark: img/architecture-zh-dark.svg - alt: 'PG Exporter v1.5.0:每个进程采集一个 PostgreSQL 实例或 PgBouncer 目标,通过 /metrics 供 Prometheus 或 VictoriaMetrics 抓取' + alt: 'PG Exporter v1.6.0:每个进程采集一个 PostgreSQL 实例或 PgBouncer 目标,通过 /metrics 供 Prometheus 或 VictoriaMetrics 抓取' media: ratio: 1fr 0.94fr max_width: 500px diff --git a/data/landing/download/en.yaml b/data/landing/download/en.yaml index a7d965c..b89de2b 100644 --- a/data/landing/download/en.yaml +++ b/data/landing/download/en.yaml @@ -9,7 +9,7 @@ hero: title: Install PG Exporter desc: Use a package for a Linux service, an archive for a standalone binary, or a container image. Pigsty installs the exporter as part of a monitoring stack. - note: v1.5.0 · Linux · macOS · Windows · amd64 / arm64 / ppc64le + note: v1.6.0 · Linux · macOS · Windows · amd64 / arm64 / ppc64le note_icon: fa-solid fa-box-archive align: center title_size: 3.4rem diff --git a/data/landing/download/zh.yaml b/data/landing/download/zh.yaml index d91ca1c..08abd17 100644 --- a/data/landing/download/zh.yaml +++ b/data/landing/download/zh.yaml @@ -8,7 +8,7 @@ hero: eyebrow: 下载 title: 安装 PG Exporter desc: Linux 服务可选择软件包,独立运行可选择压缩包或容器镜像。Pigsty 会随监控栈一起安装导出器。 - note: v1.5.0 · Linux · macOS · Windows · amd64 / arm64 / ppc64le + note: v1.6.0 · Linux · macOS · Windows · amd64 / arm64 / ppc64le note_icon: fa-solid fa-box-archive align: center title_size: 3.4rem diff --git a/data/landing/start/en.yaml b/data/landing/start/en.yaml index 4406a58..63f7a22 100644 --- a/data/landing/start/en.yaml +++ b/data/landing/start/en.yaml @@ -44,7 +44,7 @@ install: desc: Download and install the binary and its collector configuration. body: | ```bash {copy="all"} - VERSION=1.5.0 + VERSION=1.6.0 ARCHIVE="pg_exporter-${VERSION}.linux-amd64.tar.gz" curl -fLO "https://github.com/pgsty/pg_exporter/releases/download/v${VERSION}/$ARCHIVE" && curl -fLO "https://github.com/pgsty/pg_exporter/releases/download/v${VERSION}/checksums.txt" && @@ -56,7 +56,7 @@ install: pg_exporter --version ``` - The checksum result is `OK`. The installed version is `v1.5.0`. + The checksum result is `OK`. The installed version is `v1.6.0`. Other platforms and package installation commands are on the [download page](/download/). monitoring-user: diff --git a/data/landing/start/zh.yaml b/data/landing/start/zh.yaml index 1861202..826e8eb 100644 --- a/data/landing/start/zh.yaml +++ b/data/landing/start/zh.yaml @@ -43,7 +43,7 @@ install: desc: 下载并安装程序与采集器配置。 body: | ```bash {copy="all"} - VERSION=1.5.0 + VERSION=1.6.0 ARCHIVE="pg_exporter-${VERSION}.linux-amd64.tar.gz" curl -fLO "https://github.com/pgsty/pg_exporter/releases/download/v${VERSION}/$ARCHIVE" && curl -fLO "https://github.com/pgsty/pg_exporter/releases/download/v${VERSION}/checksums.txt" && @@ -55,7 +55,7 @@ install: pg_exporter --version ``` - 校验结果应为 `OK`,安装后的版本应为 `v1.5.0`。 + 校验结果应为 `OK`,安装后的版本应为 `v1.6.0`。 其他平台与软件包安装方式见[下载页](/zh/download/)。 monitoring-user: diff --git a/hugo.yaml b/hugo.yaml index cebf3d2..35f24a0 100644 --- a/hugo.yaml +++ b/hugo.yaml @@ -288,7 +288,7 @@ params: images: - img/pg-exporter-social-card.png logo: img/pg-exporter.png - version: 1.5.0 + version: 1.6.0 metric_definitions: 460 collector_files: 58 tagged_versions: 36 diff --git a/static/img/architecture-dark.svg b/static/img/architecture-dark.svg index 55e4ba9..080a334 100644 --- a/static/img/architecture-dark.svg +++ b/static/img/architecture-dark.svg @@ -1 +1 @@ -PG Exporter v1.5.0: each process collects one PostgreSQL instance or PgBouncer target and serves metrics on :9630/metrics for Prometheus or VictoriaMetrics.ONE TARGET PER PROCESSEXPORTERSCRAPED BYscrapedeclarativePostgreSQLSQL · lib/pqPgBouncerSHOW · adminPG Exportercollectors · YAML + SQLplanner · version + rolecache · TTL + timeout:9630 · /metrics/explain · /stat · /reloadPrometheuspull · scrape_intervalVictoriaMetricsPromQL / MetricsQLpg_exporter.yml58 files · 460 definitions +PG Exporter v1.6.0: each process collects one PostgreSQL instance or PgBouncer target and serves metrics on :9630/metrics for Prometheus or VictoriaMetrics.ONE TARGET PER PROCESSEXPORTERSCRAPED BYscrapedeclarativePostgreSQLSQL · lib/pqPgBouncerSHOW · adminPG Exportercollectors · YAML + SQLplanner · version + rolecache · TTL + timeout:9630 · /metrics/explain · /stat · /reloadPrometheuspull · scrape_intervalVictoriaMetricsPromQL / MetricsQLpg_exporter.yml58 files · 460 definitions diff --git a/static/img/architecture-light.svg b/static/img/architecture-light.svg index 49dbaab..dc436cb 100644 --- a/static/img/architecture-light.svg +++ b/static/img/architecture-light.svg @@ -1 +1 @@ -PG Exporter v1.5.0: each process collects one PostgreSQL instance or PgBouncer target and serves metrics on :9630/metrics for Prometheus or VictoriaMetrics.ONE TARGET PER PROCESSEXPORTERSCRAPED BYscrapedeclarativePostgreSQLSQL · lib/pqPgBouncerSHOW · adminPG Exportercollectors · YAML + SQLplanner · version + rolecache · TTL + timeout:9630 · /metrics/explain · /stat · /reloadPrometheuspull · scrape_intervalVictoriaMetricsPromQL / MetricsQLpg_exporter.yml58 files · 460 definitions +PG Exporter v1.6.0: each process collects one PostgreSQL instance or PgBouncer target and serves metrics on :9630/metrics for Prometheus or VictoriaMetrics.ONE TARGET PER PROCESSEXPORTERSCRAPED BYscrapedeclarativePostgreSQLSQL · lib/pqPgBouncerSHOW · adminPG Exportercollectors · YAML + SQLplanner · version + rolecache · TTL + timeout:9630 · /metrics/explain · /stat · /reloadPrometheuspull · scrape_intervalVictoriaMetricsPromQL / MetricsQLpg_exporter.yml58 files · 460 definitions diff --git a/static/img/architecture-zh-dark.svg b/static/img/architecture-zh-dark.svg index 3a61602..776f59a 100644 --- a/static/img/architecture-zh-dark.svg +++ b/static/img/architecture-zh-dark.svg @@ -1 +1 @@ -PG Exporter v1.5.0:每个进程采集一个 PostgreSQL 实例或 PgBouncer 目标,通过 :9630/metrics 供 Prometheus 或 VictoriaMetrics 抓取。每个进程连接一个目标导出器抓取方抓取声明式PostgreSQLSQL · lib/pqPgBouncerSHOW · 管理台PG Exporter采集器 · YAML + SQL规划器 · 版本 + 角色缓存 · TTL + 超时:9630 · /metrics/explain · /stat · /reloadPrometheus拉取 · 定期抓取VictoriaMetricsPromQL / MetricsQLpg_exporter.yml58 个文件 · 460 个指标定义 +PG Exporter v1.6.0:每个进程采集一个 PostgreSQL 实例或 PgBouncer 目标,通过 :9630/metrics 供 Prometheus 或 VictoriaMetrics 抓取。每个进程连接一个目标导出器抓取方抓取声明式PostgreSQLSQL · lib/pqPgBouncerSHOW · 管理台PG Exporter采集器 · YAML + SQL规划器 · 版本 + 角色缓存 · TTL + 超时:9630 · /metrics/explain · /stat · /reloadPrometheus拉取 · 定期抓取VictoriaMetricsPromQL / MetricsQLpg_exporter.yml58 个文件 · 460 个指标定义 diff --git a/static/img/architecture-zh-light.svg b/static/img/architecture-zh-light.svg index e4861ce..e178493 100644 --- a/static/img/architecture-zh-light.svg +++ b/static/img/architecture-zh-light.svg @@ -1 +1 @@ -PG Exporter v1.5.0:每个进程采集一个 PostgreSQL 实例或 PgBouncer 目标,通过 :9630/metrics 供 Prometheus 或 VictoriaMetrics 抓取。每个进程连接一个目标导出器抓取方抓取声明式PostgreSQLSQL · lib/pqPgBouncerSHOW · 管理台PG Exporter采集器 · YAML + SQL规划器 · 版本 + 角色缓存 · TTL + 超时:9630 · /metrics/explain · /stat · /reloadPrometheus拉取 · 定期抓取VictoriaMetricsPromQL / MetricsQLpg_exporter.yml58 个文件 · 460 个指标定义 +PG Exporter v1.6.0:每个进程采集一个 PostgreSQL 实例或 PgBouncer 目标,通过 :9630/metrics 供 Prometheus 或 VictoriaMetrics 抓取。每个进程连接一个目标导出器抓取方抓取声明式PostgreSQLSQL · lib/pqPgBouncerSHOW · 管理台PG Exporter采集器 · YAML + SQL规划器 · 版本 + 角色缓存 · TTL + 超时:9630 · /metrics/explain · /stat · /reloadPrometheus拉取 · 定期抓取VictoriaMetricsPromQL / MetricsQLpg_exporter.yml58 个文件 · 460 个指标定义