apm-agent-nodejs icon indicating copy to clipboard operation
apm-agent-nodejs copied to clipboard

`await`able `apm.flush()`

Open trentm opened this issue 3 years ago • 0 comments

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.

trentm avatar Aug 04 '22 00:08 trentm