Skip to content

Commit 86c9bbf

Browse files
JasonEtcochiedo
andauthored
Instrument warm-server via Datadog (#16566)
Co-author: @chiedo Co-authored-by: Chiedo John <2156688+chiedo@users.noreply.github.com>
1 parent f2a90db commit 86c9bbf

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

lib/warm-server.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1+
const statsd = require('./statsd')
12
const fetchEarlyAccessPaths = require('./fetch-early-access-paths')
23
let pages, site, redirects, siteTree, earlyAccessPaths
34

4-
module.exports = async function warmServer () {
5+
async function warmServer () {
56
if (!pages) {
67
if (process.env.NODE_ENV !== 'test') {
78
console.log('Priming context information')
@@ -22,3 +23,7 @@ module.exports = async function warmServer () {
2223
pages, site, redirects, siteTree, earlyAccessPaths
2324
}
2425
}
26+
27+
// Instrument the `warmServer` function so that
28+
// it's wrapped in a timer that reports to Datadog
29+
module.exports = statsd.asyncTimer(warmServer, 'warm_server')

0 commit comments

Comments
 (0)