跳转到主要内容

pg_datasentinel

PostgreSQL 可观测性与活动监控扩展

pg_datasentinel · PostgreSQL 可观测性与活动监控扩展

概览

ID扩展软件包版本类别许可证编程语言
6400pg_datasentinelpg_datasentinel1.0STATBSD-3-ClauseC
属性可执行文件动态库需要预加载需要建扩展可迁移可信
--sLd--否是是是否否
shared_preload_libraries = pg_datasentinel is required because the extension allocates shared memory and hooks into activity logging.

软件包

类型仓库版本兼容的 PostgreSQL 大版本包名模式依赖
EXTPIGSTY1.019 18 17 16 15pg_datasentinel-
RPMPIGSTY1.019 18 17 16 15pg_datasentinel_$v-
DEBPIGSTY1.019 18 17 16 15postgresql-$v-pg-datasentinel-
Linux / PGPG19PG18PG17PG16PG15
el8.x86_64N/APIGSTY 1.0PIGSTY 1.0PIGSTY 1.0PIGSTY 1.0
el8.aarch64N/APIGSTY 1.0PIGSTY 1.0PIGSTY 1.0PIGSTY 1.0
el9.x86_64N/APIGSTY 1.0PIGSTY 1.0PIGSTY 1.0PIGSTY 1.0
el9.aarch64N/APIGSTY 1.0PIGSTY 1.0PIGSTY 1.0PIGSTY 1.0
el10.x86_64N/APIGSTY 1.0PIGSTY 1.0PIGSTY 1.0PIGSTY 1.0
el10.aarch64N/APIGSTY 1.0PIGSTY 1.0PIGSTY 1.0PIGSTY 1.0
d12.x86_64N/APIGSTY 1.0PIGSTY 1.0PIGSTY 1.0PIGSTY 1.0
d12.aarch64N/APIGSTY 1.0PIGSTY 1.0PIGSTY 1.0PIGSTY 1.0
d13.x86_64N/APIGSTY 1.0PIGSTY 1.0PIGSTY 1.0PIGSTY 1.0
d13.aarch64N/APIGSTY 1.0PIGSTY 1.0PIGSTY 1.0PIGSTY 1.0
u22.x86_64N/APIGSTY 1.0PIGSTY 1.0PIGSTY 1.0PIGSTY 1.0
u22.aarch64N/APIGSTY 1.0PIGSTY 1.0PIGSTY 1.0PIGSTY 1.0
u24.x86_64N/APIGSTY 1.0PIGSTY 1.0PIGSTY 1.0PIGSTY 1.0
u24.aarch64N/APIGSTY 1.0PIGSTY 1.0PIGSTY 1.0PIGSTY 1.0
u26.x86_64N/APIGSTY 1.0PIGSTY 1.0PIGSTY 1.0PIGSTY 1.0
u26.aarch64N/APIGSTY 1.0PIGSTY 1.0PIGSTY 1.0PIGSTY 1.0
软件包版本平台仓库大小下载
pg_datasentinel_181.0el8.x86_64pigsty67.6 KiBpg_datasentinel_18-1.0-1PGSTY.el8.x86_64.rpm
pg_datasentinel_181.0el8.aarch64pigsty66.9 KiBpg_datasentinel_18-1.0-1PGSTY.el8.aarch64.rpm
pg_datasentinel_181.0el9.x86_64pigsty68.6 KiBpg_datasentinel_18-1.0-1PGSTY.el9.x86_64.rpm
pg_datasentinel_181.0el9.aarch64pigsty69.0 KiBpg_datasentinel_18-1.0-1PGSTY.el9.aarch64.rpm
pg_datasentinel_181.0el10.x86_64pigsty69.3 KiBpg_datasentinel_18-1.0-1PGSTY.el10.x86_64.rpm
pg_datasentinel_181.0el10.aarch64pigsty69.8 KiBpg_datasentinel_18-1.0-1PGSTY.el10.aarch64.rpm
postgresql-18-pg-datasentinel1.0d12.x86_64pigsty59.0 KiBpostgresql-18-pg-datasentinel_1.0-1PGSTY~bookworm_amd64.deb
postgresql-18-pg-datasentinel1.0d12.aarch64pigsty59.1 KiBpostgresql-18-pg-datasentinel_1.0-1PGSTY~bookworm_arm64.deb
postgresql-18-pg-datasentinel1.0d13.x86_64pigsty59.2 KiBpostgresql-18-pg-datasentinel_1.0-1PGSTY~trixie_amd64.deb
postgresql-18-pg-datasentinel1.0d13.aarch64pigsty59.2 KiBpostgresql-18-pg-datasentinel_1.0-1PGSTY~trixie_arm64.deb
postgresql-18-pg-datasentinel1.0u22.x86_64pigsty63.3 KiBpostgresql-18-pg-datasentinel_1.0-1PGSTY~jammy_amd64.deb
postgresql-18-pg-datasentinel1.0u22.aarch64pigsty63.8 KiBpostgresql-18-pg-datasentinel_1.0-1PGSTY~jammy_arm64.deb
postgresql-18-pg-datasentinel1.0u24.x86_64pigsty61.5 KiBpostgresql-18-pg-datasentinel_1.0-1PGSTY~noble_amd64.deb
postgresql-18-pg-datasentinel1.0u24.aarch64pigsty62.4 KiBpostgresql-18-pg-datasentinel_1.0-1PGSTY~noble_arm64.deb
postgresql-18-pg-datasentinel1.0u26.x86_64pigsty61.3 KiBpostgresql-18-pg-datasentinel_1.0-1PGSTY~resolute_amd64.deb
postgresql-18-pg-datasentinel1.0u26.aarch64pigsty61.6 KiBpostgresql-18-pg-datasentinel_1.0-1PGSTY~resolute_arm64.deb
软件包版本平台仓库大小下载
pg_datasentinel_171.0el8.x86_64pigsty67.5 KiBpg_datasentinel_17-1.0-1PGSTY.el8.x86_64.rpm
pg_datasentinel_171.0el8.aarch64pigsty66.9 KiBpg_datasentinel_17-1.0-1PGSTY.el8.aarch64.rpm
pg_datasentinel_171.0el9.x86_64pigsty68.5 KiBpg_datasentinel_17-1.0-1PGSTY.el9.x86_64.rpm
pg_datasentinel_171.0el9.aarch64pigsty69.1 KiBpg_datasentinel_17-1.0-1PGSTY.el9.aarch64.rpm
pg_datasentinel_171.0el10.x86_64pigsty69.3 KiBpg_datasentinel_17-1.0-1PGSTY.el10.x86_64.rpm
pg_datasentinel_171.0el10.aarch64pigsty69.8 KiBpg_datasentinel_17-1.0-1PGSTY.el10.aarch64.rpm
postgresql-17-pg-datasentinel1.0d12.x86_64pigsty58.9 KiBpostgresql-17-pg-datasentinel_1.0-1PGSTY~bookworm_amd64.deb
postgresql-17-pg-datasentinel1.0d12.aarch64pigsty59.0 KiBpostgresql-17-pg-datasentinel_1.0-1PGSTY~bookworm_arm64.deb
postgresql-17-pg-datasentinel1.0d13.x86_64pigsty59.1 KiBpostgresql-17-pg-datasentinel_1.0-1PGSTY~trixie_amd64.deb
postgresql-17-pg-datasentinel1.0d13.aarch64pigsty59.2 KiBpostgresql-17-pg-datasentinel_1.0-1PGSTY~trixie_arm64.deb
postgresql-17-pg-datasentinel1.0u22.x86_64pigsty72.0 KiBpostgresql-17-pg-datasentinel_1.0-1PGSTY~jammy_amd64.deb
postgresql-17-pg-datasentinel1.0u22.aarch64pigsty72.5 KiBpostgresql-17-pg-datasentinel_1.0-1PGSTY~jammy_arm64.deb
postgresql-17-pg-datasentinel1.0u24.x86_64pigsty61.5 KiBpostgresql-17-pg-datasentinel_1.0-1PGSTY~noble_amd64.deb
postgresql-17-pg-datasentinel1.0u24.aarch64pigsty62.4 KiBpostgresql-17-pg-datasentinel_1.0-1PGSTY~noble_arm64.deb
postgresql-17-pg-datasentinel1.0u26.x86_64pigsty61.3 KiBpostgresql-17-pg-datasentinel_1.0-1PGSTY~resolute_amd64.deb
postgresql-17-pg-datasentinel1.0u26.aarch64pigsty61.6 KiBpostgresql-17-pg-datasentinel_1.0-1PGSTY~resolute_arm64.deb
软件包版本平台仓库大小下载
pg_datasentinel_161.0el8.x86_64pigsty67.5 KiBpg_datasentinel_16-1.0-1PGSTY.el8.x86_64.rpm
pg_datasentinel_161.0el8.aarch64pigsty66.9 KiBpg_datasentinel_16-1.0-1PGSTY.el8.aarch64.rpm
pg_datasentinel_161.0el9.x86_64pigsty68.4 KiBpg_datasentinel_16-1.0-1PGSTY.el9.x86_64.rpm
pg_datasentinel_161.0el9.aarch64pigsty69.1 KiBpg_datasentinel_16-1.0-1PGSTY.el9.aarch64.rpm
pg_datasentinel_161.0el10.x86_64pigsty69.3 KiBpg_datasentinel_16-1.0-1PGSTY.el10.x86_64.rpm
pg_datasentinel_161.0el10.aarch64pigsty69.8 KiBpg_datasentinel_16-1.0-1PGSTY.el10.aarch64.rpm
postgresql-16-pg-datasentinel1.0d12.x86_64pigsty58.9 KiBpostgresql-16-pg-datasentinel_1.0-1PGSTY~bookworm_amd64.deb
postgresql-16-pg-datasentinel1.0d12.aarch64pigsty59.0 KiBpostgresql-16-pg-datasentinel_1.0-1PGSTY~bookworm_arm64.deb
postgresql-16-pg-datasentinel1.0d13.x86_64pigsty59.1 KiBpostgresql-16-pg-datasentinel_1.0-1PGSTY~trixie_amd64.deb
postgresql-16-pg-datasentinel1.0d13.aarch64pigsty59.1 KiBpostgresql-16-pg-datasentinel_1.0-1PGSTY~trixie_arm64.deb
postgresql-16-pg-datasentinel1.0u22.x86_64pigsty71.5 KiBpostgresql-16-pg-datasentinel_1.0-1PGSTY~jammy_amd64.deb
postgresql-16-pg-datasentinel1.0u22.aarch64pigsty72.1 KiBpostgresql-16-pg-datasentinel_1.0-1PGSTY~jammy_arm64.deb
postgresql-16-pg-datasentinel1.0u24.x86_64pigsty61.6 KiBpostgresql-16-pg-datasentinel_1.0-1PGSTY~noble_amd64.deb
postgresql-16-pg-datasentinel1.0u24.aarch64pigsty62.4 KiBpostgresql-16-pg-datasentinel_1.0-1PGSTY~noble_arm64.deb
postgresql-16-pg-datasentinel1.0u26.x86_64pigsty61.3 KiBpostgresql-16-pg-datasentinel_1.0-1PGSTY~resolute_amd64.deb
postgresql-16-pg-datasentinel1.0u26.aarch64pigsty61.6 KiBpostgresql-16-pg-datasentinel_1.0-1PGSTY~resolute_arm64.deb
软件包版本平台仓库大小下载
pg_datasentinel_151.0el8.x86_64pigsty67.6 KiBpg_datasentinel_15-1.0-1PGSTY.el8.x86_64.rpm
pg_datasentinel_151.0el8.aarch64pigsty66.9 KiBpg_datasentinel_15-1.0-1PGSTY.el8.aarch64.rpm
pg_datasentinel_151.0el9.x86_64pigsty68.8 KiBpg_datasentinel_15-1.0-1PGSTY.el9.x86_64.rpm
pg_datasentinel_151.0el9.aarch64pigsty69.3 KiBpg_datasentinel_15-1.0-1PGSTY.el9.aarch64.rpm
pg_datasentinel_151.0el10.x86_64pigsty69.7 KiBpg_datasentinel_15-1.0-1PGSTY.el10.x86_64.rpm
pg_datasentinel_151.0el10.aarch64pigsty69.9 KiBpg_datasentinel_15-1.0-1PGSTY.el10.aarch64.rpm
postgresql-15-pg-datasentinel1.0d12.x86_64pigsty59.2 KiBpostgresql-15-pg-datasentinel_1.0-1PGSTY~bookworm_amd64.deb
postgresql-15-pg-datasentinel1.0d12.aarch64pigsty59.2 KiBpostgresql-15-pg-datasentinel_1.0-1PGSTY~bookworm_arm64.deb
postgresql-15-pg-datasentinel1.0d13.x86_64pigsty59.3 KiBpostgresql-15-pg-datasentinel_1.0-1PGSTY~trixie_amd64.deb
postgresql-15-pg-datasentinel1.0d13.aarch64pigsty59.4 KiBpostgresql-15-pg-datasentinel_1.0-1PGSTY~trixie_arm64.deb
postgresql-15-pg-datasentinel1.0u22.x86_64pigsty71.8 KiBpostgresql-15-pg-datasentinel_1.0-1PGSTY~jammy_amd64.deb
postgresql-15-pg-datasentinel1.0u22.aarch64pigsty72.3 KiBpostgresql-15-pg-datasentinel_1.0-1PGSTY~jammy_arm64.deb
postgresql-15-pg-datasentinel1.0u24.x86_64pigsty61.8 KiBpostgresql-15-pg-datasentinel_1.0-1PGSTY~noble_amd64.deb
postgresql-15-pg-datasentinel1.0u24.aarch64pigsty62.7 KiBpostgresql-15-pg-datasentinel_1.0-1PGSTY~noble_arm64.deb
postgresql-15-pg-datasentinel1.0u26.x86_64pigsty61.6 KiBpostgresql-15-pg-datasentinel_1.0-1PGSTY~resolute_amd64.deb
postgresql-15-pg-datasentinel1.0u26.aarch64pigsty61.8 KiBpostgresql-15-pg-datasentinel_1.0-1PGSTY~resolute_arm64.deb

