From d46dd56f6a6b687380a2e0a62a9d944b905869e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Romain=20Tarti=C3=A8re?= Date: Sun, 30 Jun 2024 18:27:22 +0200 Subject: [PATCH 1/3] Get rid of the Gemfile.lock The lockfile allow reproducible build, which are awesome. However, we also want to support multiple versions of Ruby, and a lockfile is unfortunately not a one-size-fit-all solution in this case: * Older versions of bundler cannot run on recent versions of Ruby; * Recent versions of bundler cannot run on older versions of Ruby; * Some dependencies are available for some versions of Ruby but not all the ones we support, so a version of Ruby may be unable to run the bundle generated by another version of Ruby. The lock file is only used when someone clone the repository and run `bundle install`. When installing with `gem install riemann-dash` (the way recommanded in the README), the dependencies only have to be in the bounds of what is authorized in the gemspec file, so this will only affect a fraction of our users which are probably aware of what they are doing. This allows us to run the test suite on all supported versions of Ruby. --- Gemfile.lock | 158 --------------------------------------------------- 1 file changed, 158 deletions(-) delete mode 100644 Gemfile.lock diff --git a/Gemfile.lock b/Gemfile.lock deleted file mode 100644 index ab3659a..0000000 --- a/Gemfile.lock +++ /dev/null @@ -1,158 +0,0 @@ -PATH - remote: . - specs: - riemann-dash (0.2.14) - erubi (~> 1.9.0) - multi_json (= 1.3.6) - sass (>= 3.1.14) - sinatra (>= 1.4.5, < 2.3.0) - webrick - -GEM - remote: https://rubygems.org/ - specs: - activesupport (7.1.3.4) - base64 - bigdecimal - concurrent-ruby (~> 1.0, >= 1.0.2) - connection_pool (>= 2.2.5) - drb - i18n (>= 1.6, < 2) - minitest (>= 5.1) - mutex_m - tzinfo (~> 2.0) - addressable (2.8.7) - public_suffix (>= 2.0.2, < 7.0) - async (2.12.1) - console (~> 1.25, >= 1.25.2) - fiber-annotation - io-event (~> 1.6, >= 1.6.5) - async-http (0.69.0) - async (>= 2.10.2) - async-pool (~> 0.7) - io-endpoint (~> 0.11) - io-stream (~> 0.4) - protocol-http (~> 0.26) - protocol-http1 (~> 0.19) - protocol-http2 (~> 0.18) - traces (>= 0.10) - async-http-faraday (0.14.0) - async-http (~> 0.42) - faraday - async-pool (0.7.0) - async (>= 1.25) - base64 (0.2.0) - bigdecimal (3.1.8) - concurrent-ruby (1.3.3) - connection_pool (2.4.1) - console (1.25.2) - fiber-annotation - fiber-local (~> 1.1) - json - drb (2.2.1) - erubi (1.9.0) - faraday (2.9.2) - faraday-net_http (>= 2.0, < 3.2) - faraday-http-cache (2.5.1) - faraday (>= 0.8) - faraday-net_http (3.1.0) - net-http - ffi (1.17.0) - ffi (1.17.0-aarch64-linux-gnu) - ffi (1.17.0-aarch64-linux-musl) - ffi (1.17.0-arm-linux-gnu) - ffi (1.17.0-arm-linux-musl) - ffi (1.17.0-arm64-darwin) - ffi (1.17.0-x86-linux-gnu) - ffi (1.17.0-x86-linux-musl) - ffi (1.17.0-x86_64-darwin) - ffi (1.17.0-x86_64-linux-gnu) - ffi (1.17.0-x86_64-linux-musl) - fiber-annotation (0.2.0) - fiber-local (1.1.0) - fiber-storage - fiber-storage (0.1.2) - github_changelog_generator (1.16.4) - activesupport - async (>= 1.25.0) - async-http-faraday - faraday-http-cache - multi_json - octokit (~> 4.6) - rainbow (>= 2.2.1) - rake (>= 10.0) - i18n (1.14.5) - concurrent-ruby (~> 1.0) - io-endpoint (0.11.0) - io-event (1.6.5) - io-stream (0.4.0) - json (2.7.2) - minitest (5.24.1) - multi_json (1.3.6) - mustermann (2.0.2) - ruby2_keywords (~> 0.0.1) - mutex_m (0.2.0) - net-http (0.4.1) - uri - octokit (4.25.1) - faraday (>= 1, < 3) - sawyer (~> 0.9) - protocol-hpack (1.4.3) - protocol-http (0.26.6) - protocol-http1 (0.19.1) - protocol-http (~> 0.22) - protocol-http2 (0.18.0) - protocol-hpack (~> 1.4) - protocol-http (~> 0.18) - public_suffix (6.0.0) - rack (2.2.9) - rack-protection (2.2.4) - rack - rainbow (3.1.1) - rake (13.2.1) - rb-fsevent (0.11.2) - rb-inotify (0.11.1) - ffi (~> 1.0) - ruby2_keywords (0.0.5) - sass (3.7.4) - sass-listen (~> 4.0.0) - sass-listen (4.0.0) - rb-fsevent (~> 0.9, >= 0.9.4) - rb-inotify (~> 0.9, >= 0.9.7) - sawyer (0.9.2) - addressable (>= 2.3.5) - faraday (>= 0.17.3, < 3) - sinatra (2.2.4) - mustermann (~> 2.0) - rack (~> 2.2) - rack-protection (= 2.2.4) - tilt (~> 2.0) - tilt (2.4.0) - traces (0.11.1) - tzinfo (2.0.6) - concurrent-ruby (~> 1.0) - uri (0.13.0) - webrick (1.8.1) - -PLATFORMS - aarch64-linux-gnu - aarch64-linux-musl - amd64-freebsd-14 - arm-linux-gnu - arm-linux-musl - arm64-darwin - ruby - x86-linux-gnu - x86-linux-musl - x86_64-darwin - x86_64-linux-gnu - x86_64-linux-musl - -DEPENDENCIES - github_changelog_generator - minitest - rake - riemann-dash! - -BUNDLED WITH - 2.5.13 From bd0835926f892e0ec8236bdbd104733cdf294485 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Romain=20Tarti=C3=A8re?= Date: Thu, 21 Nov 2024 13:07:59 -1000 Subject: [PATCH 2/3] Improve readability of large grid with a lot of data When a large table is displayed and is larger than the screen size, it is not possible to scroll to see *all* the data. One can zoom-out to have a accomodate more data, but this does not fix the issue as: 1. The displayed data is smaller, making it harder to read it beyond checking the color that represent the state of the metric; 2. Zooming out is limited and at some point more data is still out of sight. This make the table scrollable in its container. Both horizontal and vertical headers stick to their position to make it easier to track what is being viewed. --- lib/riemann/dash/views/css.scss | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/lib/riemann/dash/views/css.scss b/lib/riemann/dash/views/css.scss index 66fe72e..27ee94a 100644 --- a/lib/riemann/dash/views/css.scss +++ b/lib/riemann/dash/views/css.scss @@ -441,6 +441,7 @@ h2 { left: 0; right: 0; bottom: 0; + overflow: auto; } .bar { @@ -468,6 +469,7 @@ h2 { th { text-align: right; + background-color: #fff; } thead { @@ -475,11 +477,28 @@ h2 { padding: 0; th { - // Work around https://bugs.webkit.org/show_bug.cgi?id=20040 - position: relative; - top: 3px; vertical-align: bottom; text-align: left; + position: sticky; + top: 0; + z-index: 1; + + &:first-child { + left: 0; + z-index: 2; + } + } + } + + tbody { + tr:hover, tr:hover th { + background-color: $cream; + } + + th { + position: sticky; + left: 0; + z-index: 1; } } } From c75816aa6b48fc43f6f467a5ad11196fbc92aa5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Romain=20Tarti=C3=A8re?= Date: Tue, 7 Jan 2025 09:20:22 -1000 Subject: [PATCH 3/3] Format TTL for humans When viewing details of events with a long TTL, it is not straightforward to check if it is about to expire or not. Instead of displayer the raw TTL as a number of seconds, format it by using an appropriate unit of time and fixed precision: * 42 => "42 seconds" * 420 => "7.0 minutes" * 4200 => "70.0 minutes" * 42000 => "11.7 hours" * 420000 => "4.9 days" --- lib/riemann/dash/public/eventPane.js | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/lib/riemann/dash/public/eventPane.js b/lib/riemann/dash/public/eventPane.js index ada8973..9b442c7 100644 --- a/lib/riemann/dash/public/eventPane.js +++ b/lib/riemann/dash/public/eventPane.js @@ -1,5 +1,19 @@ // Pane at the bottom of the dashboard for displaying events in context. +function format_ttl(ttl) { + if (parseInt(ttl) != ttl) { + return ttl; + } + + if (ttl > 3600 * 48) { + return (ttl / 3600 / 24).toFixed(1) + " days"; + } else if (ttl > 3600 * 2) { + return (ttl / 3600).toFixed(1) + " hours"; + } else if (ttl > 60 * 2) { + return (ttl / 60).toFixed(1) + " minutes"; + } + return ttl + " seconds"; +} var eventPane = (function() { var el = $('#event-pane'); var fixedFields = ['host', 'service', 'time', 'state', 'metric', 'ttl', 'description', 'tags']; @@ -11,7 +25,7 @@ var eventPane = (function() { '{{-state}}' + '{{-metric}}' + '' + - '{{-ttl}}' + + '{{-format_ttl(ttl)}}' + '{{-tags}}' + '' + '
{{-description}}
');