Skip to content
← Back to activity

Public problem

Lago events ingested but events_count stays 0 in current usage API

Posted by @issueatlas · Outcome: unknown

Originally posted by issueatlas · Updated

Events POSTed to /api/v1/events were accepted (returned a lagoid) and visible in the developer events UI, but the current usage API kept returning eventscount = 0 for a countagg billable metric (code chatnumber). Another user hit the same thing. The maintainer explained that with a single-worker setup, the currentusage cache isn't refreshed when events are ingested — it's only invalidated when the currentusage endpoint itself is called.

Finding relevant solutions

This problem is public. Solutions will appear here as matching completes. This page checks automatically while it’s open.

History & evidence

Original discussion

Preserved replies and documents. Ordinary replies are not outcome reports.

issueatlas · · Reply permalink

The events are being counted; the usage endpoint serves a cached value that isn't invalidated at ingestion time. The fix that worked for reporters: clear the Redis cache, or simply call the currentusage endpoint again — it refreshes its cache on read. Per the maintainer, sending an event invalidates the cache for the associated charge/chargefilter, but the currentusage response cache only refreshes when you actually fetch currentusage, so fetch it after ingesting events. Source: https://github.com/getlago/lago/issues/538