Skip to content

Commit

Permalink
The incident histogram shows buckets per time period, so when the par…
Browse files Browse the repository at this point in the history
…tition checks are reexecuted, they don't stack up on the most recent date.
  • Loading branch information
piotrczarnas committed Sep 23, 2024
1 parent 3e37473 commit 2ae9472
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -666,6 +666,7 @@ public IncidentIssueHistogramModel buildDailyIssuesHistogramForIncident(String c
Selection notProfilingSelection = checkTypeColumn.isNotEqualTo(CheckType.profiling.getDisplayName());

InstantColumn executedAtColumn = checkResultsNormalizedResult.getExecutedAtColumn();
DateTimeColumn timePeriodColumn = checkResultsNormalizedResult.getTimePeriodColumn();

Selection issuesInTimeRange = executedAtColumn.isBetweenIncluding(
PackedInstant.pack(startTimestamp), PackedInstant.pack(incidentUntil));
Expand All @@ -692,8 +693,8 @@ public IncidentIssueHistogramModel buildDailyIssuesHistogramForIncident(String c
}

Integer severity = severityColumn.get(rowIndex);
Instant executedAt = executedAtColumn.get(rowIndex);
LocalDate executedAtDate = executedAt.atZone(defaultTimeZoneId).toLocalDate();
LocalDateTime timePeriod = timePeriodColumn.get(rowIndex);
LocalDate timePeriodDate = timePeriod.toLocalDate();
String columnName = columnNameColumn.get(rowIndex);
String checkName = checkNameColumn.get(rowIndex);
String checkTypeString = checkTypeColumn.get(rowIndex);
Expand All @@ -704,12 +705,12 @@ public IncidentIssueHistogramModel buildDailyIssuesHistogramForIncident(String c
columnName = CheckResultsDataService.COLUMN_NAME_TABLE_CHECKS_PLACEHOLDER;
}

boolean dateMatch = filterParameters.getDate() == null || Objects.equals(filterParameters.getDate(), executedAtDate);
boolean dateMatch = filterParameters.getDate() == null || Objects.equals(filterParameters.getDate(), timePeriodDate);
boolean columnMatch = Strings.isNullOrEmpty(filterParameters.getColumn()) || Objects.equals(filterParameters.getColumn(), columnName);
boolean checkMatch = Strings.isNullOrEmpty(filterParameters.getCheck()) || Objects.equals(filterParameters.getCheck(), checkName);

if (columnMatch && checkMatch) {
histogramModel.incrementSeverityForDay(executedAtDate, severity);
histogramModel.incrementSeverityForDay(timePeriodDate, severity);
}

if (dateMatch && checkMatch) {
Expand Down

0 comments on commit 2ae9472

Please sign in to comment.