diff --git a/Cargo.lock b/Cargo.lock index 82468dd..f727d2c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -910,9 +910,9 @@ checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" [[package]] name = "openmetrics-parser" -version = "0.4.2" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fa1075b40b84d04375a1dcb39e5726c4ac3aee06cc036e60e5b4e636aaba86f" +checksum = "e40a68c62e09c5dfec2f6472af3bd5e8ddf506fcf14c78ece23794ffbb874eca" dependencies = [ "auto_ops", "pest", diff --git a/Cargo.toml b/Cargo.toml index e11c0e8..c0f63eb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,7 +14,7 @@ keywords = ["openmetrics", "prometheus", "pushgateway"] [dependencies] tokio = { version = "1", features = ["full"] } warp = "0.3" -openmetrics-parser = "0.4.2" +openmetrics-parser = "0.4.4" serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" clap = "2.33.3" diff --git a/src/aggregator_test.rs b/src/aggregator_test.rs index 6535419..975e6ba 100644 --- a/src/aggregator_test.rs +++ b/src/aggregator_test.rs @@ -228,3 +228,19 @@ number_of_transactions_total{label=\"value\"} 1 assert!(result.is_ok(), "failed to parse valid metric: {:?}", result.err()); } + +#[tokio::test] +async fn test_openmetrics_parser_2() { + // https://github.com/sinkingpoint/openmetrics-parser/issues/2 + + let mut agg = Aggregator::new(); + let result = agg.parse_and_merge("example_test_counter_total{foo=\"bar\"} 0 +", &HashMap::new()).await; + + assert!(result.is_ok(), "failed to parse valid metric: {:?}", result.err()); + + let result = agg.parse_and_merge("example_test_counter_total{foo=\"bar\"} 0.01 +", &HashMap::new()).await; + + assert!(result.is_ok(), "failed to parse valid metric: {:?}", result.err()); +}