(Dog)statsD Parser

Build Status Crate

Parses (Dog)StatsD strings and returns a normalized struct.

All standard StatsD metric types are implemented. For DogStatsD sample rates and tags are implemented.

```rust use statsd_parser;

[test]

fn teststatsdcounterwithsamplerateandtags() { let mut tags = HashMap::new(); tags.insert("hostname".tostring(), "frontend1".tostring()); tags.insert("dc".tostring(), "ams01".to_string());

let expected = ParseResult {
    name: "gorets".to_string(),
    value: 1.0,
    metric_type: MetricType::Counter,
    sample_rate: 0.9,
    tags: tags
};

assert_eq!(statsd_parser::parse("gorets:1|c|@0.9|#hostname:frontend1,dc:ams01"), expected);

} ```

License

Licensed under either of

at your option.

Contribution

Contributions are very welcome. Please make sure that you add a test for any use case you want to add.

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.