Commit 5af34247 authored by Jonathan Mendoza's avatar Jonathan Mendoza Committed by Facebook GitHub Bot

Get point-in-time TDigest snapshot from BasicQuantileStat

Summary:
This diff enables aggregation of point-in-time snapshots of the `TDigest`s that represents the state of `BasicQuantileStat`

We capture a `Snapshot` of `TDigest` and `SlidingWindow<TDigest>`.

The diff exposes `TDigest` and `SlidingWindow<TDigest>` to `QuantileStats`.

These objects are wrapped by the structs, `Snapshot` and `SnapshotEntry`, in `BasicQuantileStat` and `BasicQuantileStatMap`, respectively .

Reviewed By: yfeldblum

Differential Revision: D25170883

fbshipit-source-id: 0201a05cc4020851b652ed3a7b602d5b22aa63be
parent 755145b6
...@@ -49,6 +49,11 @@ class SimpleQuantileEstimator { ...@@ -49,6 +49,11 @@ class SimpleQuantileEstimator {
/// Flush buffered values /// Flush buffered values
void flush() { bufferedDigest_.flush(); } void flush() { bufferedDigest_.flush(); }
// Get point-in-time TDigest
TDigest getDigest(TimePoint now = ClockT::now()) {
return bufferedDigest_.get(now);
}
private: private:
detail::BufferedDigest<TDigest, ClockT> bufferedDigest_; detail::BufferedDigest<TDigest, ClockT> bufferedDigest_;
}; };
...@@ -75,6 +80,11 @@ class SlidingWindowQuantileEstimator { ...@@ -75,6 +80,11 @@ class SlidingWindowQuantileEstimator {
/// Flush buffered values /// Flush buffered values
void flush() { bufferedSlidingWindow_.flush(); } void flush() { bufferedSlidingWindow_.flush(); }
// Get point-in-time TDigest
TDigest getDigest(TimePoint now = ClockT::now()) {
return TDigest::merge(bufferedSlidingWindow_.get(now));
}
private: private:
detail::BufferedSlidingWindow<TDigest, ClockT> bufferedSlidingWindow_; detail::BufferedSlidingWindow<TDigest, ClockT> bufferedSlidingWindow_;
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment