Skip to content

Commit

Permalink
Add missing messages to old messages report (Azure#137)
Browse files Browse the repository at this point in the history
  • Loading branch information
ancaantochi authored Aug 8, 2018
1 parent e2583df commit 7f374ea
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions edge-modules/MessagesAnalyzer/Reporter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,9 @@ static ModuleReport GetReceivedMessagesReport(string moduleId, double toleranceI
if (msg.SequenceNumber - 1 != prevSequenceNumber)
{
Log.LogInformation($"Missing messages for {moduleId} from {prevSequenceNumber} to {msg.SequenceNumber}");
missingCounter += msg.SequenceNumber - prevSequenceNumber;
missingIntervals.Add(new MissedMessagesDetails(msg.SequenceNumber - prevSequenceNumber, prevEnquedDateTime, msg.EnquedDateTime));
long currentMissing = msg.SequenceNumber - prevSequenceNumber - 1;
missingCounter += currentMissing;
missingIntervals.Add(new MissedMessagesDetails(currentMissing, prevEnquedDateTime, msg.EnquedDateTime));
}
else
{
Expand All @@ -74,7 +75,7 @@ static ModuleReport GetReceivedMessagesReport(string moduleId, double toleranceI

//check if last message is older
if (DateTime.Compare(lastMessageDateTime.AddMilliseconds(toleranceInMilliseconds), endDateTime) < 0)
return new ModuleReport(moduleId, StatusCode.OldMessages, totalMessagesCounter, $"No messages received for the past {toleranceInMilliseconds} milliseconds", lastMessageDateTime);
return new ModuleReport(moduleId, StatusCode.OldMessages, totalMessagesCounter, $"No messages received for the past {toleranceInMilliseconds} milliseconds", lastMessageDateTime, missingIntervals);

return missingCounter > 0 ? new ModuleReport(moduleId, StatusCode.SkippedMessages, totalMessagesCounter, $"Missing messages: {missingCounter}", lastMessageDateTime, missingIntervals)
: new ModuleReport(moduleId, StatusCode.AllMessages, totalMessagesCounter, $"All messages received", lastMessageDateTime);
Expand Down

0 comments on commit 7f374ea

Please sign in to comment.