From 039544c6283daa3d1e715c66d51e09791bf88730 Mon Sep 17 00:00:00 2001 From: Brian Martin Date: Wed, 7 Feb 2024 13:07:14 -0800 Subject: [PATCH] expand serde coverage for histogram crate (#107) Expands serde coverage for histogram crate. Updates ringlog to use latest metriken version. --- histogram/Cargo.toml | 2 +- histogram/src/snapshot.rs | 1 + histogram/src/sparse.rs | 5 +---- histogram/src/standard.rs | 1 + ringlog/Cargo.toml | 4 ++-- 5 files changed, 6 insertions(+), 7 deletions(-) diff --git a/histogram/Cargo.toml b/histogram/Cargo.toml index 609e5c4..257d189 100644 --- a/histogram/Cargo.toml +++ b/histogram/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "histogram" -version = "0.9.0" +version = "0.9.1" edition = "2021" authors = ["Brian Martin "] license = "MIT OR Apache-2.0" diff --git a/histogram/src/snapshot.rs b/histogram/src/snapshot.rs index 91581ac..3c88ba4 100644 --- a/histogram/src/snapshot.rs +++ b/histogram/src/snapshot.rs @@ -3,6 +3,7 @@ use std::time::SystemTime; /// A snapshot of a histogram across a time range. #[derive(Clone)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] pub struct Snapshot { // note: `Histogram` contains the start time pub(crate) end: SystemTime, diff --git a/histogram/src/sparse.rs b/histogram/src/sparse.rs index db25f77..fe64b6a 100644 --- a/histogram/src/sparse.rs +++ b/histogram/src/sparse.rs @@ -1,6 +1,3 @@ -#[cfg(feature = "serde")] -use serde::{Deserialize, Serialize}; - use crate::{Bucket, Config, Error, Histogram, Snapshot}; /// This histogram is a sparse, columnar representation of the regular @@ -10,7 +7,7 @@ use crate::{Bucket, Config, Error, Histogram, Snapshot}; /// of non-zero buckets. Assuming index[0] = n, (index[0], count[0]) /// corresponds to the nth bucket. #[derive(Clone, Debug, PartialEq)] -#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct SparseHistogram { /// parameters representing the resolution and the range of diff --git a/histogram/src/standard.rs b/histogram/src/standard.rs index 2ba29fc..cdf5f36 100644 --- a/histogram/src/standard.rs +++ b/histogram/src/standard.rs @@ -3,6 +3,7 @@ use std::time::SystemTime; /// A histogram that uses plain 64bit counters for each bucket. #[derive(Clone, Debug, PartialEq)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] pub struct Histogram { pub(crate) config: Config, pub(crate) start: SystemTime, diff --git a/ringlog/Cargo.toml b/ringlog/Cargo.toml index be90bc1..9b924fa 100644 --- a/ringlog/Cargo.toml +++ b/ringlog/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ringlog" -version = "0.5.0" +version = "0.6.0" edition = "2021" license = "Apache-2.0" authors = ["Brian Martin "] @@ -11,6 +11,6 @@ repository = "https://github.com/pelikan-io/rustcommon" [dependencies] ahash = "0.8.0" clocksource = { version = "0.8.0", path = "../clocksource" } -metriken = { version = "0.4.0" } +metriken = { version = "0.5.1", path = "../metriken" } log = { version = "0.4.17", features = ["std"] } mpmc = "0.1.6"