Event Enrichment
Sometimes, you may need to pre-process events before they are ingested into OpenMeter. This can be useful for normalizing data, enriching events, or calculating derived fields like cost.
OpenMeter supports this through the use of Using the OpenMeter Collector and Bloblang.
Example: Weighted Cost Calculation
Let's say you want to calculate the cost of a container based on its resources to ingest the cost into OpenMeter. Using the OpenMeter Collector, you can pre-process the event before ingesting it into OpenMeter.
Ingesting cost and tracking balances with Entitlements enables implementing currency-based wallets.
Example Event
The incoming event before enrichment:
The event after enrichment:
Note that the cost
field was added to the event after enrichment.
Event Enrichment
To calculate the cost of the container, you can use the following Bloblang mapping. Check out the OpenMeter Collector to learn how to run the Bloblang pipeline.
Check out other OpenMeter pipeline presets.