Class Sketch


  • public class Sketch
    extends Object
    This class is used to encapsulate a Sketch to provide Quantile data. If the data fits in the cardinality set then it simply uses a map to generate the quantiles. Once the cardinality exceeds maxCardinality then the data is tracked via DDSketch which provides for a specifiable relative-accuracy quantile sketch algorithms.
    • Field Detail

      • totalMapEntries

        protected long totalMapEntries
      • totalSketchEntries

        protected long totalSketchEntries
      • type

        protected FTAType type
      • relativeAccuracy

        protected double relativeAccuracy
    • Method Detail

      • accept

        public void accept​(String key,
                           Long count)
      • isCardinalityExceeded

        public boolean isCardinalityExceeded()
      • isComplete

        public boolean isComplete()
      • complete

        public void complete​(Map<String,​Long> map)
      • getValueAtQuantile

        public String getValueAtQuantile​(double quantile)
        Get the value at the requested quantile.
        Parameters:
        quantile - a number between 0.0 and 1.0 (both included)
        Returns:
        the value at the specified quantile
      • setDdSketch

        protected void setDdSketch​(com.datadoghq.sketch.ddsketch.DDSketch ddSketch)
      • getDdSketch

        protected com.datadoghq.sketch.ddsketch.DDSketch getDdSketch()