Record Class LimiterEvent
java.lang.Object
java.lang.Record
ai.redouble.nucleo.events.LimiterEvent
- Record Components:
snapshot- the owning job's snapshot (nullable for transitions with no owning job)timestamp- event creation timelimiterName- stable name of the account ("memory", "PubMed", "epo:search", etc.)limiterCategory- "memory" | "token_bucket" | "elastic_window" | "semaphore"capacity- configured capacity of the account (constant per instance, carried for self-describing events)inUse- post-transition in-use countwaiters- post-transition count of jobs held on this accounttype- transition typewaitNanos- wait duration (populated on GRANTED_FROM_HOLD and REJECTED-after-HELD; 0 otherwise)rejectReason- free-form reason string (null unless type is REJECTED; conventional values: cancelled, shutdown, circuit_blocked, aborted)statusIndicator- short tag describing an abnormal state ("blocked","probing","throttle:2.0x","pace:1500ms"); null when the account is nominalamount- units of capacity moved by this transition: tokens granted on GRANTED_*, requested on HELD/REJECTED, returned on RELEASED. For unit-permit accounts (semaphore, memory gate) this is 1 per permit. Consumers can sumamountforGRANTED_*events over a sliding window to compute true throughput, whichinUse(a bucket-fill snapshot) does not represent.
- All Implemented Interfaces:
OperationalEvent, JobEvent
public record LimiterEvent(JobSnapshot snapshot, Instant timestamp, String limiterName, String limiterCategory, long capacity, long inUse, int waiters, LimiterEvent.Type type, long waitNanos, String rejectReason, String statusIndicator, long amount)
extends Record
implements OperationalEvent
Per-transition event of one admission account.
Admission publishes one for every
hold, grant, refusal and release of every account it evaluates, the memory gate included, on
whichever thread it runs; no account publishes for itself. The job snapshot travels with the
admission waiter and the grant, so attribution needs no ThreadLocal.
harness/observability/OBSERVABILITY.md documents the lifecycle trace shapes, the
reject-reason vocabulary and the consumer design; harness/admission/PACKAGE.md the
emission rules. The message renders the transition: <name> HELD (<inUse>/<capacity>,
waiters=<n>), <name> GRANTED (<inUse>/<capacity>), <name> GRANTED after <ms>ms,
<name> REJECTED (<reason>), <name> RELEASED (<inUse>/<capacity>).
- Since:
- 0.1 (2026-04-14)
- Author:
- Andrey Santrosyan
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionLimiterEvent(JobSnapshot snapshot, Instant timestamp, String limiterName, String limiterCategory, long capacity, long inUse, int waiters, LimiterEvent.Type type, long waitNanos, String rejectReason, String statusIndicator, long amount) Creates an instance of aLimiterEventrecord class. -
Method Summary
Modifier and TypeMethodDescriptionlongamount()Returns the value of theamountrecord component.longcapacity()Returns the value of thecapacityrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.longinUse()Returns the value of theinUserecord component.Returns the value of thelimiterCategoryrecord component.Returns the value of thelimiterNamerecord component.message()Gets the message associated with this event.Returns the value of therejectReasonrecord component.snapshot()Returns the value of thesnapshotrecord component.Returns the value of thestatusIndicatorrecord component.Returns the value of thetimestamprecord component.final StringtoString()Returns a string representation of this record class.type()Returns the value of thetyperecord component.intwaiters()Returns the value of thewaitersrecord component.longReturns the value of thewaitNanosrecord component.
-
Constructor Details
-
LimiterEvent
public LimiterEvent(JobSnapshot snapshot, Instant timestamp, String limiterName, String limiterCategory, long capacity, long inUse, int waiters, LimiterEvent.Type type, long waitNanos, String rejectReason, String statusIndicator, long amount) Creates an instance of aLimiterEventrecord class.- Parameters:
snapshot- the value for thesnapshotrecord componenttimestamp- the value for thetimestamprecord componentlimiterName- the value for thelimiterNamerecord componentlimiterCategory- the value for thelimiterCategoryrecord componentcapacity- the value for thecapacityrecord componentinUse- the value for theinUserecord componentwaiters- the value for thewaitersrecord componenttype- the value for thetyperecord componentwaitNanos- the value for thewaitNanosrecord componentrejectReason- the value for therejectReasonrecord componentstatusIndicator- the value for thestatusIndicatorrecord componentamount- the value for theamountrecord component
-
-
Method Details
-
message
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
snapshot
Returns the value of thesnapshotrecord component. -
timestamp
-
limiterName
Returns the value of thelimiterNamerecord component.- Returns:
- the value of the
limiterNamerecord component
-
limiterCategory
Returns the value of thelimiterCategoryrecord component.- Returns:
- the value of the
limiterCategoryrecord component
-
capacity
-
inUse
-
waiters
-
type
-
waitNanos
-
rejectReason
Returns the value of therejectReasonrecord component.- Returns:
- the value of the
rejectReasonrecord component
-
statusIndicator
Returns the value of thestatusIndicatorrecord component.- Returns:
- the value of the
statusIndicatorrecord component
-
amount
-