Class NewtsFetchStrategy

    • Field Detail

      • MIN_STEP_MS

        public static final long MIN_STEP_MS
      • INTERVAL_DIVIDER

        public static final int INTERVAL_DIVIDER
      • DEFAULT_HEARTBEAT_MS

        public static final long DEFAULT_HEARTBEAT_MS
      • PARALLELISM

        public static final int PARALLELISM
    • Constructor Detail

      • NewtsFetchStrategy

        public NewtsFetchStrategy()
    • Method Detail

      • fetch

        public FetchResults fetch​(long start,
                                  long end,
                                  long step,
                                  int maxrows,
                                  Long interval,
                                  Long heartbeat,
                                  List<Source> sources,
                                  boolean relaxed)
        Description copied from interface: MeasurementFetchStrategy
        Fetches the measurements for the given sources.
        Specified by:
        fetch in interface MeasurementFetchStrategy
        Parameters:
        start - timestamp in milliseconds
        end - timestamp in milliseconds
        step - desired resolution in milliseconds - actual resolution might differ
        maxrows - maximum number of rows - no limit when <= 0
        interval - duration in milliseconds, used by strategies that implement late aggregation
        heartbeat - duration in milliseconds, used by strategies that implement late aggregation
        sources - array of sources - these should have unique labels
        relaxed - if false a missing source results in a return of null. true on the other hand ignores that source.
        Returns:
        null when a resource id or attribute cannot be found
      • getLagParams

        protected static NewtsFetchStrategy.LateAggregationParams getLagParams​(long step,
                                                                               Long interval,
                                                                               Long heartbeat)
        Calculates the parameters to use for late aggregation. Since we're in the process of transitioning from an RRD-world, most queries won't contain a specified interval or heartbeat. For this reason, we need to derive sensible values that will allow users to visualize the data on the graphs without too many NaNs. The given step size will be variable based on the time range and the pixel width of the graph, so we need to derive the interval and heartbeat accordingly. Let S = step, I = interval and H = heartbeat, the constraints are as follows: 0 < S 0 < I 0 < H S = aI for some integer a >= 2 H = bI for some integer b >= 2 While achieving these constraints, we also want to optimize for: min(|S - S*|) where S* is the user supplied step and S is the effective step.
      • setResourceDao

        protected void setResourceDao​(ResourceDao resourceDao)
      • setSampleRepository

        protected void setSampleRepository​(org.opennms.newts.api.SampleRepository sampleRepository)
      • setContext

        protected void setContext​(org.opennms.newts.api.Context context)