LatencyInjector class

Simulates increasing inference latency over repeated calls.

Each call to inject increases the cumulative latency by incrementMs. Once the total latency exceeds maxLatencyMs, the model is marked as degraded. The baseDelayMs is the minimum delay applied on each injection.

Implemented types

Constructors

LatencyInjector({required AIModelAdapter model, int baseDelayMs = 100, int incrementMs = 50, int maxLatencyMs = 1000})
Creates a LatencyInjector.

Properties

baseDelayMs int
Base delay added on each injection (milliseconds).
final
description String
Detailed description of what this injector simulates.
no setteroverride
hashCode int
The hash code for this object.
no setterinherited
incrementMs int
Additional delay added per injection (milliseconds).
final
injectionCount int
Number of injections applied.
no setter
isDegraded bool
Whether the model is degraded (latency exceeds max).
no setter
latencyHistory List<int>
History of accumulated latency after each injection.
no setter
maxLatencyMs int
Maximum total latency before degradation (milliseconds).
final
model AIModelAdapter
The model adapter to stress.
final
name String
Short human-readable name shown in reports and logs.
no setteroverride
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
totalLatencyMs int
Total accumulated latency in milliseconds.
no setter
type FaultType
The FaultType category this injector belongs to.
no setteroverride

Methods

getStatus() String
Convenience method to get the status as a readable string.
inject() Future<void>
Activate the fault.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
reset() Future<void>
Deactivate the fault and restore normal conditions.
override
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited