MetricsStep<Input, Output> mixin

Adds metrics collection capability to a chain step.

Collects execution metrics like duration, success rate, error count. All metrics are stored in the chain context and can be accessed by key.

Example:

class ApiStep extends ChainStep<Request, Response>
    with MetricsStep<Request, Response> {

  static const String _metricsKey = 'api_step';

  @override
  String get metricsKey => _metricsKey;

  @override
  FutureOr<Response> executeWithMetrics(Request data, ChainContext context) {
    return apiClient.send(data);
  }
}
Superclass constraints

Properties

hashCode int
The hash code for this object.
no setterinherited
inputType Type
Type of input data this step accepts
no setterinherited
metricsKey String
Key for storing metrics in context
no setter
outputType Type
Type of output data this step produces
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

executeWithMetrics(Input data, ChainContext context) FutureOr<Output>
Override this instead of handle
handle(Input data, ChainContext context) FutureOr<Output>
Handles the input data and produces output
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
rollback(Input data, ChainContext context) FutureOr<void>
Optional rollback logic for the step
inherited
toString() String
A string representation of this object.
inherited

Operators

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