# @christiangalsterer/pg-promise-prometheus-exporter 中文文档

规范地址：https://npmcn.com/package/%40christiangalsterer/pg-promise-prometheus-exporter/

版本：2\.2\.0
npm 元数据更新时间：2024-07-21T08:00:00.164Z
中文译文更新时间：2026-11-09T15:01:40.740Z
软件包许可：MIT

本文由上游 README 翻译，可能存在偏差，请结合原文核对 API、命令与配置。版权与许可归原作者所有。

原始 npm 页面：https://www.npmjs.com/package/%40christiangalsterer/pg-promise-prometheus-exporter
原文对照：https://npmcn.com/package/%40christiangalsterer/pg-promise-prometheus-exporter/?lang=original
项目主页：https://github.com/christiangalsterer/pg-promise-prometheus-exporter#readme
源码仓库：https://github.com/christiangalsterer/pg-promise-prometheus-exporter

## 关键信息（来自 npm 元数据）

- 包体积（解压后）：48.7 kB，18 个文件
- 模块格式：CommonJS
- TypeScript 类型：包内自带
- Node.js 要求：\>=18
- 运行依赖：3 个
- 首次发布：2024-02-08T09:30:07.328Z
- 最新版本发布：2024-07-21T07:59:59.897Z
- 近 30 天下载量：23998（2026-10-10 至 2026-11-08，npm 官方下载统计）
- 已发布版本数：6（近 12 个月 0 个）

## 中文简介

Pg- 保证的相模导出器

## 安装

```sh
npm install @christiangalsterer/pg-promise-prometheus-exporter
```

也可以使用：`pnpm add @christiangalsterer/pg-promise-prometheus-exporter`、`yarn add @christiangalsterer/pg-promise-prometheus-exporter`、`bun add @christiangalsterer/pg-promise-prometheus-exporter`

## README

