Skip to main content

Overview

A raw usage event typically corresponds to a user-triggered action or measurement from an underlying infrastructure. When raw events are reported by your application, Stigg does the heavy lifting of filtering events and aggregating them to calculate customer usage.

Dimensions

Reported events should include properties that are required for the filtering and aggregation of those events, referred to in Stigg as dimensions. Event metadata can also be reported as an event dimension. There’s no limit on the number of dimensions that can be reported on each event; therefore, we encourage you to include as much metadata as possible in reported events to have maximum flexibility on how usage is calculated. Including these dimensions as part of the initial integration will prevent the need to backfill them at later date. Example dimensions include:
  • Cloud region - i.e. us-east-1, eu-central-1, etc.
  • Environment - i.e. production, development, etc.
  • Compute type - i.e. read, write, etc.

Event schema

The maximum payload size for a raw event is 1 MB.

Ingestion methods

REST SDKs

Send usage data using REST SDKs available for TypeScript, Python, Go, Ruby, C#, and Java.

REST API: Report Events

Send raw usage events via the REST API.

Cloud

Amazon S3: Ingestion

Amazon S3
Ingest usage data from Amazon S3.

Google Cloud Pub/Sub: Ingestion

Google Cloud Pub/Sub
Ingest usage data from Google Cloud Pub/Sub.

Supported aggregation methods

Stigg currently supports the following aggregation methods:
  1. Count
  2. Count unique
  3. Sum
  4. Maximum
  5. Minimum
  6. Average
All aggregation methods besides count require you to specify the dimension that will be used for the aggregation, for example: when calculating a sum using what dimension the sum will be calculated.

Idempotency and deduplication

Reporting usage over the network means requests can occasionally be retried, for example: after a timeout, a dropped connection, or a client-side retry policy. Without idempotency, a retried request could be counted twice and inflate a customer’s usage. To make retries safe, every raw event requires an idempotencyKey. Stigg deduplicates events so that each unique event is only counted once, no matter how many times it’s reported. Two events are considered duplicates when all of the following properties match:
  1. Timestamp
  2. Customer ID
  3. ResourceID
  4. Event name
  5. Idempotency key
Since the timestamp is part of what makes an event unique, always provide an explicit timestamp when retrying a request. If you omit it, Stigg assigns the server time at ingestion, so a retried event can get a different timestamp than the original and won’t be recognized as a duplicate.

Example use-cases

Active users

When a customer logs into your application or performs an action, report an event to Stigg with the customer ID. If you already use an analytics solution, this can be a simple as reporting an event to Stigg whenever the track method of the analytics solution is called. Create an event-based metered feature, and select the count unique aggregation method while specifying the customerId property as the dimension that will be used for computation of the aggregation.

Used bandwidth

Whenever a resource is accessed, report an event to Stigg with the resource file size dimension. Create an event-based metered feature, and select the sum aggregation method while specifying the resource file size property as the dimension that will be used for computation of the aggregation.