Skip to content

Commit

Permalink
alerting: add warning notification for skipping uploads on holidays
Browse files Browse the repository at this point in the history
  • Loading branch information
darwinz committed Jun 15, 2022
1 parent f2c7610 commit 32a91ce
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions internal/pipeline/aggregate.go
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ func (xfagg *aggregator) uploadFile(index int, agent upload.Agent, res *transfor

// Send Slack/PD or whatever notifications after the file is uploaded
if err := xfagg.notifyAfterUpload(filename, res.File, agent, err); err != nil {
xfagg.alertOnWarning(xfagg.logger.LogError(err).Err())
xfagg.alertOnError(xfagg.logger.LogError(err).Err())
}

// record our upload metrics
Expand Down Expand Up @@ -335,18 +335,23 @@ func (xfagg *aggregator) notifyAfterUpload(filename string, file *ach.File, agen
}

func (xfagg *aggregator) notifyAboutHoliday(day *schedule.Day) {
var msg string
logger := xfagg.logger.With(log.Fields{
"shard": log.String(xfagg.shard.Name),
})

if !day.FirstWindow {
logger.Info().Log("skipping holiday notification")
msg = "skipping holiday notification"
xfagg.alertOnWarning(errors.New(msg))
logger.Info().Logf(msg)
return
}

uploadAgent := xfagg.uploadAgents.Find(xfagg.shard.UploadAgent)
if uploadAgent == nil {
logger.Warn().Logf("skipping holiday log for %v", day.Time.Format("2006-01-02"))
msg = fmt.Sprintf("skipping holiday log for %v", day.Time.Format("2006-01-02"))
xfagg.alertOnWarning(errors.New(msg))
logger.Warn().Logf(msg)
return
}

Expand Down

0 comments on commit 32a91ce

Please sign in to comment.