Crate tower_fault_injector

Crate tower_fault_injector 

Source
Expand description

§Fault injection utilities for tower

This crate provides tower::Layers that can be used to inject various faults into a tower::Service.

§Layers

You can use the following layers to inject faults into a service:

§Example

use tower_fault_injector::latency::LatencyLayer;
use tower::{service_fn, ServiceBuilder};

// Initialize a LatencyLayer with a 10% probability of injecting
// 200 to 500 milliseconds of latency.
let latency_layer = LatencyLayer::new(0.1, 200..500).unwrap();

let service = ServiceBuilder::new()
    .layer(latency_layer)
    .service(service_fn(my_service));

Modules§

errorerror
Error injection for tower
latencylatency
Latency injection for tower