简体   繁体   English

appmetrics(https://github.com/RuntimeTools/appmetrics/issues)请求和http事件不起作用

[英]appmetrics(https://github.com/RuntimeTools/appmetrics/issues) request and http event not working

Hi Please see below sample code. 您好,请参阅下面的示例代码。

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!')
})

'

Whenever I fire localhost:3000 from browser. 每当我从浏览器启动localhost:3000时。 I get 'Hello World!' 我得到“你好世界!” reply but logs doesn't show any request or http event. 回复,但日志未显示任何请求或http事件。 Can somebody help me to point out issue. 有人可以帮我指出问题。 I am using latest appmetrics version. 我正在使用最新的Appmetrics版本。

Thanks in Advance. 提前致谢。

Have you tried putting line 4 (the appmetrics require line) at the top of the code? 您是否尝试过将第4行(appmetrics要求行)放在代码顶部? If it works, please close the issue you raised https://github.com/RuntimeTools/appmetrics/issues/452 如果可行,请关闭您提出的问题https://github.com/RuntimeTools/appmetrics/issues/452

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何修复“npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142”错误Windows 10? - How to fix "npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142" error in Windows 10? 如何从github.com以及NodeJs(https)下载文件 - How download file from github.com whith NodeJs (https) 如何在浏览器中使用“https://github.com/ovvn/dom-to-pdf” - How can I use `https://github.com/ovvn/dom-to-pdf` in a Browser 在异步队列内的函数内进行异步Twitter调用-https://github.com/DeviaVir/zenbot - Async twitter call inside a function that is inside a async queue - https://github.com/DeviaVir/zenbot 无法在meanstack MEANIO上运行localhost:3000,https://github.com/linnovate/mean - cannot run localhost:3000 on meanstack MEANIO, https://github.com/linnovate/mean 如何处理“已弃用,请使用https://github.com/pillarjs/path-to-regexp”消息 - how to deal with “DEPRECATED use https://github.com/pillarjs/path-to-regexp” message 是否可以使用node-smpp(https://github.com/farhadi/node-smpp)发送批量短信? - Is it possible to send bulk sms with node-smpp (https://github.com/farhadi/node-smpp)? 找不到 JavaScript 运行时。 有关可用运行时的列表,请参阅 https://github.com/sstephenson/execjs - Could not find a JavaScript runtime. See https://github.com/sstephenson/execjs for a list of available runtimes PinoWarning:prettyPrint 已弃用,请查看 https://github.com/pinojs/pino-pretty 寻找替代方案 - PinoWarning: prettyPrint is deprecated, look at https://github.com/pinojs/pino-pretty for alternatives 获取Appmetrics将数据发送到(Eclips)IBM Health Center - Getting appmetrics to send data to (Eclips) IBM Health centre
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM