![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
express-performance-monitor
Advanced tools
Monitoring tooling agnostic Express Application Server in-process performance monitoring middleware and agent
Monitoring tooling agnostic Express Application Server in-process performance monitoring middleware and agent
With express-monitor
provides node application server developers with a flexible way of implementing service specific monitoring over a
unified interface. You can monitor your current express app, internals, add new monitoring fields and extend the exposed monitoring data
In this simplified example we
var Manager = require("express-performance-monitor").Manager;
var app = require("express")();
var manager = new monitor.Manager({
maxRetention: 1000 * 60 * 5,
aggregate: 60,
apis: ["web"],
server: {
"web": {
port: 3001,
listen: "0.0.0.0"
}
});
var middleware = require("express-performance-monitor").middleware(manager);
// IMPORTANT: to make sure we see everythin add this as the first middleware in your middleware stack
app.use(middleware);
app.get("/", function(req, res) {
res.sendStatus(200);
});
app.listen(3000, function() {
console.log("Listening on localhost:3000");
});
Out of the box you will get statistics for:
for each network request sent through your express app.
The middleware will store aggregated performance data specific to the type of data you wish to collect.
Depending on the metrics you are interested in different types of aggregation can be applied. Here are a few examples we already provide:
{
"name": "memory",
"type": "avg",
"aggregate": 60
}
Example usage:
var pidusage = require("pidusage");
pidusage.stat(process.pid, function(err, stat) {
if (err) {
return;
}
manager.addDataPoint("memory", stat.memory);
});
Averaged over each event and collected data this will store the last minute of memory and aggregate the metric
{
"name": "requestCount",
"type": "count",
"aggregate": 60
}
Example usage:
manager.addDataPoint("requestCount");
Count-style aggregation with a configuration like this will provide a counter that will reset every minute and have a histogram for the last minute of the counter.
{
"name": "transferredBytes",
"type": "cumulative",
"aggregate": 60
}
Example usage:
manager.addDataPoint("transferredBytes", data.length);
This is a special type of the Counter where the value added to the counter is not affixed to the a single increment but the value passed into the datapoint addition call.
Interacting with the Manager instance during your express applications lifecycle is possible using the express Request object parameter passed into every callback.
You can find it under the req.monitor.manager
object in your callback:
app.get("/status", function(req, res) {
res.json(req.monitor.manager.getState());
});
Please review the API documentation for more information on how to interact with the Manager instance.
Using the API Module infrastructure you are free to either use the provided API endpoint modules provided out of the box with this package
or write your own module. Have a look at the lib/apis/example.js
for a simple example of how to implement your own API endpoints applicable
for your environment.
FAQs
Monitoring tooling agnostic Express Application Server in-process performance monitoring middleware and agent
The npm package express-performance-monitor receives a total of 0 weekly downloads. As such, express-performance-monitor popularity was classified as not popular.
We found that express-performance-monitor demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.