dasahcc commented on a change in pull request #1111:
URL: https://github.com/apache/helix/pull/1111#discussion_r444514270
##########
File path:
helix-core/src/main/java/org/apache/helix/monitoring/mbeans/ClusterStatusMonitor.java
##########
@@ -289,6 +288,32 @@ public void setClusterInstanceStatus(Set<String>
liveInstanceSet, Set<String> in
}
}
}
+
+ // update all message related gauges
+ long now = System.currentTimeMillis();
+ long totalMsgQueueSize = 0L;
+ long maxInstanceMsgQueueSize = 0L;
+ long totalPastdueMsgSize = 0L;
+ for (String instance : instanceMessageMap.keySet()) {
+ Set<Message> messages = instanceMessageMap.get(instance);
+ InstanceMonitor bean = _instanceMonitorMap.get(instance);
+
+ long msgQueueSize = messages.size();
+ bean.updateMessageQueueSize(msgQueueSize);
+ totalMsgQueueSize += msgQueueSize;
+ if (msgQueueSize > maxInstanceMsgQueueSize) {
+ maxInstanceMsgQueueSize = msgQueueSize;
+ }
+
+ long pastdueMsgCount = messages.stream()
Review comment:
pastDueMsgCount
##########
File path: helix-core/src/main/java/org/apache/helix/model/Message.java
##########
@@ -522,12 +538,25 @@ public long getExecuteStartTimeStamp() {
/**
* Get the time that this message was created
- * @return UNIX timestamp
+ * @return UNIX epoch timestamp
Review comment:
This is not epoch time. epoch time is not at milisecond but second level.
##########
File path: helix-core/src/main/java/org/apache/helix/model/Message.java
##########
@@ -117,6 +120,11 @@
// Currently, the field is only used for invalidating messages in
controller's message cache.
private boolean _expired = false;
+ // The expect period of time (in ms) that a message should be completed,
default 1 day
+ public static final long MESSAGE_EXPECT_COMPLETION_PERIOD = HelixUtil
Review comment:
Do we want to have this param for our internal message report or
including for some user defined messages? It is hard to define the time from
user perspective.
##########
File path: helix-core/src/main/java/org/apache/helix/model/Message.java
##########
@@ -173,6 +181,14 @@ public void setCreateTimeStamp(long timestamp) {
_record.setLongField(Attributes.CREATE_TIMESTAMP.toString(), timestamp);
}
+ /**
+ * Set the time that the message was expected to be completed
+ * @param timestamp a UNIX epoch timestamp
+ */
+ public void setCompletionDueTimeStamp(long timestamp) {
+ _record.setLongField(Attributes.COMPLETION_DUE_TIMESTAMP.name(),
timestamp);
Review comment:
Do we need any validation here? For example, it timestamp already <
currentmilisecond.
##########
File path: helix-core/src/main/java/org/apache/helix/model/Message.java
##########
@@ -522,12 +538,25 @@ public long getExecuteStartTimeStamp() {
/**
* Get the time that this message was created
- * @return UNIX timestamp
+ * @return UNIX epoch timestamp
*/
public long getCreateTimeStamp() {
return _record.getLongField(Attributes.CREATE_TIMESTAMP.toString(), 0L);
}
+ /**
+ * Get the time that the message was expected to be completed
+ * @return UNIX epoch timestamp
+ */
+ public long getCompletionDueTimeStamp() {
+ long completionDue =
_record.getLongField(Attributes.COMPLETION_DUE_TIMESTAMP.name(), 0L);
+ if (completionDue == 0) {
+ completionDue = getCreateTimeStamp() + MESSAGE_EXPECT_COMPLETION_PERIOD;
+ }
Review comment:
We can combine it as:
long completionDue =
_record.getLongField(Attributes.COMPLETION_DUE_TIMESTAMP.name(),
getCreateTimeStamp() + MESSAGE_EXPECT_COMPLETION_PERIOD);
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]