diff --git a/CHANGES.md b/CHANGES.md index d2f5d5d..4634ebb 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,5 +1,9 @@ # Latest changes + history +## version 0.7.8 +- Fixed Prometheus output https://github.com/fralalonde/dipstick/issues/70 + +## version 0.7.6 - Move to Rust 2018 using cargo fix --edition and some manual help - Fix nightly's 'acceptable regression' https://github.com/rust-lang/rust/pull/59825 - Give each flush listener a unique id diff --git a/README.md b/README.md index 4e75da1..26da316 100755 --- a/README.md +++ b/README.md @@ -77,7 +77,7 @@ To use Dipstick in your project, add the following line to your `Cargo.toml` in the `[dependencies]` section: ```toml -dipstick = "0.7.7" +dipstick = "0.7.8" ``` ## External features diff --git a/src/output/prometheus.rs b/src/output/prometheus.rs index 8ec82bb..08e84cf 100755 --- a/src/output/prometheus.rs +++ b/src/output/prometheus.rs @@ -126,6 +126,7 @@ impl PrometheusScope { strbuf.push(' '); } strbuf.push_str(&value_str); + strbuf.push('\n'); let mut buffer = self.buffer.borrow_mut(); if strbuf.len() + buffer.len() > BUFFER_FLUSH_THRESHOLD { @@ -138,11 +139,6 @@ impl PrometheusScope { buffer = self.buffer.borrow_mut(); } - if !buffer.is_empty() { - // separate from previous entry - buffer.push('\n') - } - buffer.push_str(&strbuf); if !self.is_buffered() { @@ -212,48 +208,3 @@ impl Drop for PrometheusScope { } } } - -//#[cfg(test)] -//mod test { -// use super::*; -// use crate::core::input::InputKind; -// use std::io; -// use crate::core::input::Input; -// use crate::core::input::InputScope; -// -// #[test] -// fn sink_print() { -// let sd = Prometheus::push_to("localhost:2003").unwrap().metrics(); -// let timer = sd.new_metric("timer".into(), InputKind::Counter); -// sd.write(33, labels![]); -// } -//} - - -//#[cfg(feature = "bench")] -//mod bench { -// -// use super::*; -// use crate::core::attributes::*; -// use crate::core::input::*; -// -// #[bench] -// pub fn immediate_prometheus(b: &mut test::Bencher) { -// let sd = Prometheus::push_to("localhost:2003").unwrap().metrics(); -// let timer = sd.new_metric("timer".into(), InputKind::Timer); -// -// b.iter(|| test::black_box(timer.write(2000, labels![]))); -// } -// -// #[bench] -// pub fn buffering_prometheus(b: &mut test::Bencher) { -// let sd = Prometheus::push_to("localhost:2003") -// .unwrap() -// .buffered(Buffering::BufferSize(65465)) -// .metrics(); -// let timer = sd.new_metric("timer".into(), InputKind::Timer); -// -// b.iter(|| test::black_box(timer.write(2000, labels![]))); -// } -// -//}