diff --git a/config.yml b/config.yml index a9aae98..0e97a00 100644 --- a/config.yml +++ b/config.yml @@ -27,6 +27,33 @@ runcharts: size: x: 15 y: 15 + - title: SEARCH ENGINE RESPONSE TIME 2 (sec) + items: + - label: GOOGLE + script: curl -o /dev/null -s -w '%{time_total}' https://www.google.com/ + - label: YAHOO + script: curl -o /dev/null -s -w '%{time_total}' https://search.yahoo.com/ + - label: BING + script: curl -o /dev/null -s -w '%{time_total}' https://www.bing.com/ + refresh-rate-ms: 5000 + decimal-places: 3 + alert: + value: + more-than: 0.231 + less-than: 0.123 + equal: 0.144 + indicator: + terminal: true + beep: true + legend: + enabled: true + details: true + position: + x: 0 + y: 15 + size: + x: 15 + y: 15 - title: MONGO COLLECTIONS COUNT items: - label: POSTS diff --git a/config/default.go b/config/default.go index 389cae6..5233335 100644 --- a/config/default.go +++ b/config/default.go @@ -38,7 +38,7 @@ func (config *Config) setDefaultColors() { for i, chart := range config.RunCharts { for j, item := range chart.Items { if item.Color == 0 { - item.Color = palette.Colors[i+j] + item.Color = palette.Colors[i+j] // TODO handle out of range case chart.Items[j] = item } } diff --git a/console/console.go b/console/console.go index afab133..e0dbd28 100644 --- a/console/console.go +++ b/console/console.go @@ -8,7 +8,7 @@ import ( ) const ( - RenderRate = 50 * time.Millisecond // TODO not a constant, should be dynamically chosen based on min X scale (per each chart? should be tested). if it is 1 sec, it should be 100 ms, if 2 - 200 ms, if 3 - 300, 4 - 400, 5 - 500 and 500 is max. smth like that. + RenderRate = 25 * time.Millisecond Title = "sampler" ) diff --git a/console/palette.go b/console/palette.go index 71f4f1a..b1c4be3 100644 --- a/console/palette.go +++ b/console/palette.go @@ -21,14 +21,15 @@ const ( type Palette struct { Colors []ui.Color + // TODO Menu colors, like Dark, Medium, Light etc } func GetPalette(theme Theme) Palette { switch theme { case ThemeDark: - return Palette{Colors: []ui.Color{ColorOlive, ColorDeepSkyBlue, ColorDeepPink}} + return Palette{Colors: []ui.Color{ColorOlive, ColorDeepSkyBlue, ColorDeepPink, ColorOlive, ColorDeepSkyBlue, ColorDeepPink}} case ThemeLight: - return Palette{Colors: []ui.Color{ColorOlive, ColorDeepSkyBlue, ColorDeepPink}} + return Palette{Colors: []ui.Color{ColorOlive, ColorDeepSkyBlue, ColorDeepPink, ColorOlive, ColorDeepSkyBlue, ColorDeepPink}} default: panic(fmt.Sprintf("Following theme is not supported: %v", theme)) } diff --git a/data/sampler.go b/data/sampler.go index bb03caf..41d1097 100644 --- a/data/sampler.go +++ b/data/sampler.go @@ -11,15 +11,11 @@ type Sampler struct { func NewSampler(consumer Consumer, item Item, rateMs int) Sampler { - ticker := time.NewTicker(time.Duration(rateMs * int(time.Millisecond))) sampler := Sampler{consumer, item} go func() { - for { - select { - case <-ticker.C: - sampler.sample() - } + for t := time.Tick(time.Duration(rateMs * int(time.Millisecond))); ; <-t { + sampler.sample() } }()