1
0
mirror of synced 2025-12-23 03:44:00 -05:00
Files
docs/middleware/connect-datadog.js
Mike Surowiec 2de358187c Performance testing NextJS / React (#19540)
* Remove json.parse(json.stringify( usage to improve performance
* Fix missing / duplicate keys in some renders
* Fix missing react-is dependency (only seemed to cause problems from pruning on the heroku deploy)
* Add nextjs tag to datadog-connect config when nextjs is a query param
* Fix router.asPath usage to exclude query param
* Fix styling inconsistencies noticed when testing
* Add a few tests
2021-05-27 15:17:27 -07:00

18 lines
396 B
JavaScript

const connectDatadog = require('connect-datadog')
const statsd = require('../lib/statsd')
module.exports = (req, res, next) => {
const tags = []
if ('nextjs' in req.query) {
tags.push('nextjs')
}
return connectDatadog({
dogstatsd: statsd,
method: true, // Track HTTP methods (GET, POST, etc)
response_code: true, // Track response codes
tags
})(req, res, next)
}