Fundebug Node.js backend plugin update to 0.2.0, to support surveillance Express slow request

Abstract: The performance problem is BUG, also need to be monitored.

Fundebug Node.js backend Exception Monitoring Service

Fundebug is a professional application anomaly monitoring platform, we Node.js plug fundebug-nodejs can provide a full range of abnormal monitoring, support Express , Koa and Hapi framework.

From the user's point of understanding, performance issues to some extent also BUG, ​​it may be indexed database problem, the problem may be the code algorithm, it may be business logic design problems. To help you quickly locate performance BUG, ​​fundebug-nodejs plugin update to 0.2.0, to support surveillance Express slow requests.

However, Fundebug no intention to provide comprehensive performance monitoring service, we will continue to focus on monitoring BUG.

Monitoring Express slow request

Express slow request monitor, configure thresholds httpTimeout , and adding ExpressTimeoutHandler middleware.

fundebug.httpTimeout = 1000;
app.use(fundebug.ExpressTimeoutHandler());

Note, Fundebug slow request monitor middleware ExpressTimeoutHandler must be placed before any other middleware.

Thus, all it takes longer than the request threshold are reported to the 1000ms Fundebug.

fundebug-express-demo

How about Express access Fundebug abnormal monitoring service, you may wish to view our Demo project fundebug-Express-Demo .

const express = require("express");
const app = express();
const port = 5000;
const Promise = require("bluebird");

const fundebug = require("fundebug-nodejs");
fundebug.apikey = "APIKEY";
fundebug.httpTimeout = 1000;

app.use(fundebug.ExpressTimeoutHandler());

app.get("/error", () => {
    throw new Error("test");
});

app.get("/timeout", async (req, res) => {
    await Promise.delay(1500);
    res.sendStatus(200);
});

app.use(function(err, req, res, next) {
    res.status(500);
    next(err);
});

app.use(fundebug.ExpressErrorHandler);

app.listen(port, () => console.log(`Example app listening on port ${port}!`));

Which, ExpressTimeoutHandler must be placed before any other middleware, and ExpressErrorHandler must be placed after other middleware.

Timeout request Fundebug captured as follows:

reference

About Fundebug

Fundebug focus on JavaScript, applets micro-channel, micro-channel games, Alipay small program, React Native, Node.js and Java applications in real-time online monitoring BUG. Since 2016, two-eleven formally launched, Fundebug handled a total of 1 billion + error event, paying customers have Sunshine Insurance, walnut programming, lychee FM, head of the 11 micro-pulse, Youth League club and many other well-known enterprises right. Welcome to Free Trial !

Copyright Notice

Please indicate the author reprinted Fundebug and paper Address:
https://blog.fundebug.com/2019/07/30/fundebug-nodejs-0-2-0/

Guess you like

Origin www.cnblogs.com/fundebug/p/fundebug-nodejs-0-2-0.html