public class NewtsFetchStrategy extends Object implements MeasurementFetchStrategy
SampleRepository
.
If a request to fetch(long, long, long, int, java.lang.Long, java.lang.Long, java.util.List<org.opennms.netmgt.measurements.model.Source>, boolean)
spans multiple resources, separate calls to
the SampleRepository
will be performed in parallel.
Reading the samples and computing the aggregated values can be very CPU intensive.
The "parallelism" attribute is used to set an upper limit on how may concurrent threads
can be used to perform these calculations. By default, this is set to the number of
cores, but can be reduced if the operator wishes to ensure cores are available
for other purposes.Modifier and Type | Class and Description |
---|---|
protected static class |
NewtsFetchStrategy.LateAggregationParams |
Modifier and Type | Field and Description |
---|---|
static long |
DEFAULT_HEARTBEAT_MS |
static int |
INTERVAL_DIVIDER |
static long |
MIN_STEP_MS |
static int |
PARALLELISM |
Constructor and Description |
---|
NewtsFetchStrategy() |
Modifier and Type | Method and Description |
---|---|
FetchResults |
fetch(long start,
long end,
long step,
int maxrows,
Long interval,
Long heartbeat,
List<Source> sources,
boolean relaxed)
Fetches the measurements for the given sources.
|
protected static NewtsFetchStrategy.LateAggregationParams |
getLagParams(long step,
Long interval,
Long heartbeat)
Calculates the parameters to use for late aggregation.
|
protected void |
setContext(org.opennms.newts.api.Context context) |
protected void |
setResourceDao(ResourceDao resourceDao) |
protected void |
setSampleRepository(org.opennms.newts.api.SampleRepository sampleRepository) |
public static final long MIN_STEP_MS
public static final int INTERVAL_DIVIDER
public static final long DEFAULT_HEARTBEAT_MS
public static final int PARALLELISM
public FetchResults fetch(long start, long end, long step, int maxrows, Long interval, Long heartbeat, List<Source> sources, boolean relaxed)
MeasurementFetchStrategy
fetch
in interface MeasurementFetchStrategy
start
- timestamp in millisecondsend
- timestamp in millisecondsstep
- desired resolution in milliseconds - actual resolution might differmaxrows
- maximum number of rows - no limit when <= 0interval
- duration in milliseconds, used by strategies that implement late aggregationheartbeat
- duration in milliseconds, used by strategies that implement late aggregationsources
- array of sources - these should have unique labelsrelaxed
- if false
a missing source results in a return of null
.
true
on the other hand ignores that source.protected static NewtsFetchStrategy.LateAggregationParams getLagParams(long step, Long interval, Long heartbeat)
protected void setResourceDao(ResourceDao resourceDao)
protected void setSampleRepository(org.opennms.newts.api.SampleRepository sampleRepository)
protected void setContext(org.opennms.newts.api.Context context)
Copyright © 2021. All rights reserved.