private NamedDoubleTimeSeriesPoint createNDTSP(final String signature, final double value) { return new NamedDoubleTimeSeriesPoint(System.currentTimeMillis(), value, signature); }
@InputPort(name = INPUT_PORT_NAME_VALUE, eventTypes = { NamedDoubleRecord.class }) public void inputExecutionRecord(final NamedDoubleRecord record) { final long timestampMillis = this.timeunit.convert(record.getTimestamp(), super.recordsTimeUnitFromProjectContext); final NamedDoubleTimeSeriesPoint tspoint = new NamedDoubleTimeSeriesPoint(timestampMillis, record.getResponseTime(), record.getApplicationName()); super.deliver(OUTPUT_PORT_NAME_VALUE, tspoint); }
@InputPort(name = INPUT_PORT_NAME_VALUE, eventTypes = { NamedDoubleRecord.class }) public void inputExecutionRecord(final NamedDoubleRecord record) { final long timestampMillis = this.timeunit.convert(record.getTimestamp(), super.recordsTimeUnitFromProjectContext); final NamedDoubleTimeSeriesPoint tspoint = new NamedDoubleTimeSeriesPoint(timestampMillis, record.getResponseTime(), record.getApplicationName()); super.deliver(OUTPUT_PORT_NAME_VALUE, tspoint); }
private NamedDoubleTimeSeriesPoint calculateAggregationValueOfCurrentInterval(final AggregationVariableSet variables, final String name) { final double aggregationValue; final NamedDoubleTimeSeriesPoint tsPoint; final long firstTimestampInCurrentInterval = variables.getFirstTimestampInCurrentInterval(); final long lastTimestampInCurrentInterval = variables.getLastTimestampInCurrentInterval(); synchronized (this) { final int listSize = variables.getAggregationList().size(); if (listSize <= 0) { tsPoint = new NamedDoubleTimeSeriesPoint(lastTimestampInCurrentInterval, Double.NaN, name); } else { final double[] a = new double[listSize]; for (int i = 0; i < listSize; i++) { a[i] = variables.getAggregationList().get(i).getValue(); } aggregationValue = this.aggregationMethod.getAggregationValue(a); tsPoint = new NamedDoubleTimeSeriesPoint(lastTimestampInCurrentInterval, aggregationValue, name); variables.getAggregationList().clear(); } variables.setFirstTimestampInCurrentInterval(firstTimestampInCurrentInterval + this.aggregationSpan); variables.setLastTimestampInCurrentInterval(lastTimestampInCurrentInterval + this.aggregationSpan); } return tsPoint; }
private NamedDoubleTimeSeriesPoint calculateAggregationValueOfCurrentInterval(final AggregationVariableSet variables, final String name) { final double aggregationValue; final NamedDoubleTimeSeriesPoint tsPoint; final long firstTimestampInCurrentInterval = variables.getFirstTimestampInCurrentInterval(); final long lastTimestampInCurrentInterval = variables.getLastTimestampInCurrentInterval(); synchronized (this) { final int listSize = variables.getAggregationList().size(); if (listSize <= 0) { tsPoint = new NamedDoubleTimeSeriesPoint(lastTimestampInCurrentInterval, Double.NaN, name); } else { final double[] a = new double[listSize]; for (int i = 0; i < listSize; i++) { a[i] = variables.getAggregationList().get(i).getValue(); } aggregationValue = this.aggregationMethod.getAggregationValue(a); tsPoint = new NamedDoubleTimeSeriesPoint(lastTimestampInCurrentInterval, aggregationValue, name); variables.getAggregationList().clear(); } variables.setFirstTimestampInCurrentInterval(firstTimestampInCurrentInterval + this.aggregationSpan); variables.setLastTimestampInCurrentInterval(lastTimestampInCurrentInterval + this.aggregationSpan); } return tsPoint; }
private void calculateAndDeliverAggregationValue(final AggregationVariableSet variables) { final double aggregationValue; final NamedDoubleTimeSeriesPoint tsPoint; synchronized (this) { final int listSize = variables.getAggregationList().size(); final double[] a = new double[listSize]; for (int i = 0; i < listSize; i++) { a[i] = variables.getAggregationList().get(i).getValue(); } aggregationValue = this.aggregationMethod.getAggregationValue(a); tsPoint = new NamedDoubleTimeSeriesPoint(variables.getLastTimestampInCurrentInterval(), aggregationValue, variables.getAggregationList().get(0).getName()); // use name of first element (any will do) variables.getAggregationList().clear(); } super.deliver(OUTPUT_PORT_NAME_AGGREGATED_TSPOINT, tsPoint); }
private void calculateAndDeliverAggregationValue(final AggregationVariableSet variables) { final double aggregationValue; final NamedDoubleTimeSeriesPoint tsPoint; synchronized (this) { final int listSize = variables.getAggregationList().size(); final double[] a = new double[listSize]; for (int i = 0; i < listSize; i++) { a[i] = variables.getAggregationList().get(i).getValue(); } aggregationValue = this.aggregationMethod.getAggregationValue(a); tsPoint = new NamedDoubleTimeSeriesPoint(variables.getLastTimestampInCurrentInterval(), aggregationValue, variables.getAggregationList().get(0).getName()); // use name of first element (any will do) variables.getAggregationList().clear(); } super.deliver(OUTPUT_PORT_NAME_AGGREGATED_TSPOINT, tsPoint); }
private synchronized void processInputVariableScope(final NamedDoubleTimeSeriesPoint input) { // NOPMD (AvoidSynchronizedAtMethodLevel) final long currentTime = input.getTime(); final String appname = input.getName(); final AggregationVariableSet variables = this.aggregationVariables.get(appname); final long startOfTimestampsInterval = this.computeFirstTimestampInInterval(currentTime, variables); final long endOfTimestampsInterval = this.computeLastTimestampInInterval(currentTime, variables); if (this.recentWindow.getWindowEnd() != endOfTimestampsInterval) { this.recentWindow = new AggregationWindow(startOfTimestampsInterval, endOfTimestampsInterval); super.deliver(OUTPUT_PORT_NAME_AGGREGATION_WINDOW, this.recentWindow); } // check if interval is omitted if (endOfTimestampsInterval > variables.getLastTimestampInCurrentInterval()) { if (variables.getFirstTimestampInCurrentInterval() >= 0) { // don't do this for the first record (only used for initialization of variables) this.calculateAndDeliverAggregationValue(variables); long numIntervalsElapsed = 1; // refined below numIntervalsElapsed = (endOfTimestampsInterval - variables.getLastTimestampInCurrentInterval()) / this.aggregationSpan; if (numIntervalsElapsed > 1) { for (int i = 1; i < numIntervalsElapsed; i++) { super.deliver(OUTPUT_PORT_NAME_AGGREGATED_TSPOINT, new NamedDoubleTimeSeriesPoint(variables.getLastTimestampInCurrentInterval() + (i * this.aggregationSpan), Double.NaN, // Note: Count filter should use 0.0 appname)); } } } variables.setFirstTimestampInCurrentInterval(startOfTimestampsInterval); variables.setLastTimestampInCurrentInterval(endOfTimestampsInterval); variables.getAggregationList().clear(); } variables.getAggregationList().add(input); }
private synchronized void processInputVariableScope(final NamedDoubleTimeSeriesPoint input) { // NOPMD (AvoidSynchronizedAtMethodLevel) final long currentTime = input.getTime(); final String appname = input.getName(); final AggregationVariableSet variables = this.aggregationVariables.get(appname); final long startOfTimestampsInterval = this.computeFirstTimestampInInterval(currentTime, variables); final long endOfTimestampsInterval = this.computeLastTimestampInInterval(currentTime, variables); if (this.recentWindow.getWindowEnd() != endOfTimestampsInterval) { this.recentWindow = new AggregationWindow(startOfTimestampsInterval, endOfTimestampsInterval); super.deliver(OUTPUT_PORT_NAME_AGGREGATION_WINDOW, this.recentWindow); } // check if interval is omitted if (endOfTimestampsInterval > variables.getLastTimestampInCurrentInterval()) { if (variables.getFirstTimestampInCurrentInterval() >= 0) { // don't do this for the first record (only used for initialization of variables) this.calculateAndDeliverAggregationValue(variables); long numIntervalsElapsed = 1; // refined below numIntervalsElapsed = (endOfTimestampsInterval - variables.getLastTimestampInCurrentInterval()) / this.aggregationSpan; if (numIntervalsElapsed > 1) { for (int i = 1; i < numIntervalsElapsed; i++) { super.deliver(OUTPUT_PORT_NAME_AGGREGATED_TSPOINT, new NamedDoubleTimeSeriesPoint(variables.getLastTimestampInCurrentInterval() + (i * this.aggregationSpan), Double.NaN, // Note: Count filter should use 0.0 appname)); } } } variables.setFirstTimestampInCurrentInterval(startOfTimestampsInterval); variables.setLastTimestampInCurrentInterval(endOfTimestampsInterval); variables.getAggregationList().clear(); } variables.getAggregationList().add(input); }
controller); theReaderAggregator.addObject(new NamedDoubleTimeSeriesPoint(664L, 1000.0, OP_SIGNATURE_A)); theReaderAggregator.addObject(new NamedDoubleTimeSeriesPoint(665L, 2000.0, OP_SIGNATURE_A)); theReaderAggregator.addObject(new NamedDoubleTimeSeriesPoint(664L, 1000.0, OP_SIGNATURE_C)); theReaderAggregator.addObject(new NamedDoubleTimeSeriesPoint(668L, 5500.0, OP_SIGNATURE_C)); theReaderAggregator.addObject(new NamedDoubleTimeSeriesPoint(674L, 2000.0, OP_SIGNATURE_B)); theReaderAggregator.addObject(new NamedDoubleTimeSeriesPoint(674L, 3000.0, OP_SIGNATURE_A)); theReaderAggregator.addObject(new NamedDoubleTimeSeriesPoint(684L, 4000.0, OP_SIGNATURE_A)); theReaderAggregator.addObject(new NamedDoubleTimeSeriesPoint(674L, 2000.0, OP_SIGNATURE_C)); theReaderAggregator.addObject(new NamedDoubleTimeSeriesPoint(684L, 5000.0, OP_SIGNATURE_B)); theReaderAggregator.addObject(new NamedDoubleTimeSeriesPoint(687L, 1000.0, OP_SIGNATURE_B)); theReaderAggregator.addObject(new NamedDoubleTimeSeriesPoint(714L, 6000.0, OP_SIGNATURE_A)); theReaderAggregator.addObject(new NamedDoubleTimeSeriesPoint(724L, 7000.0, OP_SIGNATURE_A)); theReaderAggregator.addObject(new NamedDoubleTimeSeriesPoint(694L, 5000.0, OP_SIGNATURE_B)); theReaderAggregator.addObject(new NamedDoubleTimeSeriesPoint(714L, 5000.0, OP_SIGNATURE_B));
theReaderAggregator.addObject(new NamedDoubleTimeSeriesPoint(1L, 1000.0, OP_SIGNATURE_A)); theReaderAggregator.addObject(new NamedDoubleTimeSeriesPoint(5L, 1000.0, OP_SIGNATURE_C)); theReaderAggregator.addObject(new NamedDoubleTimeSeriesPoint(5L, 1000.0, OP_SIGNATURE_D)); theReaderAggregator.addObject(new NamedDoubleTimeSeriesPoint(8L, 2000.0, OP_SIGNATURE_B)); theReaderAggregator.addObject(new NamedDoubleTimeSeriesPoint(10L, 2000.0, OP_SIGNATURE_A)); theReaderAggregator.addObject(new NamedDoubleTimeSeriesPoint(11L, 3000.0, OP_SIGNATURE_A)); theReaderAggregator.addObject(new NamedDoubleTimeSeriesPoint(12L, 4000.0, OP_SIGNATURE_B)); theReaderAggregator.addObject(new NamedDoubleTimeSeriesPoint(18L, 5000.0, OP_SIGNATURE_C)); theReaderAggregator.addObject(new NamedDoubleTimeSeriesPoint(18L, 5000.0, OP_SIGNATURE_D)); theReaderAggregator.addObject(new NamedDoubleTimeSeriesPoint(18L, 5000.0, OP_SIGNATURE_A)); theReaderAggregator.addObject(new NamedDoubleTimeSeriesPoint(28L, 6000.0, OP_SIGNATURE_B)); theReaderAggregator.addObject(new NamedDoubleTimeSeriesPoint(10L, 7000.0, OP_SIGNATURE_C)); // should be ignored by the filter theReaderAggregator.addObject(new NamedDoubleTimeSeriesPoint(17L, 7000.0, OP_SIGNATURE_B)); // should be ignored by the filter theReaderAggregator.addObject(new NamedDoubleTimeSeriesPoint(48L, 7000.0, OP_SIGNATURE_C));
controller); listReader.addObject(new NamedDoubleTimeSeriesPoint(1L, 3.0, OP_SIGNATURE_A)); listReader.addObject(new NamedDoubleTimeSeriesPoint(13L, 13.0, OP_SIGNATURE_A)); listReader.addObject(new NamedDoubleTimeSeriesPoint(16L, 16.0, OP_SIGNATURE_A));
controller); listReader.addObject(new NamedDoubleTimeSeriesPoint(1000000L, 3.0, OP_SIGNATURE_A)); listReader.addObject(new NamedDoubleTimeSeriesPoint(13000000L, 13.0, OP_SIGNATURE_A)); listReader.addObject(new NamedDoubleTimeSeriesPoint(16000000L, 16.0, OP_SIGNATURE_A));