如何通过Web浏览器访问使用Node.js应用程序的appmetrics库收集的度量标准数据?根据文档,我已经在本地安装了Appmetrics,但是我不清楚如何从API访问指标数据。理想情况下,我想使用网络浏览器(如Chrome
)通过HTTP GET调用查看指标数据const express = require('express')
const app = express()
var port = process.env.PORT || 3000;
var appmetrics = require('appmetrics');
var monitor = appmetrics.monitor();
appmetrics.enable('http');
appmetrics.enable('request');
monitor.on('request', function (request) {
console.log('request', request);
});
monitor.on('http', function (http) {
console.log('http', http);
});
app.get('/', function (req, res) {
res.send('Hello World!')
})
app.listen(port, function () {
console.log('Example app listening on port 3000!')
})