Using the new XDN timing feature from within the XDN routes file, it does not seem to work

I just tried using the new XDN timing feature from within the XDN routes file, it does not seem to work. Would anyone know why that would be the case?

There is no error, the response is fine, just no timing header like I was expecting:

x-xdn-user-t: api=(millis)

It’s likely that the code you’re timing is called during initialization, not the request. For a sanity check, add something you know will be called during the request.

For example, something like this will not result in a x-xdn-user-timing header:

const Timing = require('@xdn/core/timing')
const { Router } = require('@xdn/core/router')

const timing = new Timing('router setup').start()
// ...
timing.end()

module.exports = new Router()
  .get('/foo', () => { /* ... */ })

But something like this will:

const Timing = require('@xdn/core/timing')
const { Router } = require('@xdn/core/router')

module.exports = new Router()
  .get('/foo', () => { 
    const timing = new Timing('router setup').start()
    // ...
    timing.end()
  })