diff options
author | drebs <drebs@riseup.net> | 2017-10-17 02:21:23 -0200 |
---|---|---|
committer | drebs <drebs@riseup.net> | 2017-10-17 02:49:16 -0200 |
commit | bb8c98053434e5aa0de09b0a2a0fbe35e69542f3 (patch) | |
tree | ba80802ca61fa8b2bd03c79c057d191e4abfbe95 /jobs | |
parent | c3e807eb42ea7389676b714584bde204eab18577 (diff) |
Add benchmark status to dashboard.
A "benchmarks" widget is added, together with a update job. The job
queries the benchmarks.leap.se website and shows current benchmarking
status and outliers. It's a simple start for something that can get more
complex depending on identified needs.
Diffstat (limited to 'jobs')
-rw-r--r-- | jobs/update_benchmark.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/jobs/update_benchmark.rb b/jobs/update_benchmark.rb new file mode 100644 index 0000000..8e98db3 --- /dev/null +++ b/jobs/update_benchmark.rb @@ -0,0 +1,16 @@ +require "json" +require "net/http" +require "uri" + +outliers_uri = URI.parse("https://benchmarks.leap.se/outliers.json") +is_benchmarked_uri = URI.parse("https://benchmarks.leap.se/is-benchmarked.html") + +SCHEDULER.every '5m', :first_in => 0 do |job| + response = Net::HTTP.get(outliers_uri) + outliers = JSON.parse(response) + + response = Net::HTTP.get(is_benchmarked_uri) + benchmarked = response.gsub /<[^>]+>/, '' + + send_event('benchmarks', { "good": outliers["good"].length, "bad": outliers["bad"].length, "is-benchmarked-status": benchmarked}) +end |