【发布时间】:2019-10-11 08:43:22
【问题描述】:
我正在尝试使用摘要指标,但不明白我应该在哪里放置 summary.observe 调用?这是 prom-client 示例(您可以在 npm 上找到):
const client = require('prom-client');
const summary = new client.Summary({
name: 'metric_name',
help: 'metric_help'
});
summary.observe(10);
但是没有足够的信息如何使用它。
-
observe(10) 是什么意思?
-
该 summary.observe(10) 调用应该放在哪里?就在摘要指标声明之后或函数/端点调用结束时,例如:
const client = require('prom-client'); const summary = new client.Summary({ name: 'metric_name', help: 'metric_help' }); summary.observe(10); // do I put it here? async myFunc(){ await this.serviceCall(); summary.observe(10); // or here? }
有人对总结观察有很好的例子/解释吗?
【问题讨论】:
标签: javascript node.js grafana prometheus