noob-se7en commented on code in PR #17749:
URL: https://github.com/apache/pinot/pull/17749#discussion_r2883047292
##########
pinot-core/src/main/java/org/apache/pinot/core/data/manager/realtime/IngestionDelayTracker.java:
##########
@@ -570,20 +574,38 @@ public long getPartitionEndToEndIngestionDelayMs(int
partitionId) {
*
* @param partitionId partition for which we are retrieving the delay
*
- * @return ingestion delay in milliseconds for the given partition ID.
+ * @return ingestion delay in milliseconds for the given partition ID,
+ * or null if ingestion time is not available for the partition.
*/
- public long getPartitionIngestionDelayMs(int partitionId) {
+ public Long getPartitionIngestionDelayMs(int partitionId) {
IngestionInfo ingestionInfo = _ingestionInfoMap.get(partitionId);
- long ingestionTimeMs = 0;
- if ((ingestionInfo != null) && (ingestionInfo._ingestionTimeMs > 0)) {
- ingestionTimeMs = ingestionInfo._ingestionTimeMs;
+ if (ingestionInfo == null || ingestionInfo._ingestionTimeMs < 0) {
+ return null;
}
// Compute aged delay for current partition
- long agedIngestionDelayMs = _clock.millis() - ingestionTimeMs;
+ long agedIngestionDelayMs = _clock.millis() -
ingestionInfo._ingestionTimeMs;
// Correct to zero for any time shifts due to NTP or time reset.
return Math.max(agedIngestionDelayMs, 0);
}
+ /**
+ * Method to get if ingestion delay data is available for the given
partition (i.e. ingestion info has been
+ * reported and both timestamps are valid)
+ *
+ * @param partitionId partition for which we are checking data availability
+ *
+ * @return 1 if ingestion delay data is available, 0 otherwise
+ */
+ public long getPartitionIngestionDelayHasData(int partitionId) {
+ IngestionInfo ingestionInfo = _ingestionInfoMap.get(partitionId);
+ if (ingestionInfo == null
+ || ingestionInfo._ingestionTimeMs < 0
+ || ingestionInfo._firstStreamIngestionTimeMs < 0) {
+ return 0;
Review Comment:
We should only return 0 here when `ingestionInfo == null`.
Since `ingestionInfo == null ` can happen when consumer fails to report its
status and thats only then `REALTIME_INGESTION_DELAY_HAS_DATA` should be set.
If consumer reports the ingestion status successfully still
`ingestionInfo._firstStreamIngestionTimeMs < 0` or
`ingestionInfo._ingestionTimeMs < 0` can happen and for that we dont want to
get an alert.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]