NIFI-10139: Adding fields to RemoteProcessGroupStatus (#6137)

This commit is contained in:
Joe Gresock 2022-06-22 12:24:23 -04:00 committed by GitHub
parent edd862bf55
commit 3dda694fd6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 48 additions and 0 deletions

View File

@ -20,6 +20,7 @@ import org.apache.nifi.registry.flow.VersionedFlowState;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
@ -586,6 +587,13 @@ public class ProcessGroupStatus implements Cloneable {
merged.setSentContentSize(merged.getSentContentSize() + statusToMerge.getSentContentSize());
merged.setSentCount(merged.getSentCount() + statusToMerge.getSentCount());
merged.setActiveThreadCount(merged.getActiveThreadCount() + statusToMerge.getActiveThreadCount());
// Take the earliest last refresh time
final Date mergedLastRefreshTime = merged.getLastRefreshTime();
final Date toMergeLastRefreshTime = statusToMerge.getLastRefreshTime();
if (mergedLastRefreshTime == null || (toMergeLastRefreshTime != null && toMergeLastRefreshTime.before(mergedLastRefreshTime))) {
merged.setLastRefreshTime(toMergeLastRefreshTime);
}
}
target.setRemoteProcessGroupStatus(mergedRemoteGroupMap.values());

View File

@ -16,6 +16,7 @@
*/
package org.apache.nifi.controller.status;
import java.util.Date;
import java.util.concurrent.TimeUnit;
/**
@ -28,6 +29,9 @@ public class RemoteProcessGroupStatus implements Cloneable {
private TransmissionStatus transmissionStatus;
private String uri;
private String name;
private String comments;
private String authorizationIssue;
private Date lastRefreshTime;
private Integer activeThreadCount;
private int sentCount;
private long sentContentSize;
@ -70,6 +74,30 @@ public class RemoteProcessGroupStatus implements Cloneable {
this.name = name;
}
public String getComments() {
return comments;
}
public void setComments(String comments) {
this.comments = comments;
}
public String getAuthorizationIssue() {
return authorizationIssue;
}
public void setAuthorizationIssue(String authorizationIssue) {
this.authorizationIssue = authorizationIssue;
}
public Date getLastRefreshTime() {
return lastRefreshTime;
}
public void setLastRefreshTime(Date lastRefreshTime) {
this.lastRefreshTime = lastRefreshTime;
}
public String getId() {
return id;
}
@ -156,6 +184,9 @@ public class RemoteProcessGroupStatus implements Cloneable {
clonedObj.id = id;
clonedObj.groupId = groupId;
clonedObj.name = name;
clonedObj.comments = comments;
clonedObj.authorizationIssue = authorizationIssue;
clonedObj.lastRefreshTime = lastRefreshTime;
clonedObj.uri = uri;
clonedObj.activeThreadCount = activeThreadCount;
clonedObj.transmissionStatus = transmissionStatus;
@ -178,6 +209,12 @@ public class RemoteProcessGroupStatus implements Cloneable {
builder.append(groupId);
builder.append(", name=");
builder.append(name);
builder.append(", comments=");
builder.append(comments);
builder.append(", authorizationIssue=");
builder.append(authorizationIssue);
builder.append(", lastRefreshTime=");
builder.append(lastRefreshTime);
builder.append(", uri=");
builder.append(uri);
builder.append(", activeThreadCount=");

View File

@ -510,6 +510,9 @@ public abstract class AbstractEventAccess implements EventAccess {
final RemoteProcessGroupStatus status = new RemoteProcessGroupStatus();
status.setGroupId(remoteGroup.getProcessGroup().getIdentifier());
status.setName(isRemoteProcessGroupAuthorized ? remoteGroup.getName() : remoteGroup.getIdentifier());
status.setComments(isRemoteProcessGroupAuthorized ? remoteGroup.getComments() : null);
status.setAuthorizationIssue(remoteGroup.getAuthorizationIssue());
status.setLastRefreshTime(remoteGroup.getLastRefreshTime());
status.setTargetUri(isRemoteProcessGroupAuthorized ? remoteGroup.getTargetUri() : null);
long lineageMillis = 0L;