The following examples demonstrate how to ingest events from various sources into OpenMeter using Benthos.
The examples use the custom Benthos distribution in this repository.
- Database
- Generate random events
- HTTP server (forwarding events to OpenMeter)
- Kubernetes Pod execution time
These examples require a running OpenMeter instance. If you don't have one, you can sign up for a free trial.
If you are using OpenMeter Cloud, grab a new API token.
In order to see data in OpenMeter, you need to create a meter first.
In OpenMeter Cloud, go to the Meters page and click the Create meter button in the right upper corner. Fill in the details of the meter as instructed by the specific example and click Create.
Tip
You can start ingesting events without creating a meter first, but you won't be able to query data. You can inspect the ingested events in the Event debugger.
In a self-hosted OpenMeter instance you can create a meter in the configuration file:
# ...
meters:
- slug: api_calls
eventType: api-calls
aggregation: SUM
valueProperty: $.duration_ms
groupBy:
method: $.method
path: $.path
Once you start ingesting events, you can check them in the Event debugger or in the Query page.
If you self-host OpenMeter, you can use the REST API to query data.
We are actively working on improving the documentation and the examples. In the meantime, feel free to contact us in email or on Discord.
We are more than happy to help you set up OpenMeter in your production environment.