Basic Features
Event Queuing/Batching
6 min
abv's client sdks and integrations are all designed to queue and batch requests in the background to optimize api calls and network time batches are determined by a combination of time and size (number of events and size of batch) configuration all integrations have a sensible default configuration, but you can customize the batching behaviour to suit your needs option (python) \[sdk constructor, environment] option (js) description flush at , abv flush at flushat the maximum number of events to batch up before sending flush interval , abv flush interval (s) flushinterval (ms) the maximum time to wait before sending a batch you can e g set flushat=1 to send every event immediately, or flushinterval=1000 to send every second manual flushing this is especially relevant for short lived applications like serverless functions if you do not flush the client, you may lose events if you want to send a batch immediately, you can call the flush method on the client in case of network issues, flush will log an error and retry the batch, it will never throw an exception python sdk from abvdev import get client \# access the client directly abv = get client() \# flush all pending observations abv flush() if you exit the application, use shutdown method to make sure all requests are flushed and pending requests are awaited before the process exits on success of this function, no more events will be sent to abv api from abvdev import get client abv = get client() abv shutdown() js/ts sdk the abvspanprocessor buffers events and sends them in batches, so a final flush ensures no data is lost you can export the processor from your otel sdk setup file instrumentation ts import { nodesdk } from "@opentelemetry/sdk node"; import { abvspanprocessor } from "@abvdev/otel"; // export the processor to be able to flush it export const abvspanprocessor = new abvspanprocessor(); const sdk = new nodesdk({ spanprocessors \[abvspanprocessor], }); sdk start(); then, in your serverless function handler, call forceflush() before the function exits handler ts import { abvspanprocessor } from " /instrumentation"; export async function handler(event, context) { // your application logic // flush before exiting await abvspanprocessor forceflush(); }