Greater Than
Checks if a numeric value is greater than a specified threshold.
Overview
The greater_than condition evaluates whether a field's numeric value exceeds a specified threshold. This is essential for threshold-based routing, alerting on metric values, filtering by numeric criteria, and implementing tiered processing.
Use Cases
- Alerting: Route high-severity events or metrics exceeding thresholds
- Tiered Processing: Handle large orders, high-value transactions differently
- Performance Monitoring: Filter for slow response times or high error rates
- Resource Management: Route based on size, count, or usage metrics
Configuration
| Setting | Type | Required | Description |
|---|---|---|---|
key | string | Yes | The field path to check. Supports dot notation for nested fields. Use * to check all keys. |
value | number | Yes | The threshold value to compare against. |
not | boolean | No | If true, inverts the condition (matches if value is NOT greater than threshold, i.e., less than or equal). |
Examples
Basic Threshold Check
Route events with high severity:
Code
Matches:
Code
Does not match:
Code
Response Time Monitoring
Filter slow requests:
Code
Matches:
Code
Does not match:
Code
Nested Field Check
Check values in nested objects:
Code
Matches:
Code
Less Than or Equal (using not)
Match values at or below a threshold:
Code
Matches:
Code
Does not match:
Code
High-Value Transaction
Route large transactions:
Code
Matches:
Code
Array Index Check
Check values at specific array positions:
Code
Matches:
Code
Common Patterns
Multi-Tier Alerting
Route based on severity tiers:
Critical alerts (severity > 8):
Code
Warning alerts (severity > 5 and <= 8):
Code
Performance SLA Monitoring
Route requests violating SLA:
Code
Large Payload Handling
Route oversized payloads for special processing:
Code
Resource Usage Alerts
Alert on high resource usage:
Code
Range Check (Between Two Values)
Route values within a range (e.g., 50 < value <= 100):
Code
Best Practices
-
Use appropriate precision: Consider floating-point precision when setting thresholds.
-
Combine with
less_thanfor ranges: Use both conditions to define numeric ranges. -
Document threshold values: Make it clear why specific thresholds were chosen.
-
Consider boundary conditions: Remember that
greater_thanis exclusive (>not>=). -
Use
notfor inclusive bounds:greater_thanwithnot: truegives you<=.
Type Handling
| Data Type | Behavior |
|---|---|
| Numbers | Standard numeric comparison |
| Numeric strings | Parsed and compared as numbers ("42" works like 42) |
| Non-numeric strings | Returns false |
| Booleans | Not supported (returns false) |
| Arrays | Not supported (use array index to access elements) |
| Null | Returns false |
| Missing | Returns false (or true if not is set) |
Comparison Reference
| Condition | Result for value=7, threshold=5 |
|---|---|
greater_than (value: 5) | true (7 > 5) |
greater_than (value: 5, not: true) | false (7 <= 5 is false) |
greater_than (value: 7) | false (7 > 7 is false) |
greater_than (value: 10) | false (7 > 10 is false) |
Limitations
- Only works with numeric values
- Non-numeric fields return
false - No support for string comparison (use
equalsorcontains) - Exclusive comparison only (use
notfor inclusive bounds)
Troubleshooting
Condition not matching:
- Verify the field contains a numeric value (numeric strings like
"42"also work) - Check if the field exists (missing fields return
false) - Confirm the threshold value is correct
Unexpected matches:
- Check for floating-point precision issues
- Verify the field path is correct
Boundary issues:
- Remember
greater_thanis exclusive (>, not>=) - Use
not: trueif you need<=behavior - Combine with
less_thanfor range checks