源码

pig build pkg pg_datasentinel;		# build rpm/deb

安装

启用 PGDG 和 PIGSTY 仓库并更新缓存。

pig repo add pgsql -u   # add both repo and update cache

使用 pig 安装扩展。

pig install pg_datasentinel;		# install by package name

pig install pg_datasentinel -v 18;   # install for PG 18
pig install pg_datasentinel -v 17;   # install for PG 17
pig install pg_datasentinel -v 16;   # install for PG 16
pig install pg_datasentinel -v 15;   # install for PG 15

将扩展加入 shared_preload_libraries,详见配置说明。

shared_preload_libraries = 'pg_datasentinel';

在数据库中创建扩展。

CREATE EXTENSION pg_datasentinel;

用法

来源:README,1.0 发行版

pg_datasentinel 在 PostgreSQL 的活动、维护、临时文件、检查点、事务回卷与容器资源数据之上提供可观测性视图。由于它会分配共享内存并挂接活动日志记录,因此必须预加载。

所需设置

-- postgresql.conf
shared_preload_libraries = 'pg_datasentinel'
log_autovacuum_min_duration = 0
log_temp_files = 0
log_checkpoints = on

CREATE EXTENSION pg_datasentinel;

主要视图

  • ds_stat_activity:在 pg_stat_activity 基础上扩展后端 RSS、可选 PSS、临时文件字节数,以及 PostgreSQL 18+ 上的 plan_id。
  • ds_container_resources:报告 cgroup CPU 与内存限制,以及当前使用量。
  • ds_wraparound_risk:基于每小时快照估算距离激进清理与事务回卷的 XID、MXID 预计时间。
  • ds_xid_snapshots:ds_wraparound_risk 使用的原始快照历史。
  • ds_vacuum_activity、ds_analyze_activity、ds_tempfile_activity、ds_checkpoint_activity:用于维护与检查点事件的共享内存环形缓冲区。
  • ds_activity_summary:返回环形缓冲区占用和时间戳的一行汇总。

常用 GUCs

  • pg_datasentinel.enabled:启用或禁用采集。
  • pg_datasentinel.max_entries:每类活动流的环形缓冲区容量;修改后需要重启。
  • pg_datasentinel.maintenance_force_verbose:为手工 VACUUM 与 ANALYZE 添加 VERBOSE,以便被捕获。
  • pg_datasentinel.ignore_system_schemas:抑制 pg_catalog 与 information_schema 噪声。
  • pg_datasentinel.enable_pss_memory:读取 /proc/*/smaps_rollup 以获取每个后端的 PSS。

注意事项

  • 上游要求 PostgreSQL 15+。
  • 内存与临时文件增强信息依赖 Linux /proc;容器指标依赖 cgroups。
  • VACUUM 与 ANALYZE 的解析依赖英文日志关键字,因此不完全支持已翻译的服务器消息区域设置。
  • plan_id 仅在 PostgreSQL 18+ 上填充,并且与 README 中链接的官方 pg_store_plans 分支搭配时最有价值。

表格阅读器