Usage with serverless functions.

When using llmonitor with Serverless/Lambda functions, you need to make sure that you flush the queue at the end of each function otherwise the data may not be side.

import monitor from 'llmonitor'
async function handler(event, context) {
// do something
// your function logic...
// flush the queue (make sure to await)
await monitor.flush()
return {
statusCode: 200,
body: JSON.stringify({ message: 'Hello World' })

Questions? We're here to help.