Skip to content

Feature Proposal - Add callback to be run when chaos is injected #65

@iCodeSometime

Description

@iCodeSometime

It would be nice to be able to run code when chaos is injected (by any of the simmy injection policies).

Example use-case:

var  chaosExceptionPolicy = MonkeyPolicy
    .InjectExceptionAsync(with => with
        .Fault(new TimeoutException())
        .InjectionRate(0.2)
        .Enabled()
        .OnInject((context, exception, cancellation) => logger.LogInformation("Injecting Chaos"));

Alternative:
Using InjectBehavior rather than InjectException, and throwing the exception myself would also work without changes in Simmy.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions