我正在使用 Prometheus 从我的 pod 中抓取指标。我感兴趣的应用程序通过一个提供访问的服务复制了几次。Prometheus 使用此服务来抓取指标。在我的应用程序中,指标设置如下:
import * as Prometheus from 'prom-client';
const httpRequestDurationMicroseconds = new Prometheus.Histogram({
name: 'transaction_amounts',
help: 'Amount',
labelNames: ['amount'],
buckets: [0, 5, 15, 50, 100, 200, 300, 400, 500, 10000],
});
const totalPayments = new Prometheus.Counter('transaction_totals', 'Total payments');
Run Code Online (Sandbox Code Playgroud)
我正在使用 helm 安装 Prometheus 并且刮取配置如下所示:
prometheus.yml:
rule_files:
- /etc/config/rules
- /etc/config/alerts
scrape_configs:
- job_name: prometheus
static_configs:
- targets:
- localhost:9090
- job_name: transactions
scrape_interval: 1s
static_configs:
- targets:
- transaction-metrics-service:3001
Run Code Online (Sandbox Code Playgroud)
我可以看到 prometheus 内部的指标,但它似乎只来自一个 pod。例如,在 Prometheus 中,当我查询transaction_totals它时会给出: …