Skip to content

Commit

Permalink
trivial. change to empty value after today on pod-restart-calendar.
Browse files Browse the repository at this point in the history
  • Loading branch information
ktkfree committed Jun 19, 2023
1 parent 44121c8 commit 96b9da4
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions internal/usecase/dashboard.go
Original file line number Diff line number Diff line change
Expand Up @@ -391,23 +391,23 @@ func (u *DashboardUsecase) getChartFromPrometheus(organizationId string, chartTy
}
baseDate := d.Format("2006-01-02")

if baseDate > now.Format("2006-01-02") {
break
}

cntPodRestartStr := ""
cntPodRestart := 0
for _, alert := range alerts {
strDate := alert.CreatedAt.Format("2006-01-02")

if strDate == baseDate {
cntPodRestart += 1
if baseDate <= now.Format("2006-01-02") {
for _, alert := range alerts {
strDate := alert.CreatedAt.Format("2006-01-02")

if strDate == baseDate {
cntPodRestart += 1
}
}
cntPodRestartStr = fmt.Sprintf("%d", int(cntPodRestart))
}

dd := time.Date(d.Year(), d.Month(), d.Day(), 0, 0, 0, 0, time.UTC)
xAxisData = append(xAxisData, strconv.Itoa(int(dd.Unix())))
yAxisData = append(yAxisData, fmt.Sprintf("%d", int(cntPodRestart)))

yAxisData = append(yAxisData, cntPodRestartStr)
}

chartData.XAxis.Data = xAxisData
Expand Down

0 comments on commit 96b9da4

Please sign in to comment.