[![GitHub Actions CI Status](https://github.com/christiangalsterer/pg-promise-prometheus-exporter/actions/workflows/build.yaml/badge.svg)](https://github.com/christiangalsterer/pg-promise-prometheus-exporter/actions/workflows/build.yaml) [![codecov](https://codecov.io/gh/christiangalsterer/pg-promise-prometheus-exporter/graph/badge.svg?token=HD9IKRQN04)](https://codecov.io/gh/christiangalsterer/pg-promise-prometheus-exporter) [![Coverage Status](https://coveralls.io/repos/github/christiangalsterer/pg-promise-prometheus-exporter/badge.svg?branch=main)](https://coveralls.io/github/christiangalsterer/pg-promise-prometheus-exporter?branch=main) [![Known Vulnerabilities](https://snyk.io/test/github/christiangalsterer/pg-promise-prometheus-exporter/badge.svg)](https://github.com/christiangalsterer/pg-promise-prometheus-exporter/security/advisories) [![npm downloads](https://img.shields.io/npm/dt/@christiangalsterer/pg-promise-prometheus-exporter.svg)](https://www.npmjs.com/package/@christiangalsterer/pg-promise-prometheus-exporter) [![npm version](https://img.shields.io/npm/v/@christiangalsterer/pg-promise-prometheus-exporter.svg)](https://www.npmjs.com/package/@christiangalsterer/pg-promise-prometheus-exporter?activeTab=versions) [![npm license](https://img.shields.io/npm/l/@christiangalsterer/pg-promise-prometheus-exporter.svg)](https://www.npmjs.com/package/@christiangalsterer/pg-promise-prometheus-exporter) [![semver](https://img.shields.io/badge/semver-2.0.0-green)](https://semver.org/) [![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg)](https://conventionalcommits.org/) [![renovate](https://img.shields.io/badge/renovate-enabled-brightgreen.svg)](https://developer.mend.io/github/christiangalsterer/pg-promise-prometheus-exporter) [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier) ![github stars](https://img.shields.io/github/stars/christiangalsterer/pg-promise-prometheus-exporter.svg)

# Pg 保证的Prometheus导出器

月球导出器 显示度量衡 [pg - 保证](https://www.npmjs.com/package/pg-promise)。 。 。 .

## 可用计量

由于出口商正在使用 [节点出口商](https://github.com/christiangalsterer/node-postgres-prometheus-exporter) 请检查url=值 (帮助) [文档](https://github.com/christiangalsterer/node-postgres-prometheus-exporter?tab=readme-ov-file#available-metrics) 用于衡量标准清单.

单位 **添加数** 出口商提供以下衡量标准.

| 计量名称 | 说明 | 标签 | 自兹 |
| --- | --- | --- | --- |
| pg command dult seconds bucket (中文(简体) ) | 执行命令的持续时间( 以秒计) | 
-   _东道主_: 数据库的主机
-   _数据库_: 数据库名称
-   _命令_: 命令名称
-   _状态_: 意外或错误



 | 2.0.0 (韩语) |
| pg command 期限 秒 和 | 执行命令的累计时间( 秒) | 

-   _东道主_: 数据库的主机
-   _数据库_: 数据库名称
-   _命令_: 命令名称
-   _状态_: 意外或错误



 | 2.0.0 (韩语) |
| pg 命令 长度 秒 计数 | 已执行命令的数目 | 

-   _东道主_: 数据库的主机
-   _数据库_: 数据库名称
-   _命令_: 命令名称
-   _状态_: 意外或错误



 | 2.0.0 (韩语) |
| 任务 期限 秒 桶 | 执行任务持续时间( 秒) | 

-   _东道主_: 数据库的主机
-   _数据库_: 数据库名称
-   _任务_: 执行任务时提供的标签 . **说明:** 该标签只有在是有效的标签值时才会被添加.



 | 2.0.0 (韩语) |
| pg 任务 期限 秒 和 | 已执行任务的累计时间( 秒) | 

-   _东道主_: 数据库的主机
-   _数据库_: 数据库名称
-   _任务_: 执行任务时提供的标签 . **说明:** 该标签只有在是有效的标签值时才会被添加.



 | 2.0.0 (韩语) |
| 任务 期限 秒 计数 | 执行的任务数目 | 

-   _东道主_: 数据库的主机
-   _数据库_: 数据库名称
-   _任务_: 执行任务时提供的标签 . **说明:** 该标签只有在是有效的标签值时才会被添加.



 | 2.0.0 (韩语) |
| 页:1 | 已执行交易持续时间( 秒) | 

-   _东道主_: 数据库的主机
-   _数据库_: 数据库名称
-   _交易_: 执行交易时提供的标签 . **说明:** 该标签只有在是有效的标签值时才会被添加.



 | 2.0.0 (韩语) |
| pg 交易 期限 秒 和 | 已执行交易的累计时间(以秒计) | 

-   _东道主_: 数据库的主机
-   _数据库_: 数据库名称
-   _交易_: 执行交易时提供的标签 . **说明:** 该标签只有在是有效的标签值时才会被添加.



 | 2.0.0 (韩语) |
| pg 交易 期限 秒 计数 | 已执行交易数目 | 

-   _东道主_: 数据库的主机
-   _数据库_: 数据库名称
-   _交易_: 执行交易时提供的标签 . **说明:** 该标签只有在是有效的标签值时才会被添加.



 | 2.0.0 (韩语) |

## 示例输出

这里举出一个实例,以提供的度量符的正方形格式输出.

```sh
# HELP pg_client_errors_total The total number of connection errors with a database.
# TYPE pg_client_errors_total counter
pg_client_errors_total{host="localhost:5432",database="node_postgres_test1"} 1

# HELP pg_client_disconnects_total The total number of disconnected connections.
# TYPE pg_client_disconnects_total counter
pg_client_disconnects_total{host="localhost:5432",database="node_postgres_test1"} 1

# HELP pg_pool_connections_created_total The total number of created connections.
# TYPE pg_pool_connections_created_total counter
pg_pool_connections_created_total{host="localhost:5432",database="node_postgres_test1"} 19

# HELP pg_pool_size The current size of the connection pool, including active and idle members.
# TYPE pg_pool_size gauge
pg_pool_size{host="localhost:5432",database="node_postgres_test1"} 10

# HELP pg_pool_max The maximum size of the connection pool.
# TYPE pg_pool_max gauge
pg_pool_max{host="localhost:5432",database="node_postgres_test1"} 10

# HELP pg_pool_active_connections The total number of active connections.
# TYPE pg_pool_active_connections gauge
pg_pool_active_connections{host="localhost:5432",database="node_postgres_test1"} 10

# HELP pg_pool_waiting_connections The total number of waiting connections.
# TYPE pg_pool_waiting_connections gauge
pg_pool_waiting_connections{host="localhost:5432",database="node_postgres_test1"} 1

# HELP pg_pool_idle_connections The total number of idle connections.
# TYPE pg_pool_idle_connections gauge
pg_pool_idle_connections{host="localhost:5432",database="node_postgres_test1"} 0

# HELP pg_pool_errors_total The total number of connection errors with a database.
# TYPE pg_pool_errors_total counter
pg_pool_errors_total{host="localhost:5432",database="node_postgres_test1"} 1

# HELP pg_pool_connections_removed_total The total number of removed connections.
# TYPE pg_pool_connections_removed_total counter
pg_pool_connections_removed_total{host="localhost:5432",database="node_postgres_test1"} 9

# HELP pg_command_duration_seconds Timer of pg commands
# TYPE pg_command_duration_seconds histogram
pg_command_duration_seconds_bucket{le="0.001",host="localhost:5432",database="node_postgres_test1",command="SELECT",status="SUCCESS"} 0
pg_command_duration_seconds_bucket{le="0.005",host="localhost:5432",database="node_postgres_test1",command="SELECT",status="SUCCESS"} 0
pg_command_duration_seconds_bucket{le="0.01",host="localhost:5432",database="node_postgres_test1",command="SELECT",status="SUCCESS"} 0
pg_command_duration_seconds_bucket{le="0.02",host="localhost:5432",database="node_postgres_test1",command="SELECT",status="SUCCESS"} 0
pg_command_duration_seconds_bucket{le="0.03",host="localhost:5432",database="node_postgres_test1",command="SELECT",status="SUCCESS"} 0
pg_command_duration_seconds_bucket{le="0.04",host="localhost:5432",database="node_postgres_test1",command="SELECT",status="SUCCESS"} 0
pg_command_duration_seconds_bucket{le="0.05",host="localhost:5432",database="node_postgres_test1",command="SELECT",status="SUCCESS"} 21
pg_command_duration_seconds_bucket{le="0.1",host="localhost:5432",database="node_postgres_test1",command="SELECT",status="SUCCESS"} 31
pg_command_duration_seconds_bucket{le="0.2",host="localhost:5432",database="node_postgres_test1",command="SELECT",status="SUCCESS"} 38
pg_command_duration_seconds_bucket{le="0.5",host="localhost:5432",database="node_postgres_test1",command="SELECT",status="SUCCESS"} 40
pg_command_duration_seconds_bucket{le="1",host="localhost:5432",database="node_postgres_test1",command="SELECT",status="SUCCESS"} 40
pg_command_duration_seconds_bucket{le="2",host="localhost:5432",database="node_postgres_test1",command="SELECT",status="SUCCESS"} 40
pg_command_duration_seconds_bucket{le="5",host="localhost:5432",database="node_postgres_test1",command="SELECT",status="SUCCESS"} 40
pg_command_duration_seconds_bucket{le="10",host="localhost:5432",database="node_postgres_test1",command="SELECT",status="SUCCESS"} 40
pg_command_duration_seconds_bucket{le="+Inf",host="localhost:5432",database="node_postgres_test1",command="SELECT",status="SUCCESS"} 40
pg_command_duration_seconds_sum{host="localhost:5432",database="node_postgres_test1",command="SELECT",status="SUCCESS"} 3.475
pg_command_duration_seconds_count{host="localhost:5432",database="node_postgres_test1",command="SELECT",status="SUCCESS"} 40
pg_command_duration_seconds_bucket{le="0.001",host="localhost:5432",database="node_postgres_test1",command="BEGIN",status="SUCCESS"} 0
pg_command_duration_seconds_bucket{le="0.005",host="localhost:5432",database="node_postgres_test1",command="BEGIN",status="SUCCESS"} 0
pg_command_duration_seconds_bucket{le="0.01",host="localhost:5432",database="node_postgres_test1",command="BEGIN",status="SUCCESS"} 0
pg_command_duration_seconds_bucket{le="0.02",host="localhost:5432",database="node_postgres_test1",command="BEGIN",status="SUCCESS"} 0
pg_command_duration_seconds_bucket{le="0.03",host="localhost:5432",database="node_postgres_test1",command="BEGIN",status="SUCCESS"} 0
pg_command_duration_seconds_bucket{le="0.04",host="localhost:5432",database="node_postgres_test1",command="BEGIN",status="SUCCESS"} 0
pg_command_duration_seconds_bucket{le="0.05",host="localhost:5432",database="node_postgres_test1",command="BEGIN",status="SUCCESS"} 8
pg_command_duration_seconds_bucket{le="0.1",host="localhost:5432",database="node_postgres_test1",command="BEGIN",status="SUCCESS"} 14
pg_command_duration_seconds_bucket{le="0.2",host="localhost:5432",database="node_postgres_test1",command="BEGIN",status="SUCCESS"} 18
pg_command_duration_seconds_bucket{le="0.5",host="localhost:5432",database="node_postgres_test1",command="BEGIN",status="SUCCESS"} 20
pg_command_duration_seconds_bucket{le="1",host="localhost:5432",database="node_postgres_test1",command="BEGIN",status="SUCCESS"} 20
pg_command_duration_seconds_bucket{le="2",host="localhost:5432",database="node_postgres_test1",command="BEGIN",status="SUCCESS"} 20
pg_command_duration_seconds_bucket{le="5",host="localhost:5432",database="node_postgres_test1",command="BEGIN",status="SUCCESS"} 20
pg_command_duration_seconds_bucket{le="10",host="localhost:5432",database="node_postgres_test1",command="BEGIN",status="SUCCESS"} 20
pg_command_duration_seconds_bucket{le="+Inf",host="localhost:5432",database="node_postgres_test1",command="BEGIN",status="SUCCESS"} 20
pg_command_duration_seconds_sum{host="localhost:5432",database="node_postgres_test1",command="BEGIN",status="SUCCESS"} 2.116
pg_command_duration_seconds_count{host="localhost:5432",database="node_postgres_test1",command="BEGIN",status="SUCCESS"} 20
pg_command_duration_seconds_bucket{le="0.001",host="localhost:5432",database="node_postgres_test1",command="COMMIT",status="SUCCESS"} 0
pg_command_duration_seconds_bucket{le="0.005",host="localhost:5432",database="node_postgres_test1",command="COMMIT",status="SUCCESS"} 0
pg_command_duration_seconds_bucket{le="0.01",host="localhost:5432",database="node_postgres_test1",command="COMMIT",status="SUCCESS"} 0
pg_command_duration_seconds_bucket{le="0.02",host="localhost:5432",database="node_postgres_test1",command="COMMIT",status="SUCCESS"} 0
pg_command_duration_seconds_bucket{le="0.03",host="localhost:5432",database="node_postgres_test1",command="COMMIT",status="SUCCESS"} 0
pg_command_duration_seconds_bucket{le="0.04",host="localhost:5432",database="node_postgres_test1",command="COMMIT",status="SUCCESS"} 0
pg_command_duration_seconds_bucket{le="0.05",host="localhost:5432",database="node_postgres_test1",command="COMMIT",status="SUCCESS"} 12
pg_command_duration_seconds_bucket{le="0.1",host="localhost:5432",database="node_postgres_test1",command="COMMIT",status="SUCCESS"} 17
pg_command_duration_seconds_bucket{le="0.2",host="localhost:5432",database="node_postgres_test1",command="COMMIT",status="SUCCESS"} 18
pg_command_duration_seconds_bucket{le="0.5",host="localhost:5432",database="node_postgres_test1",command="COMMIT",status="SUCCESS"} 20
pg_command_duration_seconds_bucket{le="1",host="localhost:5432",database="node_postgres_test1",command="COMMIT",status="SUCCESS"} 20
pg_command_duration_seconds_bucket{le="2",host="localhost:5432",database="node_postgres_test1",command="COMMIT",status="SUCCESS"} 20
pg_command_duration_seconds_bucket{le="5",host="localhost:5432",database="node_postgres_test1",command="COMMIT",status="SUCCESS"} 20
pg_command_duration_seconds_bucket{le="10",host="localhost:5432",database="node_postgres_test1",command="COMMIT",status="SUCCESS"} 20
pg_command_duration_seconds_bucket{le="+Inf",host="localhost:5432",database="node_postgres_test1",command="COMMIT",status="SUCCESS"} 20
pg_command_duration_seconds_sum{host="localhost:5432",database="node_postgres_test1",command="COMMIT",status="SUCCESS"} 1.6620000000000001
pg_command_duration_seconds_count{host="localhost:5432",database="node_postgres_test1",command="COMMIT",status="SUCCESS"} 20

# HELP pg_task_duration_seconds Timer of pg tasks
# TYPE pg_task_duration_seconds histogram
pg_task_duration_seconds_bucket{le="0.001",host="localhost:5432",database="node_postgres_test1",task="my-task"} 0
pg_task_duration_seconds_bucket{le="0.005",host="localhost:5432",database="node_postgres_test1",task="my-task"} 0
pg_task_duration_seconds_bucket{le="0.01",host="localhost:5432",database="node_postgres_test1",task="my-task"} 0
pg_task_duration_seconds_bucket{le="0.02",host="localhost:5432",database="node_postgres_test1",task="my-task"} 0
pg_task_duration_seconds_bucket{le="0.03",host="localhost:5432",database="node_postgres_test1",task="my-task"} 0
pg_task_duration_seconds_bucket{le="0.04",host="localhost:5432",database="node_postgres_test1",task="my-task"} 0
pg_task_duration_seconds_bucket{le="0.05",host="localhost:5432",database="node_postgres_test1",task="my-task"} 8
pg_task_duration_seconds_bucket{le="0.1",host="localhost:5432",database="node_postgres_test1",task="my-task"} 14
pg_task_duration_seconds_bucket{le="0.2",host="localhost:5432",database="node_postgres_test1",task="my-task"} 18
pg_task_duration_seconds_bucket{le="0.5",host="localhost:5432",database="node_postgres_test1",task="my-task"} 20
pg_task_duration_seconds_bucket{le="1",host="localhost:5432",database="node_postgres_test1",task="my-task"} 20
pg_task_duration_seconds_bucket{le="2",host="localhost:5432",database="node_postgres_test1",task="my-task"} 20
pg_task_duration_seconds_bucket{le="5",host="localhost:5432",database="node_postgres_test1",task="my-task"} 20
pg_task_duration_seconds_bucket{le="10",host="localhost:5432",database="node_postgres_test1",task="my-task"} 20
pg_task_duration_seconds_bucket{le="+Inf",host="localhost:5432",database="node_postgres_test1",task="my-task"} 20
pg_task_duration_seconds_sum{host="localhost:5432",database="node_postgres_test1",task="my-task"} 2.139
pg_task_duration_seconds_count{host="localhost:5432",database="node_postgres_test1",task="my-task"} 20

# HELP pg_transaction_duration_seconds Timer of pg transactions
# TYPE pg_transaction_duration_seconds histogram
pg_transaction_duration_seconds_bucket{le="0.001",host="localhost:5432",database="node_postgres_test1",transaction="my-transaction"} 0
pg_transaction_duration_seconds_bucket{le="0.005",host="localhost:5432",database="node_postgres_test1",transaction="my-transaction"} 0
pg_transaction_duration_seconds_bucket{le="0.01",host="localhost:5432",database="node_postgres_test1",transaction="my-transaction"} 0
pg_transaction_duration_seconds_bucket{le="0.02",host="localhost:5432",database="node_postgres_test1",transaction="my-transaction"} 0
pg_transaction_duration_seconds_bucket{le="0.03",host="localhost:5432",database="node_postgres_test1",transaction="my-transaction"} 0
pg_transaction_duration_seconds_bucket{le="0.04",host="localhost:5432",database="node_postgres_test1",transaction="my-transaction"} 0
pg_transaction_duration_seconds_bucket{le="0.05",host="localhost:5432",database="node_postgres_test1",transaction="my-transaction"} 0
pg_transaction_duration_seconds_bucket{le="0.1",host="localhost:5432",database="node_postgres_test1",transaction="my-transaction"} 0
pg_transaction_duration_seconds_bucket{le="0.2",host="localhost:5432",database="node_postgres_test1",transaction="my-transaction"} 11
pg_transaction_duration_seconds_bucket{le="0.5",host="localhost:5432",database="node_postgres_test1",transaction="my-transaction"} 18
pg_transaction_duration_seconds_bucket{le="1",host="localhost:5432",database="node_postgres_test1",transaction="my-transaction"} 20
pg_transaction_duration_seconds_bucket{le="2",host="localhost:5432",database="node_postgres_test1",transaction="my-transaction"} 20
pg_transaction_duration_seconds_bucket{le="5",host="localhost:5432",database="node_postgres_test1",transaction="my-transaction"} 20
pg_transaction_duration_seconds_bucket{le="10",host="localhost:5432",database="node_postgres_test1",transaction="my-transaction"} 20
pg_transaction_duration_seconds_bucket{le="+Inf",host="localhost:5432",database="node_postgres_test1",transaction="my-transaction"} 20
pg_transaction_duration_seconds_sum{host="localhost:5432",database="node_postgres_test1",transaction="my-transaction"} 5.142
pg_transaction_duration_seconds_count{host="localhost:5432",database="node_postgres_test1",transaction="my-transaction"} 20
```

# 使用量

## 依赖性

在您的工程中添加以下依赖性以下载软件包 [无](https://www.npmjs.com/package/@christiangalsterer/pg-promise-prometheus-exporter)。 。 。 .

```sh
npm i @christiangalsterer/pg-promise-prometheus-exporter
```

## 类型脚本

以下例子说明如何利用出口商监测pg-promise.

```ts
import pgPromise, { type IInitOptions, type IMain } from 'pg-promise'
import { Registry, collectDefaultMetrics } from 'prom-client'
import { monitorPgPromise } from '@christiangalsterer/pg-promise-prometheus-exporter'

...

// set up pg-promise
const initOptions: IInitOptions = {/* initialization options */}
const pgp: IMain = pgPromise(initOptions)
const database: any = pgp(/* the connection parameter is either a configuration object or a connection string */)


// set up the prometheus client
const register = new Registry();
collectDefaultMetrics({ register })

// monitor pg-promise
monitorPgPromise(database, initOptions, register)

...

// connect to PostgreSQL *after* calling monitorPgPromise
```

## Java 脚本

以下例子说明了如何利用出口商监测pg-promise.

```js
const promClient = require( 'prom-client');
const pgPromiseExporter = require('@christiangalsterer/pg-promise-prometheus-exporter')

// set up pg-promise
const initOptions = {/* initialization options */};
const pgp = require('pg-promise')(initOptions);
const database = pgp(/* the connection parameter is either a configuration object or a connection string */)

// set up the prometheus client
const collectDefaultMetrics = promClient.collectDefaultMetrics;
const Registry = promClient.Registry;
const register = new Registry();
collectDefaultMetrics({ register });

// monitor pg-promise
pgPromiseExporter.monitorPgPromise(database, initOptions, register)

// connect to Postgres *after* calling monitorPgPromise
```

# 配置

出口商可以通过类型可选参数指定的属性配置 _Pg 保证输出选项_。 。 。 .

## Pg 保证输出选项

| 属性 | 说明 | 示例 | 自兹 |
| --- | --- | --- | --- |
| 默认标签 | 默认标签添加到每个参数中 . | {'foo':'bar','alice': 3} (中文(简体) ) | 1.0.0 (单位:千美元) |

# 事件处理

如果已有 pg- promise 提供的事件注册的事件处理器, 当初始化的 init 选项时, 库会保存定义的事件处理器 .

# 格拉法纳板

Grafana 的示例 [这里](https://npmcn.com/docs/grafana/dashboard.json) 显示出口商提供的衡量标准.

Pg- promise 客户端衡量标准的例子如下: ![Grafana:pg-promise client metrics](https://npmcn.com/docs/images/grafana_pgpromise_client_1.png "Grafana: pg-promise client metrics")

以下是pg-promise 池的参数: ![Grafana:pg-promise pool metrics](https://npmcn.com/docs/images/grafana_pgpromise_pool_1.png "Grafana: pg-promise pool metrics")

这里有一个 pg 保证命令度量标准的例子 : ![Grafana:pg-promise command metrics](https://npmcn.com/docs/images/grafana_pgpromise_commands_1.png "Grafana: pg-promise command metrics")

以下是pg-promise任务衡量标准的例子: ![Grafana:pg-promise task metrics](https://npmcn.com/docs/images/grafana_pgpromise_tasks_1.png "Grafana: pg-promise task metrics")

以下是 pg 保证交易衡量标准的例子 : ![Grafana:pg-promise transaction metrics](https://npmcn.com/docs/images/grafana_pgpromise_transactions_1.png "Grafana: pg-promise transaction metrics")

# 更改日志

项目的更改可见于 [更改日志](https://npmcn.com/CHANGELOG.md)。 。 。 .

# 兼容性

下表列出了出口商版本与不同pg-promise和舞会客户端版本的相容性.

| 导出版本 | pg 保证版本 | 舞会客户端版本 |
| --- | --- | --- |
| ^ 1. 0 | ^11.5.0 (中文(简体) ) | ^15.0 |

# 捐款

发言是十分受欢迎的。 如欲为该项目捐款,请遵循本报告所述步骤 [捐款准则](https://npmcn.com/CONTRIBUTING.md)。 。 。 .

# 使用导出者的项目

如果您想要支持此项目, 请在您使用此导出时在您的项目和/ 或公司中添加链接 .

# 相关项目

如果您在寻找一种方法来监视您的节点驱动程序, 请查看 [https://github.com/christiangalster/mongodb-driver-prometheus-exporter (中文(简体) )](https://github.com/christiangalsterer/mongodb-driver-prometheus-exporter)。 。 。 .

如果你正在寻找一种方法 监视KafkaJs的节点 [https://github.com/christiangalster/kafkajs-prometheus-exporter (中文(简体) )](https://github.com/christiangalsterer/kafkajs-prometheus-exporter)。 。 。 .

## 常见问题

### @christiangalsterer/pg-promise-prometheus-exporter 是什么？

Pg- 保证的相模导出器

### 如何安装 @christiangalsterer/pg-promise-prometheus-exporter？

在项目目录运行 npm install @christiangalsterer/pg-promise-prometheus-exporter，或使用 pnpm add / yarn add / bun add。

### @christiangalsterer/pg-promise-prometheus-exporter 支持 TypeScript 吗？

支持。包内自带 TypeScript 类型声明（package\.json 声明了 types 入口），安装后即可获得类型提示，无需再安装 @types 包。

### @christiangalsterer/pg-promise-prometheus-exporter 支持 ESM 还是 CommonJS？

以 CommonJS 形式发布，可以直接 require\(\)；在 ES Module 项目中也可以用 import 引入（Node\.js 会把 module\.exports 作为默认导出）。

### @christiangalsterer/pg-promise-prometheus-exporter 需要什么版本的 Node\.js？

package\.json 的 engines 字段要求 Node\.js \>=18。版本不符时 npm 默认只给出警告，开启 engine-strict 后会拒绝安装。

### @christiangalsterer/pg-promise-prometheus-exporter 可以商用吗？

@christiangalsterer/pg-promise-prometheus-exporter 使用 MIT 许可。宽松许可：允许商业使用、修改和再分发，通常只需在分发时保留原版权与许可声明。以上为概括，不构成法律意见，请以许可原文为准。

### @christiangalsterer/pg-promise-prometheus-exporter 的下载量有多少？

根据 npm 官方下载统计，@christiangalsterer/pg-promise-prometheus-exporter 在 2026/10/10 – 2026/11/08 这 30 天内被下载 23,998 次，日均约 800 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入，适合横向比较热度，不能直接等同于使用人数。

### @christiangalsterer/pg-promise-prometheus-exporter 还在维护吗？

最新版本 2\.2\.0 发布于 2024/07/21（2 年前）；至今共发布 6 个版本，其中过去 12 个月发布了 0 个；首次发布于 2024/02/08。发布频率只是参考信号：功能稳定的工具可能很少需要更新，建议结合源码仓库的 issue 和提交记录判断。

