Package org.acemq.workloads.rules
Class Threshold
java.lang.Object
org.acemq.workloads.rules.Threshold
A rule written as a threshold on one number in the report — the shape of the admin library's
alerts, so a rule reads the same whether it watches a broker or judges a run.
Rule backlog = Threshold.named("backlog-stays-small")
.on("queueDepthAtEnd").above(1_000)
.severity(Severity.FAILED)
.because("a queue that ends deep was filling, whatever the rates say");
Rule tail = Threshold.named("tail")
.on("endToEnd.p999").above(Duration.ofMillis(200))
.because("one message in a thousand is a user every few seconds");
The same rule in a workload file:
rules:
- name: backlog-stays-small
metric: queueDepthAtEnd
above: 1000
severity: failed
because: a queue that ends deep was filling, whatever the rates say
A metric the run did not produce — a latency with no consumers, a depth that could not be
read — never fires: there is nothing to compare. Latency metrics are compared in nanoseconds and
take a Duration; errorRate is a fraction from 0 to 1.
-
Method Details
-
named
- Parameters:
name- what the finding is called in the report- Returns:
- a threshold to configure
-
metricNames
- Returns:
- every metric a threshold can be put on, in a stable order
-
isLatency
- Parameters:
metric- one ofmetricNames()- Returns:
- whether it is a latency, compared as a duration
-
on
- Parameters:
metric- one ofmetricNames()- Returns:
- this
-
above
- Parameters:
limit- fires when the metric is above this- Returns:
- this
-
below
- Parameters:
limit- fires when the metric is below this- Returns:
- this
-
above
- Parameters:
limit- for a latency metric: fires when it is above this- Returns:
- this
-
below
- Parameters:
limit- for a latency metric: fires when it is below this- Returns:
- this
-
severity
- Parameters:
severity- how bad it is when it fires; FAILED unless told otherwise- Returns:
- this
-
because
- Parameters:
reason- what crossing the threshold means, printed as the finding's implication- Returns:
- the rule
-