Usage Stat

Event representing usage statistics data for analytics and billing

Event Channel:AWS SQS

Overview

The Usage Stat event represents usage statistics data that needs to be processed for analytics and billing purposes. This event is published to the Usage Stats Queue and consumed by the Usage Stats Processor.

Payload

The payload contains usage statistics data. The exact schema depends on the type of usage being tracked:

Usage Stat Payload
{
"tenantId": "string",
"timestamp": "ISO 8601 date-time",
"eventType": "string",
"data": {
// Usage-specific data
}
}

Producing the Event

Usage stat events are published to the Usage Stats Queue by various services throughout the system when usage events occur:

  • API calls
  • Message sends
  • Feature usage
  • System operations

Consuming the Event

The event is consumed by the usageStatsProcessor Lambda function in large batches (up to 1000 messages) with a 60-second batching window for efficient processing.

Use Cases

  • Track API usage per tenant
  • Monitor feature usage
  • Generate billing reports
  • Analytics and reporting
  • Usage-based billing calculations
Event-driven architecture documentation: Impulsell