MCPcopy
hub / github.com/OpenTSDB/opentsdb / Downsampler

Class Downsampler

src/core/Downsampler.java:28–515  ·  view source on GitHub ↗

Iterator that downsamples data points using an Aggregator.

Source from the content-addressed store, hash-verified

26 * Iterator that downsamples data points using an {@link Aggregator}.
27 */
28public class Downsampler implements SeekableView, DataPoint {
29
30 /** Matches the weekly downsampler as it requires special handling. */
31 protected final static int WEEK_UNIT = DateTime.unitsToCalendarType("w");
32 protected final static int DAY_UNIT = DateTime.unitsToCalendarType("d");
33 protected final static int WEEK_LENGTH = 7;
34
35 /** The downsampling specification when provided */
36 protected final DownsamplingSpecification specification;
37
38 /** The start timestamp of the actual query for use with "all" */
39 protected final long query_start;
40
41 /** The end timestamp of the actual query for use with "all" */
42 protected final long query_end;
43
44 /** The data source */
45 protected final SeekableView source;
46
47 /** Iterator to iterate the values of the current interval. */
48 protected final ValuesInInterval values_in_interval;
49
50 /** Last normalized timestamp */
51 protected long timestamp;
52
53 /** Last value as a double */
54 protected double value;
55
56 /** An optional rollup query. */
57 protected RollupQuery rollup_query;
58
59 /** Whether or not to merge all DPs in the source into one vaalue */
60 protected final boolean run_all;
61
62 /** The interval to use with a calendar */
63 protected final int interval;
64
65 /** The unit to use with a calendar as a Calendar integer */
66 protected final int unit;
67
68 /**
69 * Ctor.
70 * @param source The iterator to access the underlying data.
71 * @param interval_ms The interval in milli seconds wanted between each data
72 * point.
73 * @param downsampler The downsampling function to use.
74 * @deprecated as of 2.3
75 */
76 Downsampler(final SeekableView source,
77 final long interval_ms,
78 final Aggregator downsampler) {
79 this.source = source;
80 if (downsampler == Aggregators.NONE) {
81 throw new IllegalArgumentException("cannot use the NONE "
82 + "aggregator for downsampling");
83 }
84 specification = new DownsamplingSpecification(interval_ms, downsampler,
85 DownsamplingSpecification.DEFAULT_FILL_POLICY);

Callers

nothing calls this directly

Calls 1

unitsToCalendarTypeMethod · 0.95

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…