statsd-mock

Crates.iostatsd-mock
lib.rsstatsd-mock
version0.1.1
sourcesrc
created_at2022-07-05 17:01:07.38072
updated_at2022-07-05 17:26:32.27562
descriptionMocking for statsd
homepage
repository
max_upload_size
id619830
size17,081
Duyet Le (duyet)

documentation

README

Mock StatsD for Rust

Mock for statsd crate.

Crates.io MIT licensed Build Status Codecov

Website | API Docs

Usage

Add the statsd-mock package as a dev dependency in your Cargo.toml file

[dev-dependencies]
statsd-mock = "0.1"

Example

use statsd::client::Client;

fn main() {
  // Start the mock server
  let mock = statsd_mock::start();

  // mock.addr() to get mock server address
  let client = Client::new(&mock.addr(), "myapp").unwrap();

  // Capturing
  let response = mock.capture(|| client.incr("some.counter"));

  assert_eq!(response, "myapp.some.counter:1|c");
}

License

MIT.

Commit count: 0

cargo fmt