refactor(alerting): rename P95_LATENCY_MS → AVG_DURATION_MS to match what stats_1m_route exposes
The evaluator mapped P95_LATENCY_MS to ExecutionStats.avgDurationMs because stats_1m_route has no p95 column. Exposing the old name implied p95 semantics operators did not get. Rename to AVG_DURATION_MS makes the contract honest. Updated RouteMetric enum (with javadoc), evaluator switch, and admin guide. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -48,8 +48,7 @@ public class RouteMetricEvaluator implements ConditionEvaluator<RouteMetricCondi
|
|||||||
|
|
||||||
double actual = switch (c.metric()) {
|
double actual = switch (c.metric()) {
|
||||||
case ERROR_RATE -> errorRate(stats);
|
case ERROR_RATE -> errorRate(stats);
|
||||||
// ExecutionStats has no p95 field; avgDurationMs is the closest available proxy
|
case AVG_DURATION_MS -> (double) stats.avgDurationMs();
|
||||||
case P95_LATENCY_MS -> (double) stats.avgDurationMs();
|
|
||||||
case P99_LATENCY_MS -> (double) stats.p99LatencyMs();
|
case P99_LATENCY_MS -> (double) stats.p99LatencyMs();
|
||||||
case THROUGHPUT -> (double) stats.totalCount();
|
case THROUGHPUT -> (double) stats.totalCount();
|
||||||
case ERROR_COUNT -> (double) stats.failedCount();
|
case ERROR_COUNT -> (double) stats.failedCount();
|
||||||
|
|||||||
@@ -1,3 +1,10 @@
|
|||||||
package com.cameleer.server.core.alerting;
|
package com.cameleer.server.core.alerting;
|
||||||
|
|
||||||
public enum RouteMetric { ERROR_RATE, P95_LATENCY_MS, P99_LATENCY_MS, THROUGHPUT, ERROR_COUNT }
|
public enum RouteMetric {
|
||||||
|
ERROR_RATE,
|
||||||
|
/** Average execution duration — maps to stats_1m_route.avgDurationMs. */
|
||||||
|
AVG_DURATION_MS,
|
||||||
|
P99_LATENCY_MS,
|
||||||
|
THROUGHPUT,
|
||||||
|
ERROR_COUNT
|
||||||
|
}
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ Fires when a computed route metric crosses a threshold over a rolling window.
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
Available metrics: `ERROR_RATE`, `THROUGHPUT`, `MEAN_PROCESSING_MS`, `P95_PROCESSING_MS`.
|
Available metrics: `ERROR_RATE`, `THROUGHPUT`, `AVG_DURATION_MS`, `P99_LATENCY_MS`, `ERROR_COUNT`.
|
||||||
Comparators: `GT`, `GTE`, `LT`, `LTE`, `EQ`.
|
Comparators: `GT`, `GTE`, `LT`, `LTE`, `EQ`.
|
||||||
|
|
||||||
### EXCHANGE_MATCH
|
### EXCHANGE_MATCH
|
||||||
|
|||||||
Reference in New Issue
Block a user