express-perf
Advanced tools
Comparing version 1.1.0 to 1.2.0
@@ -98,3 +98,2 @@ var https = require('https') | ||
console.warn('[express-perf]', 'missing \'apiKey\'') | ||
return | ||
} | ||
@@ -106,11 +105,7 @@ | ||
function finish () { | ||
var method = req.method | ||
var url = req.protocol + '://' + req.get('host') + req.originalUrl | ||
var time = (new Date().getTime()) - startTime | ||
var statusCode = res.statusCode | ||
var data = { | ||
ip_addr: req.headers['x-forwarded-for'] || req.connection.remoteAddress, | ||
request_method: req.method, | ||
request_url: req.protocol + '://' + req.get('host') + req.originalUrl, | ||
normalized_uri: req.__baseRoute + req.route.path, | ||
normalized_uri: (req.__baseRoute + req.route.path).replace(/:([^\/]*)/ig, '*'), | ||
status_code: res.statusCode, | ||
@@ -117,0 +112,0 @@ time_in_millis: (new Date().getTime()) - startTime |
{ | ||
"name": "express-perf", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -0,1 +1,29 @@ | ||
# express-perf | ||
`express-perf` is small middleware that records performance timings and status codes from your app and sends it to Perf. | ||
We then run analytics on that data to generate metrics and alerts. | ||
Right now perf is in private beta but if you're interested in an API key, feel free to email us at [hi@perf.sh](hi@perf.sh) | ||
## Usage | ||
* Install `express-perf` using npm. | ||
``` | ||
npm install express-perf --save | ||
``` | ||
* In your Express application, include `express-perf` as a middleware | ||
``` | ||
var express = require('express') | ||
var perf = require('express-perf') | ||
app.use(perf(express, { | ||
apiKey: PERF_API_KEY | ||
})) | ||
``` | ||
* Make sure to include this _before_ you call your routes, preferably as your first middleware | ||
* `require('express')` is just an example, you probably have already included this | ||
* Make sure to replace `PERF_API_KEY` with the key given to you |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
39867
30
111