Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
9ab1fbb
NIFI-6510 Implement initial analytic engine
ai-christianson Jul 9, 2019
22a15bd
NIFI-6510 Implemented basic linear regression model for queue counts
ai-christianson Jul 11, 2019
0274a6a
NIFI-6510 Initial analytics REST endpoint and supporting objects
mattyb149 Jul 15, 2019
5283799
NIFI-6510 Connect the dots for StatusAnalytics -> API
ai-christianson Jul 16, 2019
4daddb1
NIFI-6510 Added poc engine with prediction model caching
YolandaMDavis Jul 19, 2019
cb58250
NIFI-6510 Updated objects and interfaces to reflect 4 prediction metrics
mattyb149 Jul 22, 2019
60f5a76
NIFI-6510 adjustments for interface updates, added call to StandardEv…
YolandaMDavis Jul 23, 2019
c02ec44
NIFI-6510 Remove redundant connection prediction interfaces as we can…
ai-christianson Jul 24, 2019
62ad38c
NIFI-6510 Revert "DFA-9 Remove redundant connection prediction interf…
mattyb149 Jul 24, 2019
4eda08d
NIFI-6510 Split StatusAnalytics interface into Engine and per-Connect…
mattyb149 Jul 23, 2019
7b7bbcd
NIFI-6510 Added prediction fields for use by UI, still need to be pop…
mattyb149 Jul 24, 2019
7bc6467
NIFI-6510 Analytics Framework Introduction (#10)
YolandaMDavis Jul 29, 2019
0377562
NIFI-6510 Add prediction percent values and predicted interval seconds
YolandaMDavis Jul 29, 2019
9c3cb6a
NIFI-6510 Changes to inject flowManager instead of flow controller, a…
YolandaMDavis Jul 31, 2019
93ca7a0
NIFI-6510 Added tests for engine
YolandaMDavis Jul 31, 2019
70e0095
NIFI-6150 Added tests for connection status analytics class, correcte…
YolandaMDavis Jul 31, 2019
cedd35f
NIFI-6150 Make checkstyle happy
YolandaMDavis Jul 31, 2019
c8c323f
NIFI-6150 Fixed NaN check and refactored time prediction. Switched to…
YolandaMDavis Aug 2, 2019
d1e5cc7
NIFI-6510 Fixed checkstyle issue in TestConnectionStatusAnalytics
mattyb149 Aug 2, 2019
b3f362b
NIFI-6510 Adjusted interval and incorporated R-squared check
YolandaMDavis Aug 8, 2019
79315c8
NIFI-6510 Added property to nifi.properties - Prediction Interval for…
mattyb149 Aug 16, 2019
4086d13
NIFI-6566 - Refactor to decouple model instance from status analytics…
YolandaMDavis Aug 20, 2019
fc72919
NIFI-6585 - Refactored tests to use mocked models and extract functio…
YolandaMDavis Aug 23, 2019
9e35e4c
NIFI-6586 - documentation and comments
YolandaMDavis Aug 27, 2019
b74c4df
NIFI-6568 - Surface time-to-back-pressure and initial predictions in …
rfellows Jul 22, 2019
760ee69
NIFI-6568 - Properly sort the min estimated time to back pressure in …
rfellows Aug 28, 2019
146af15
NIFI-6510 - add an enable/disable property for analytics
YolandaMDavis Aug 30, 2019
7e6eddd
NIFI-6510 - documentation updates for enable/disable property
YolandaMDavis Aug 30, 2019
f8e743b
NIFI-6510 - UI: handle the scenario where backpressure predictions ar…
rfellows Sep 3, 2019
134781d
NIFI-6510 - admin guide updates to further describe model functionality
YolandaMDavis Sep 3, 2019
17c9cc2
NIFI-6510 - code quality fixes (if statement and constructor)
YolandaMDavis Sep 5, 2019
69b486a
NIFI-6510 - log warnings when properties could not be retrieved. fixe…
YolandaMDavis Sep 5, 2019
e5738fd
NIFI-6510 Extract out predictions into their own DTO
ai-christianson Sep 5, 2019
39ff534
NIFI-6510 Optimize imports
ai-christianson Sep 5, 2019
7345ee6
NIFI-6510 Fix formatting
ai-christianson Sep 5, 2019
5bb1850
NIFI-6510 Optimize imports
ai-christianson Sep 5, 2019
de9e2cb
NIFI-6510 Optimize imports
ai-christianson Sep 5, 2019
fcb31f6
NIFI-6510 - Notice updates for Commons math and Caffeine
YolandaMDavis Sep 5, 2019
9292005
NIFI-6510 - UI updates to account for minor API changes for back pres…
rfellows Sep 5, 2019
60d9ce4
NIFI-6510 - Fix issue displaying estimated time to back pressure in c…
rfellows Sep 6, 2019
6ed10bf
NIFI-6510 Rip out useless members
ai-christianson Sep 6, 2019
7713be3
NIFI-6510 - dto updates to check for -1 value
YolandaMDavis Sep 6, 2019
ab26522
NIFI-6510 - checkstyle fix
YolandaMDavis Sep 6, 2019
4ff359a
NIFI-6510 - rolled back last change and applied minNonNegative method
YolandaMDavis Sep 8, 2019
16f7c37
NIFI-6510 Rip out useless members
ai-christianson Sep 9, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
*/
package org.apache.nifi.controller.status;

import org.apache.nifi.controller.status.analytics.ConnectionStatusPredictions;
import org.apache.nifi.processor.DataUnit;

/**
Expand All @@ -30,6 +31,7 @@ public class ConnectionStatus implements Cloneable {
private String destinationId;
private String destinationName;
private String backPressureDataSizeThreshold;
private ConnectionStatusPredictions predictions;
private long backPressureBytesThreshold;
private long backPressureObjectThreshold;
private int inputCount;
Expand Down Expand Up @@ -122,6 +124,14 @@ public void setBackPressureDataSizeThreshold(String backPressureDataSizeThreshol
setBackPressureBytesThreshold(DataUnit.parseDataSize(backPressureDataSizeThreshold, DataUnit.B).longValue());
}

public ConnectionStatusPredictions getPredictions() {
return predictions;
}

public void setPredictions(ConnectionStatusPredictions predictions) {
this.predictions = predictions;
}

public long getBackPressureObjectThreshold() {
return backPressureObjectThreshold;
}
Expand Down Expand Up @@ -202,6 +212,11 @@ public ConnectionStatus clone() {
clonedObj.sourceName = sourceName;
clonedObj.destinationId = destinationId;
clonedObj.destinationName = destinationName;

if (predictions != null) {
clonedObj.setPredictions(predictions.clone());
}

clonedObj.backPressureDataSizeThreshold = backPressureDataSizeThreshold;
clonedObj.backPressureObjectThreshold = backPressureObjectThreshold;
clonedObj.maxQueuedBytes = maxQueuedBytes;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.nifi.controller.status.analytics;

/**
*/
public class ConnectionStatusPredictions implements Cloneable {
private long predictionIntervalMillis;
private int nextPredictedQueuedCount;
private long nextPredictedQueuedBytes;
private long predictedTimeToCountBackpressureMillis;
private long predictedTimeToBytesBackpressureMillis;
private int predictedPercentCount = 0;
private int predictedPercentBytes = 0;

public long getPredictionIntervalMillis() {
return predictionIntervalMillis;
}

public void setPredictionIntervalMillis(long predictionIntervalMillis) {
this.predictionIntervalMillis = predictionIntervalMillis;
}

public int getNextPredictedQueuedCount() {
return nextPredictedQueuedCount;
}

public void setNextPredictedQueuedCount(int nextPredictedQueuedCount) {
this.nextPredictedQueuedCount = nextPredictedQueuedCount;
}

public long getNextPredictedQueuedBytes() {
return nextPredictedQueuedBytes;
}

public void setNextPredictedQueuedBytes(long nextPredictedQueuedBytes) {
this.nextPredictedQueuedBytes = nextPredictedQueuedBytes;
}

public long getPredictedTimeToCountBackpressureMillis() {
return predictedTimeToCountBackpressureMillis;
}

public void setPredictedTimeToCountBackpressureMillis(long predictedTimeToCountBackpressureMillis) {
this.predictedTimeToCountBackpressureMillis = predictedTimeToCountBackpressureMillis;
}

public long getPredictedTimeToBytesBackpressureMillis() {
return predictedTimeToBytesBackpressureMillis;
}

public void setPredictedTimeToBytesBackpressureMillis(long predictedTimeToBytesBackpressureMillis) {
this.predictedTimeToBytesBackpressureMillis = predictedTimeToBytesBackpressureMillis;
}

public int getPredictedPercentCount() {
return predictedPercentCount;
}

public void setPredictedPercentCount(int predictedPercentCount) {
this.predictedPercentCount = predictedPercentCount;
}

public int getPredictedPercentBytes() {
return predictedPercentBytes;
}

public void setPredictedPercentBytes(int predictedPercentBytes) {
this.predictedPercentBytes = predictedPercentBytes;
}

@Override
public ConnectionStatusPredictions clone() {
final ConnectionStatusPredictions clonedObj = new ConnectionStatusPredictions();
clonedObj.nextPredictedQueuedBytes = nextPredictedQueuedBytes;
clonedObj.nextPredictedQueuedCount = nextPredictedQueuedCount;
clonedObj.predictedTimeToBytesBackpressureMillis = predictedTimeToBytesBackpressureMillis;
clonedObj.predictedTimeToCountBackpressureMillis = predictedTimeToCountBackpressureMillis;
clonedObj.predictedPercentCount = predictedPercentCount;
clonedObj.predictedPercentBytes = predictedPercentBytes;
return clonedObj;
}

@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("ConnectionStatusPredictions [id=");
builder.append(", nextPredictedQueuedBytes=");
builder.append(nextPredictedQueuedBytes);
builder.append(", nextPredictedQueuedCount=");
builder.append(nextPredictedQueuedCount);
builder.append(", predictedTimeToBytesBackpressureMillis=");
builder.append(predictedTimeToBytesBackpressureMillis);
builder.append(", predictedTimeToCountBackpressureMillis=");
builder.append(predictedTimeToCountBackpressureMillis);
builder.append(", predictedPercentCount=");
builder.append(predictedPercentCount);
builder.append(", predictedPercentBytes=");
builder.append(predictedPercentBytes);
builder.append("]");
return builder.toString();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.nifi.controller.status.analytics;

import java.util.Date;

/**
* QueryWindow is used to track time intervals for querying for observations
*/
public class QueryWindow {

private long startTimeMillis;
private long endTimeMillis;

public QueryWindow(long startTimeMillis, long endTimeMillis) {
this.startTimeMillis = startTimeMillis;
this.endTimeMillis = endTimeMillis;
}

public long getStartTimeMillis() {
return startTimeMillis;
}

public void setStartTimeMillis(long startTimeMillis) {
this.startTimeMillis = startTimeMillis;
}

public long getEndTimeMillis() {
return endTimeMillis;
}

public void setEndTimeMillis(long endTimeMillis) {
this.endTimeMillis = endTimeMillis;
}

public Date getStartDateTime() {
return new Date(startTimeMillis);
}

public Date getEndDateTime() {
return new Date(endTimeMillis);
}

public long getTimeDifferenceMillis(){
return endTimeMillis - startTimeMillis;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.nifi.controller.status.analytics;

import java.util.Map;

/**
* The StatusAnalytics interface offers methods for accessing predicted and other values for a single component (Connection instance, e.g.).
*/
public interface StatusAnalytics {

/**
* Get the Query Window used by the analytics instance
* @return queryWindow
*/
QueryWindow getQueryWindow();

/**
* Get available predictions where the key (String) in the map is the name of the prediction and value (Long)
* is the value for the prediction
* @return map
*/
Map<String,Long> getPredictions();

/**
* Return if analytics object supports online learning
* @return boolean
*/
boolean supportsOnlineLearning();


}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.nifi.controller.status.analytics;

public interface StatusAnalyticsEngine {

/**
* Retrieve status analytics object for given component
* @param componentId identifier for component
* @return componenet specific status analytics object
*/
StatusAnalytics getStatusAnalytics(String componentId);

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.nifi.controller.status.analytics;

import java.util.Map;
import java.util.stream.Stream;

public interface StatusAnalyticsModel {

/**
* Train model with provided observations (features, labels/targets)
* @param features Stream of feature observation values
* @param labels target observation values
*/
void learn(Stream<Double[]> features, Stream<Double> labels);

/**
* Return a prediction given observation values
* @param feature feature observation values values
* @return prediction of target/label
*/
Double predict(Double[] feature);

/**
* Predict a feature given a known target and known predictor values (if multiple predictors are included with model)
* @param predictVariableIndex index of feature that we would like to predict (index should align with order provided in model learn method)
* @param knownVariablesWithIndex a map of known predictor values with their indexes if available
* @param label known target value
* @return prediction for variable
*/
Double predictVariable(Integer predictVariableIndex, Map<Integer,Double> knownVariablesWithIndex, Double label);

/**
* Indicate if model supports online learning (e.g. can learn new observation samples to create a model)
* @return boolean indicating online learning support
*/
Boolean supportsOnlineLearning();

/**
* Returns a map of scores relevant to model (e.g. rSquared, Confidence Intervals, etc.)
* @return Map of score names with values
*/
Map<String,Double> getScores();

/**
* Resets a model by clearing observations and other calculations
*/
void clear();

}
25 changes: 25 additions & 0 deletions nifi-assembly/LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -2583,6 +2583,31 @@ This product bundles 'lodash' which is available under an MIT license.
licenses; we recommend you read them, as their terms may differ from the
terms above.

This product bundles 'moment' which is available under an MIT license.

Copyright (c) JS Foundation and other contributors

Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

The binary distribution of this product bundles 'normalize.css'

NORMALIZE.CSS LICENSE
Expand Down
Loading