Skip to main content

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

SettingTypeRequiredDescription
keystringYesThe field path to check. Supports dot notation for nested fields. Use * to check all keys.
valuenumberYesThe threshold value to compare against.
notbooleanNoIf 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:

{
"type_id": "greater_than",
"config": {
"key": "severity",
"value": 7
}
}

Matches:

{"severity": 8}
{"severity": 10}
{"severity": 7.5}

Does not match:

{"severity": 7}
{"severity": 5}
{"severity": 0}

Response Time Monitoring

Filter slow requests:

{
"type_id": "greater_than",
"config": {
"key": "response_time_ms",
"value": 1000
}
}

Matches:

{"response_time_ms": 1500}
{"response_time_ms": 2000}
{"response_time_ms": 1000.1}

Does not match:

{"response_time_ms": 1000}
{"response_time_ms": 500}

Nested Field Check

Check values in nested objects:

{
"type_id": "greater_than",
"config": {
"key": "metrics.error_rate",
"value": 0.05
}
}

Matches:

{"metrics": {"error_rate": 0.10}}
{"metrics": {"error_rate": 0.051}}

Less Than or Equal (using not)

Match values at or below a threshold:

{
"type_id": "greater_than",
"config": {
"key": "priority",
"value": 3,
"not": true
}
}

Matches:

{"priority": 3}
{"priority": 2}
{"priority": 1}

Does not match:

{"priority": 4}
{"priority": 5}

High-Value Transaction

Route large transactions:

{
"type_id": "greater_than",
"config": {
"key": "amount",
"value": 10000
}
}

Matches:

{"amount": 15000}
{"amount": 10000.01}

Array Index Check

Check values at specific array positions:

{
"type_id": "greater_than",
"config": {
"key": "scores.0",
"value": 90
}
}

Matches:

{"scores": [95, 85, 80]}
{"scores": [100]}

Common Patterns

Multi-Tier Alerting

Route based on severity tiers:

Critical alerts (severity > 8):

{
"operator": "and",
"conditions": [
{"type_id": "equals", "config": {"key": "type", "value": "alert"}},
{"type_id": "greater_than", "config": {"key": "severity", "value": 8}}
]
}

Warning alerts (severity > 5 and <= 8):

{
"operator": "and",
"conditions": [
{"type_id": "equals", "config": {"key": "type", "value": "alert"}},
{"type_id": "greater_than", "config": {"key": "severity", "value": 5}},
{"type_id": "greater_than", "config": {"key": "severity", "value": 8, "not": true}}
]
}

Performance SLA Monitoring

Route requests violating SLA:

{
"operator": "or",
"conditions": [
{"type_id": "greater_than", "config": {"key": "latency_ms", "value": 500}},
{"type_id": "greater_than", "config": {"key": "error_count", "value": 0}}
]
}

Large Payload Handling

Route oversized payloads for special processing:

{
"operator": "and",
"conditions": [
{"type_id": "greater_than", "config": {"key": "payload_size_bytes", "value": 1048576}},
{"type_id": "equals", "config": {"key": "content_type", "value": "application/json"}}
]
}

Resource Usage Alerts

Alert on high resource usage:

{
"operator": "or",
"conditions": [
{"type_id": "greater_than", "config": {"key": "cpu_percent", "value": 90}},
{"type_id": "greater_than", "config": {"key": "memory_percent", "value": 85}},
{"type_id": "greater_than", "config": {"key": "disk_percent", "value": 95}}
]
}

Range Check (Between Two Values)

Route values within a range (e.g., 50 < value <= 100):

{
"operator": "and",
"conditions": [
{"type_id": "greater_than", "config": {"key": "score", "value": 50}},
{"type_id": "greater_than", "config": {"key": "score", "value": 100, "not": true}}
]
}

Best Practices

  1. Use appropriate precision: Consider floating-point precision when setting thresholds.

  2. Combine with less_than for ranges: Use both conditions to define numeric ranges.

  3. Document threshold values: Make it clear why specific thresholds were chosen.

  4. Consider boundary conditions: Remember that greater_than is exclusive (> not >=).

  5. Use not for inclusive bounds: greater_than with not: true gives you <=.

Type Handling

Data TypeBehavior
NumbersStandard numeric comparison
Numeric stringsParsed and compared as numbers ("42" works like 42)
Non-numeric stringsReturns false
BooleansNot supported (returns false)
ArraysNot supported (use array index to access elements)
NullReturns false
MissingReturns false (or true if not is set)

Comparison Reference

ConditionResult 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 equals or contains)
  • Exclusive comparison only (use not for 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_than is exclusive (>, not >=)
  • Use not: true if you need <= behavior
  • Combine with less_than for range checks