Contents
- Overview
- Choose a meter creation mode
- Create a Meter Using Simple Mode
- Test Meter Using Simulation
- Use Filters
- Troubleshooting
- Best Practices
Overview
Event meters define how usage events are filtered, aggregated, and processed.
Previously, you had to create meters using SQL queries. This required technical knowledge and increased the likelihood of errors.
Simple Mode provides a guided, UI-based approach to create meters without writing SQL. The system generates the query automatically based on your configuration. You can also validate the query using Simulation before saving.
Before you begin
Ensure that:
- Events framework is enabled. To enable it, contact the Ordway support team.
- Event data or live usage events should be available for testing
Choose a Meter Creation Mode
You can create a meter using one of the following modes:
Simple Mode
Use this mode to create meters without writing SQL.
Capabilities
- Select filtering criteria
- Select aggregation type and field to aggregate
- Automatically generate SQL queries
- Apply logical conditions (AND / OR)
- Switch between Simple Mode and SQL Mode
Enables non-technical users to create meters without SQL knowledge.
SQL Mode
Use this mode for advanced configurations.
Capabilities
- Edit meters using SQL queries
- Validate logic using Simulation
Provides full control over query definition.
Create a Meter Using Simple Mode
- In the left navigation menu, click Products & Plans → Meters. The Meters page is displayed.
- Do one of the following:
- Click Add to create a new meter
- Open an existing meter and select Edit from the three-dot menu.
- In the Filter and Aggregation section, select Simple mode.
Add Filter Conditions
- Select a field (for example, event_type)
- Select an operator (for example, equals)
- Enter a value (for example, Sample_Event)
- Click + AND or + OR to add another condition.
Combine Conditions
Use logical operators to define how conditions are evaluated:
- AND – All conditions must be satisfied
- OR – Any condition can be satisfied
Example
-
event_type = sample_event AND customer_id = Sample_customer
→ Matches records that meet both conditions -
event_type = sample_event OR customer_id = Sample_customer
→ Matches records that meet either condition
Configure Aggregation
You can select an aggregation type to define how event data is calculated in the meter.
- Select an Aggregation Type (for example, COUNT or SUM)
- Select a Field to Aggregate (if applicable)
Aggregation options
| Aggregation | Description |
| COUNT | Counts the total number of events that match the filter conditions |
| SUM | Calculates the total of a numeric field across matched events |
| MIN | Returns the smallest value from the selected field |
| MAX | Returns the largest value from the selected field |
| AVG | Calculates the average value of the selected field |
Review Generated Query
- The system generates the SQL query automatically
- Review the query in the Generated Query Preview section
- Optional: Select Convert to SQL Mode to view or modify the query
Switch Modes
You can switch between modes at any time.
- The system generates SQL from Simple Mode
- The query is preserved when switching modes
Test Meter Using Simulation
Simulation allows you to validate whether your query works correctly before saving.
Run a Simulation
Use the Test Your Meter section to simulate events and validate meter behavior before using live data.
Steps
- Scroll down to the Test Your Meter section.
- Select a data source:
- Sample Events
- Existing Events (if available)
- Review or update the event payload (JSON format).
- Click Run Test.
Use Sample Events
Use Sample Events to test with predefined or custom event payloads.
When to use
- During initial setup
- When no real events are available
- To test custom scenarios
Steps
- Select Sample Events.
- Review the default JSON payload.
- Modify fields such as:
- Event name
- Customer identifier
- Usage/value
- Click Run Test.
Result
- Simulates a new event
- Validates how the meter processes the input
Use Existing Events
Use Existing Events to test with previously recorded events.
When to use
- To validate real production data
- To debug mismatches or issues
- To reprocess historical events
Steps
- Select Existing Events.
- Browse or search for an event.
- Select the desired event from the list.
- Review the event details.
- Click Run Test.
Result
- Replays the selected event
- Verifies how the meter interprets actual data
Create Multiple Example Events
You can test your configuration with multiple events.
- Click + Create another example event.
- Add a new event payload
- Modify values as required
- Run the test again
View Results
The system displays:
- Calculated meter value (based on aggregation)
- Number of matched events
Behavior
- Each event is evaluated independently
- Results are aggregated based on the selected aggregation type
- The final value reflects all matched events
Example
If:
- Aggregation type = COUNT
- Two events match the conditions
Then:
- Calculated value = 2
Use filters
You can apply filters using:
Event fields
- Standard fields available in the event
Event Schema data Properties
- Additional properties defined in the event schema
- These properties are now available in Event Meters (previously available only in Price Matrix).
JSON format in Simulation
The JSON editor uses the usage event format. This ensures:
- Consistent structure
- Easier validation of event data
Troubleshooting
| Issue | Possible Cause / Resolution |
| No events matched | Verify filter conditions |
| Check field names and values | |
| Ensure matching events exist | |
| Incorrect aggregation result | Verify aggregation type |
| Confirm selected field for aggregation |
Best Practices
- Use Simple Mode for faster configuration
- Always run Simulation before saving
- Use OR for multi-value filtering
- Use SQL Mode only for advanced scenarios
- Test with both matching and non-matching events
Comments
0 comments
Please sign in to leave a comment.