Skip to main content

Module lago

Module lago 

Source
Expand description

The lago node — meters API traffic into Lago, an open-source usage-based billing platform.

Ported from APISIX’s lago.lua. Unlike the other loggers this node is a metering integration, not an access log: it emits one billing event per request so Lago can price API consumption against a customer subscription. Each request produces a Lago usage event; events are buffered by a BatchSink and POSTed as a batch to <endpoint>/api/v1/events/batch with a Bearer <token> header. The node passes the context through unchanged.

§Deviations from APISIX

  • APISIX takes endpoint_addrs (an array, one picked at random per flush). featherbit takes a single endpoint.
  • APISIX builds properties from a configured event_properties map of $var templates. featherbit reuses the shared log-entry builder, so properties is the standard request/response log entry (or a log_format custom entry). This keeps the metering payload consistent with the other loggers; configure log_format to shape it.

Structs§

LagoFlusher 🔒
Delivers batched usage events to <endpoint>/api/v1/events/batch.
LagoPlugin
Emits one Lago billing event per request, delivered in batches.

Functions§

build_batch_body 🔒
Wraps a batch of events into the Lago batch-events request body.
build_event 🔒
Builds one Lago usage event.
now_secs 🔒
required_str 🔒