diff --git a/component/layout/layout.go b/component/layout/layout.go index 28da451..c7da540 100644 --- a/component/layout/layout.go +++ b/component/layout/layout.go @@ -110,6 +110,7 @@ func (l *Layout) HandleConsoleEvent(e string) { l.changeMode(ModeDefault) } case console.KeyEsc: + l.resetAlerts() switch l.mode { case ModeChartPinpoint: selected.CommandChannel <- &data.Command{Type: runchart.CommandDisableSelection} @@ -273,3 +274,9 @@ func (l *Layout) Draw(buffer *ui.Buffer) { l.statusbar.Draw(buffer) l.menu.Draw(buffer) } + +func (l *Layout) resetAlerts() { + for _, c := range l.Components { + c.AlertChannel <- nil + } +} diff --git a/config.yml b/config.yml index 043c33f..a745f5f 100644 --- a/config.yml +++ b/config.yml @@ -8,7 +8,7 @@ runcharts: h: 16 triggers: - title: Latency threshold exceeded - condition: echo "$prev < 0.2 && $cur > 0.2" |bc -l + condition: echo "$prev < 0.3 && $cur > 0.3" |bc -l actions: terminal-bell: true sound: true diff --git a/config/config.go b/config/config.go index 3ad3716..ce64c29 100644 --- a/config/config.go +++ b/config/config.go @@ -24,16 +24,16 @@ type Flags struct { func Load() (Config, Flags) { - //if len(os.Args) < 2 { - // println("Please specify config file location. See www.github.com/sqshq/sampler for the reference") - // os.Exit(0) - //} + if len(os.Args) < 2 { + println("Please specify config file location. See www.github.com/sqshq/sampler for the reference") + os.Exit(0) + } - cfg := readFile("config.yml") + cfg := readFile(os.Args[1]) cfg.validate() cfg.setDefaults() - flg := Flags{ConfigFileName: "config.yml"} + flg := Flags{ConfigFileName: os.Args[1]} return *cfg, flg }