apm-agent-nodejs
apm-agent-nodejs copied to clipboard
`await`able `apm.flush()`
To use apm.flush(callback) effectively in an async function one has to resort to promisify'ing it like this:
const { promisify } = require('util')
await promisify(apm.flush.bind(apm))().then(function (err) {
...
})
It would be helpful if apm.flush() could return a Promise if no callback is given, then it could be awaitd directly.