Skip to content

Commit

Permalink
fix: wrong default TimeFormat (#549)
Browse files Browse the repository at this point in the history
  • Loading branch information
ionling authored Aug 1, 2024
1 parent ad17a64 commit 3635e0f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
9 changes: 5 additions & 4 deletions cmd/easeprobe/report.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ func scheduleSLA(probers []probe.Prober) {
}

time := conf.Get().Settings.SLAReport.Time
tz := global.GetEaseProbe().TimeZone
switch conf.Get().Settings.SLAReport.Schedule {
case conf.Minutely:
cron.Cron("* * * * *").Do(SLAFn)
Expand All @@ -104,16 +105,16 @@ func scheduleSLA(probers []probe.Prober) {
log.Infof("Scheduling hourly SLA reports...")
case conf.Daily:
cron.Every(1).Day().At(time).Do(SLAFn)
log.Infof("Scheduling daily SLA reports at %s UTC time...", time)
log.Infof("Scheduling daily SLA reports at %s %s time...", time, tz)
case conf.Weekly:
cron.Every(1).Day().Sunday().At(time).Do(SLAFn)
log.Infof("Scheduling weekly SLA reports on Sunday at %s UTC time...", time)
log.Infof("Scheduling weekly SLA reports on Sunday at %s %s time...", time, tz)
case conf.Monthly:
cron.Every(1).MonthLastDay().At(time).Do(SLAFn)
log.Infof("Scheduling monthly SLA reports for last day of the month at %s UTC time...", time)
log.Infof("Scheduling monthly SLA reports for last day of the month at %s %s time...", time, tz)
default:
cron.Every(1).Day().At("00:00").Do(SLAFn)
log.Warnf("Bad Scheduling! Setting daily SLA reports to be sent at 00:00 UTC...")
log.Warnf("Bad Scheduling! Setting daily SLA reports to be sent at 00:00 %s...", tz)
}

cron.StartAsync()
Expand Down
4 changes: 2 additions & 2 deletions conf/conf.go
Original file line number Diff line number Diff line change
Expand Up @@ -310,8 +310,8 @@ func New(conf *string) (*Conf, error) {
IconURL: global.DefaultIconURL,
PIDFile: filepath.Join(global.GetWorkDir(), global.DefaultPIDFile),
Log: NewLog(),
TimeFormat: "2006-01-02 15:04:05 UTC",
TimeZone: "UTC",
TimeFormat: global.DefaultTimeFormat,
TimeZone: global.DefaultTimeZone,
Probe: Probe{
Interval: global.DefaultProbeInterval,
Timeout: global.DefaultTimeOut,
Expand Down
4 changes: 3 additions & 1 deletion docs/Manual.md
Original file line number Diff line number Diff line change
Expand Up @@ -1191,7 +1191,9 @@ settings:
sla:
# minutely, hourly, daily, weekly (Sunday), monthly (Last Day), none
schedule: "weekly"
# UTC time, the format is 'hour:min:sec'
# the time to send the SLA report. Ignored on hourly and minutely schedules
# - the format is 'hour:min:sec'.
# - the timezone can be configured by `settings.timezone`, default is UTC.
time: "23:59"
```
Expand Down

0 comments on commit 3635e0f

Please sign in to comment.