rails_performance 1.5.2 → 1.6.0.pre1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
 - data/Rakefile +2 -3
 - data/app/controllers/rails_performance/base_controller.rb +3 -0
 - data/app/controllers/rails_performance/rails_performance_controller.rb +1 -2
 - data/app/engine_assets/javascripts/apex_ext.js +30 -0
 - data/app/engine_assets/javascripts/application.js +8 -0
 - data/app/engine_assets/javascripts/autoupdate.js +78 -0
 - data/app/engine_assets/javascripts/charts.js +193 -0
 - data/app/{views/rails_performance → engine_assets}/javascripts/navbar.js +10 -8
 - data/app/{views/rails_performance → engine_assets}/javascripts/panel.js +5 -1
 - data/app/engine_assets/javascripts/table.js +7 -0
 - data/app/{views/rails_performance → engine_assets}/stylesheets/responsive.css +10 -10
 - data/app/{views/rails_performance → engine_assets}/stylesheets/style.css +6 -0
 - data/app/helpers/rails_performance/rails_performance_helper.rb +0 -8
 - data/app/views/rails_performance/_panel.html.erb +4 -2
 - data/app/views/rails_performance/layouts/rails_performance.html.erb +16 -8
 - data/app/views/rails_performance/rails_performance/_summary.html.erb +4 -2
 - data/app/views/rails_performance/rails_performance/custom.html.erb +6 -13
 - data/app/views/rails_performance/rails_performance/delayed_job.html.erb +6 -13
 - data/app/views/rails_performance/rails_performance/grape.html.erb +3 -9
 - data/app/views/rails_performance/rails_performance/index.html.erb +21 -19
 - data/app/views/rails_performance/rails_performance/rake.html.erb +3 -9
 - data/app/views/rails_performance/rails_performance/recent.html.erb +6 -5
 - data/app/views/rails_performance/rails_performance/resources.html.erb +12 -9
 - data/app/views/rails_performance/rails_performance/sidekiq.html.erb +6 -13
 - data/app/views/rails_performance/rails_performance/slow.html.erb +1 -1
 - data/app/views/rails_performance/rails_performance/summary.js.erb +2 -5
 - data/lib/rails_performance/engine.rb +4 -0
 - data/lib/rails_performance/engine_assets/controller.rb +42 -0
 - data/lib/rails_performance/engine_assets/helper.rb +49 -0
 - data/lib/rails_performance/engine_assets.rb +90 -0
 - data/lib/rails_performance/gems/grape_ext.rb +3 -1
 - data/lib/rails_performance/reports/recent_requests_report.rb +2 -2
 - data/lib/rails_performance/version.rb +1 -1
 - data/lib/rails_performance.rb +3 -0
 - metadata +15 -17
 - data/app/views/rails_performance/javascripts/_javascripts.html.erb +0 -11
 - data/app/views/rails_performance/javascripts/apexcharts.min.js +0 -14
 - data/app/views/rails_performance/javascripts/app.js +0 -158
 - data/app/views/rails_performance/javascripts/jquery-3.4.1.min.js +0 -2
 - data/app/views/rails_performance/javascripts/rails.js +0 -565
 - data/app/views/rails_performance/javascripts/stupidtable.min.js +0 -1
 - data/app/views/rails_performance/javascripts/table.js +0 -3
 - data/app/views/rails_performance/rails_performance/recent.js.erb +0 -3
 - data/app/views/rails_performance/stylesheets/_stylesheets.html.erb +0 -4
 - data/app/views/rails_performance/stylesheets/bulma.min.css +0 -1
 - /data/app/{views/rails_performance → engine_assets}/stylesheets/panel.css +0 -0
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 06ded8314ef8bb526e980beb02093b62ace3717957d21c3fc70bb5a9d4d377bf
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 5250ba4a65e1b2e5c2d94b90970d21ab3d3ef42bf989bccf316fbd44a2d55906
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: e106203bd4f64b397d919f625226c25caf23007394272600d14c4977f81d4689fc0fcaa7c03cdcdb5156b8198cfacd774a1442d68c8c2962d581abc66b5371e4
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: bdd796f8f935693933a7f7da42ed201ddf67e61e3e84525c55cb42b8e3323db3d01b80db8fcf466fdde48c161c50616f05c5ef3da7ff2b8f072bd33e99d62cde
         
     | 
    
        data/Rakefile
    CHANGED
    
    | 
         @@ -16,12 +16,11 @@ end 
     | 
|
| 
       16 
16 
     | 
    
         | 
| 
       17 
17 
     | 
    
         
             
            APP_RAKEFILE = File.expand_path("test/dummy/Rakefile", __dir__)
         
     | 
| 
       18 
18 
     | 
    
         
             
            load "rails/tasks/engine.rake"
         
     | 
| 
       19 
     | 
    
         
            -
             
     | 
| 
       20 
19 
     | 
    
         
             
            load "rails/tasks/statistics.rake"
         
     | 
| 
       21 
20 
     | 
    
         | 
| 
       22 
21 
     | 
    
         
             
            require "bundler/gem_tasks"
         
     | 
| 
       23 
     | 
    
         
            -
             
     | 
| 
       24 
22 
     | 
    
         
             
            require "rake/testtask"
         
     | 
| 
      
 23 
     | 
    
         
            +
            require "standard/rake"
         
     | 
| 
       25 
24 
     | 
    
         | 
| 
       26 
25 
     | 
    
         
             
            Rake::TestTask.new(:test) do |t|
         
     | 
| 
       27 
26 
     | 
    
         
             
              t.libs << "test"
         
     | 
| 
         @@ -29,4 +28,4 @@ Rake::TestTask.new(:test) do |t| 
     | 
|
| 
       29 
28 
     | 
    
         
             
              t.verbose = false
         
     | 
| 
       30 
29 
     | 
    
         
             
            end
         
     | 
| 
       31 
30 
     | 
    
         | 
| 
       32 
     | 
    
         
            -
            task default: :test
         
     | 
| 
      
 31 
     | 
    
         
            +
            task default: [:test, :standard]
         
     | 
| 
         @@ -1,8 +1,11 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            module RailsPerformance
         
     | 
| 
       2 
2 
     | 
    
         
             
              class BaseController < ActionController::Base
         
     | 
| 
       3 
3 
     | 
    
         
             
                include RailsPerformance::Concerns::CsvExportable
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
       4 
5 
     | 
    
         
             
                layout "rails_performance/layouts/rails_performance"
         
     | 
| 
       5 
6 
     | 
    
         | 
| 
      
 7 
     | 
    
         
            +
                helper RailsPerformance.engine_assets.helper
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
       6 
9 
     | 
    
         
             
                before_action :verify_access
         
     | 
| 
       7 
10 
     | 
    
         
             
                after_action :set_permissive_csp
         
     | 
| 
       8 
11 
     | 
    
         | 
| 
         @@ -75,7 +75,7 @@ module RailsPerformance 
     | 
|
| 
       75 
75 
     | 
    
         
             
                  def recent
         
     | 
| 
       76 
76 
     | 
    
         
             
                    @datasource = RailsPerformance::DataSource.new(**prepare_query(params), type: :requests)
         
     | 
| 
       77 
77 
     | 
    
         
             
                    db = @datasource.db
         
     | 
| 
       78 
     | 
    
         
            -
                    @data = RailsPerformance::Reports::RecentRequestsReport.new(db).data 
     | 
| 
      
 78 
     | 
    
         
            +
                    @data = RailsPerformance::Reports::RecentRequestsReport.new(db).data
         
     | 
| 
       79 
79 
     | 
    
         | 
| 
       80 
80 
     | 
    
         
             
                    # example
         
     | 
| 
       81 
81 
     | 
    
         
             
                    # :controller=>"HomeController",
         
     | 
| 
         @@ -98,7 +98,6 @@ module RailsPerformance 
     | 
|
| 
       98 
98 
     | 
    
         | 
| 
       99 
99 
     | 
    
         
             
                    respond_to do |format|
         
     | 
| 
       100 
100 
     | 
    
         
             
                      format.html
         
     | 
| 
       101 
     | 
    
         
            -
                      format.js
         
     | 
| 
       102 
101 
     | 
    
         
             
                      format.csv do
         
     | 
| 
       103 
102 
     | 
    
         
             
                        export_to_csv "recent_requests_report", @data
         
     | 
| 
       104 
103 
     | 
    
         
             
                      end
         
     | 
| 
         @@ -0,0 +1,30 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            import ApexCharts from 'apexcharts';
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            ApexCharts.prototype.updateRollingWindow = function(newData, { windowSizeMs }) {
         
     | 
| 
      
 4 
     | 
    
         
            +
              let data = this.w.config.series[0].data;
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
              // drop old points outside of the rolling window
         
     | 
| 
      
 7 
     | 
    
         
            +
              const windowStart = Date.now() - windowSizeMs;
         
     | 
| 
      
 8 
     | 
    
         
            +
              while (data.length > 0 && data[0][0] < windowStart) {
         
     | 
| 
      
 9 
     | 
    
         
            +
                data.shift();
         
     | 
| 
      
 10 
     | 
    
         
            +
              }
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
              // create index of remaining data
         
     | 
| 
      
 13 
     | 
    
         
            +
              const dataMap = new Map();
         
     | 
| 
      
 14 
     | 
    
         
            +
              data.forEach((point, index) => dataMap.set(point[0], index));
         
     | 
| 
      
 15 
     | 
    
         
            +
              const lastTimestamp = data.length > 0 ? data[data.length - 1][0] : -Infinity;
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
              // merge existing data (it can change), append new data
         
     | 
| 
      
 18 
     | 
    
         
            +
              const pointsToAdd = [];
         
     | 
| 
      
 19 
     | 
    
         
            +
              newData.forEach(([timestamp, value]) => {
         
     | 
| 
      
 20 
     | 
    
         
            +
                const index = dataMap.get(timestamp);
         
     | 
| 
      
 21 
     | 
    
         
            +
                if (index) {
         
     | 
| 
      
 22 
     | 
    
         
            +
                  data[index][1] = value;
         
     | 
| 
      
 23 
     | 
    
         
            +
                } else if (timestamp > lastTimestamp) {
         
     | 
| 
      
 24 
     | 
    
         
            +
                  pointsToAdd.push([timestamp, value]);
         
     | 
| 
      
 25 
     | 
    
         
            +
                }
         
     | 
| 
      
 26 
     | 
    
         
            +
              });
         
     | 
| 
      
 27 
     | 
    
         
            +
              this.appendData([{ data: pointsToAdd }], false);
         
     | 
| 
      
 28 
     | 
    
         
            +
            };
         
     | 
| 
      
 29 
     | 
    
         
            +
             
     | 
| 
      
 30 
     | 
    
         
            +
            export default ApexCharts;
         
     | 
| 
         @@ -0,0 +1,78 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            import { Idiomorph } from 'idiomorph';
         
     | 
| 
      
 2 
     | 
    
         
            +
            import ms from 'ms';
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
            class RailsPerformanceAutoupdate extends HTMLElement {
         
     | 
| 
      
 5 
     | 
    
         
            +
              connectedCallback() {
         
     | 
| 
      
 6 
     | 
    
         
            +
                this.checkbox = this.querySelector('input[type="checkbox"]');
         
     | 
| 
      
 7 
     | 
    
         
            +
                this.intervalMs = this.parseIntervalAttribute();
         
     | 
| 
      
 8 
     | 
    
         
            +
                this.initializeCheckboxState();
         
     | 
| 
      
 9 
     | 
    
         
            +
                this.setupCheckboxListener();
         
     | 
| 
      
 10 
     | 
    
         
            +
                this.startPolling();
         
     | 
| 
      
 11 
     | 
    
         
            +
              }
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
              parseIntervalAttribute() {
         
     | 
| 
      
 14 
     | 
    
         
            +
                return ms(this.getAttribute('interval') || '3s');
         
     | 
| 
      
 15 
     | 
    
         
            +
              }
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
              initializeCheckboxState() {
         
     | 
| 
      
 18 
     | 
    
         
            +
                const key = this.storageKey();
         
     | 
| 
      
 19 
     | 
    
         
            +
                if (localStorage.getItem(key) === null) {
         
     | 
| 
      
 20 
     | 
    
         
            +
                  localStorage.setItem(key, 'true');
         
     | 
| 
      
 21 
     | 
    
         
            +
                }
         
     | 
| 
      
 22 
     | 
    
         
            +
                this.checkbox.checked = localStorage.getItem(key) === 'true';
         
     | 
| 
      
 23 
     | 
    
         
            +
              }
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
      
 25 
     | 
    
         
            +
              setupCheckboxListener() {
         
     | 
| 
      
 26 
     | 
    
         
            +
                this.checkbox.addEventListener('change', () => {
         
     | 
| 
      
 27 
     | 
    
         
            +
                  localStorage.setItem(this.storageKey(), this.checkbox.checked);
         
     | 
| 
      
 28 
     | 
    
         
            +
                });
         
     | 
| 
      
 29 
     | 
    
         
            +
              }
         
     | 
| 
      
 30 
     | 
    
         
            +
             
     | 
| 
      
 31 
     | 
    
         
            +
              startPolling() {
         
     | 
| 
      
 32 
     | 
    
         
            +
                setInterval(() => this.poll(), this.intervalMs);
         
     | 
| 
      
 33 
     | 
    
         
            +
              }
         
     | 
| 
      
 34 
     | 
    
         
            +
             
     | 
| 
      
 35 
     | 
    
         
            +
              async poll() {
         
     | 
| 
      
 36 
     | 
    
         
            +
                if (!this.checkbox.checked) return;
         
     | 
| 
      
 37 
     | 
    
         
            +
             
     | 
| 
      
 38 
     | 
    
         
            +
                const html = await this.fetchPage();
         
     | 
| 
      
 39 
     | 
    
         
            +
                const newDoc = this.parseHtml(html);
         
     | 
| 
      
 40 
     | 
    
         
            +
                this.morphPage(newDoc);
         
     | 
| 
      
 41 
     | 
    
         
            +
              }
         
     | 
| 
      
 42 
     | 
    
         
            +
             
     | 
| 
      
 43 
     | 
    
         
            +
              async fetchPage() {
         
     | 
| 
      
 44 
     | 
    
         
            +
                const res = await fetch(window.location.href, {
         
     | 
| 
      
 45 
     | 
    
         
            +
                  headers: {
         
     | 
| 
      
 46 
     | 
    
         
            +
                    'X-CSRF-Token': document.querySelector("[name='csrf-token']").content,
         
     | 
| 
      
 47 
     | 
    
         
            +
                  },
         
     | 
| 
      
 48 
     | 
    
         
            +
                });
         
     | 
| 
      
 49 
     | 
    
         
            +
                return await res.text();
         
     | 
| 
      
 50 
     | 
    
         
            +
              }
         
     | 
| 
      
 51 
     | 
    
         
            +
             
     | 
| 
      
 52 
     | 
    
         
            +
              parseHtml(html) {
         
     | 
| 
      
 53 
     | 
    
         
            +
                const parser = new DOMParser();
         
     | 
| 
      
 54 
     | 
    
         
            +
                return parser.parseFromString(html, 'text/html');
         
     | 
| 
      
 55 
     | 
    
         
            +
              }
         
     | 
| 
      
 56 
     | 
    
         
            +
             
     | 
| 
      
 57 
     | 
    
         
            +
              morphPage(newDoc) {
         
     | 
| 
      
 58 
     | 
    
         
            +
                Idiomorph.morph(document.body, newDoc.body, {
         
     | 
| 
      
 59 
     | 
    
         
            +
                  callbacks: {
         
     | 
| 
      
 60 
     | 
    
         
            +
                    beforeNodeMorphed: (oldNode, newNode) => {
         
     | 
| 
      
 61 
     | 
    
         
            +
                      // skip morphing the autoupdate component itself
         
     | 
| 
      
 62 
     | 
    
         
            +
                      if (oldNode === this) {
         
     | 
| 
      
 63 
     | 
    
         
            +
                        return false;
         
     | 
| 
      
 64 
     | 
    
         
            +
                      }
         
     | 
| 
      
 65 
     | 
    
         
            +
                      if (oldNode.hasAttribute && oldNode.hasAttribute('data-skip-autoupdate')) {
         
     | 
| 
      
 66 
     | 
    
         
            +
                        return false;
         
     | 
| 
      
 67 
     | 
    
         
            +
                      }
         
     | 
| 
      
 68 
     | 
    
         
            +
                    }
         
     | 
| 
      
 69 
     | 
    
         
            +
                  }
         
     | 
| 
      
 70 
     | 
    
         
            +
                });
         
     | 
| 
      
 71 
     | 
    
         
            +
              }
         
     | 
| 
      
 72 
     | 
    
         
            +
             
     | 
| 
      
 73 
     | 
    
         
            +
              storageKey() {
         
     | 
| 
      
 74 
     | 
    
         
            +
                return `rails-performance-autoupdate:${window.location.pathname}`;
         
     | 
| 
      
 75 
     | 
    
         
            +
              }
         
     | 
| 
      
 76 
     | 
    
         
            +
            }
         
     | 
| 
      
 77 
     | 
    
         
            +
             
     | 
| 
      
 78 
     | 
    
         
            +
            customElements.define('rails-performance-autoupdate', RailsPerformanceAutoupdate);
         
     | 
| 
         @@ -0,0 +1,193 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            import ApexCharts from "rails_performance/apex_ext"
         
     | 
| 
      
 2 
     | 
    
         
            +
            import ms from "ms"
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
            class RailsPerformanceChart extends HTMLElement {
         
     | 
| 
      
 5 
     | 
    
         
            +
              connectedCallback() {
         
     | 
| 
      
 6 
     | 
    
         
            +
                this.legend = this.getAttribute('legend');
         
     | 
| 
      
 7 
     | 
    
         
            +
                this.units = this.getAttribute('units');
         
     | 
| 
      
 8 
     | 
    
         
            +
                this.type = this.getAttribute('type');
         
     | 
| 
      
 9 
     | 
    
         
            +
                this.dataText = this.textContent.trim();
         
     | 
| 
      
 10 
     | 
    
         
            +
                this.chart = this.buildChart();
         
     | 
| 
      
 11 
     | 
    
         
            +
                this.observeDataChanges();
         
     | 
| 
      
 12 
     | 
    
         
            +
              }
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
              buildChart() {
         
     | 
| 
      
 15 
     | 
    
         
            +
                if (!this.shadowRoot) {
         
     | 
| 
      
 16 
     | 
    
         
            +
                  this.attachShadow({ mode: 'open' });
         
     | 
| 
      
 17 
     | 
    
         
            +
                }
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
                const chartDiv = document.createElement('div');
         
     | 
| 
      
 20 
     | 
    
         
            +
                this.shadowRoot.innerHTML = '';
         
     | 
| 
      
 21 
     | 
    
         
            +
                this.shadowRoot.appendChild(chartDiv);
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
                const data = this.safeParseJson(this.dataText);
         
     | 
| 
      
 24 
     | 
    
         
            +
                const renderMethod = this[`render${this.type}Chart`];
         
     | 
| 
      
 25 
     | 
    
         
            +
                return renderMethod.call(this, chartDiv, data);
         
     | 
| 
      
 26 
     | 
    
         
            +
              }
         
     | 
| 
      
 27 
     | 
    
         
            +
             
     | 
| 
      
 28 
     | 
    
         
            +
              safeParseJson(text, defaultValue = []) {
         
     | 
| 
      
 29 
     | 
    
         
            +
                try { return JSON.parse(text); } catch(e) { return defaultValue; }
         
     | 
| 
      
 30 
     | 
    
         
            +
              }
         
     | 
| 
      
 31 
     | 
    
         
            +
             
     | 
| 
      
 32 
     | 
    
         
            +
              observeDataChanges() {
         
     | 
| 
      
 33 
     | 
    
         
            +
                this.mutationObserver = new MutationObserver(() => {
         
     | 
| 
      
 34 
     | 
    
         
            +
                  const currentText = this.textContent.trim();
         
     | 
| 
      
 35 
     | 
    
         
            +
                  if (currentText === this.dataText) return;
         
     | 
| 
      
 36 
     | 
    
         
            +
                  this.dataText = currentText;
         
     | 
| 
      
 37 
     | 
    
         
            +
                  const data = this.safeParseJson(currentText);
         
     | 
| 
      
 38 
     | 
    
         
            +
                  this.updateChart(data);
         
     | 
| 
      
 39 
     | 
    
         
            +
                });
         
     | 
| 
      
 40 
     | 
    
         
            +
                this.mutationObserver.observe(this, { childList: true, characterData: true, subtree: true });
         
     | 
| 
      
 41 
     | 
    
         
            +
              }
         
     | 
| 
      
 42 
     | 
    
         
            +
             
     | 
| 
      
 43 
     | 
    
         
            +
              updateChart(newData) {
         
     | 
| 
      
 44 
     | 
    
         
            +
                let incoming = newData;
         
     | 
| 
      
 45 
     | 
    
         
            +
                if (this.type === 'Usage') {
         
     | 
| 
      
 46 
     | 
    
         
            +
                  const { units, bytes } = calculateByteUnit(newData);
         
     | 
| 
      
 47 
     | 
    
         
            +
                  incoming = newData.map(([t, v]) => [t, typeof v === 'number' ? (v / bytes).toFixed(2) : null]);
         
     | 
| 
      
 48 
     | 
    
         
            +
                }
         
     | 
| 
      
 49 
     | 
    
         
            +
                this.chart.updateRollingWindow(incoming, { windowSizeMs: this.windowSizeMs });
         
     | 
| 
      
 50 
     | 
    
         
            +
              }
         
     | 
| 
      
 51 
     | 
    
         
            +
             
     | 
| 
      
 52 
     | 
    
         
            +
              get windowSizeMs() {
         
     | 
| 
      
 53 
     | 
    
         
            +
                if (this.type === 'TIR' || this.type === 'RT') {
         
     | 
| 
      
 54 
     | 
    
         
            +
                  return ms("4h")
         
     | 
| 
      
 55 
     | 
    
         
            +
                } else {
         
     | 
| 
      
 56 
     | 
    
         
            +
                  return ms("24h")
         
     | 
| 
      
 57 
     | 
    
         
            +
                }
         
     | 
| 
      
 58 
     | 
    
         
            +
              }
         
     | 
| 
      
 59 
     | 
    
         
            +
             
     | 
| 
      
 60 
     | 
    
         
            +
              renderTIRChart(element, data) {
         
     | 
| 
      
 61 
     | 
    
         
            +
                return renderChart(element, data, {
         
     | 
| 
      
 62 
     | 
    
         
            +
                  chartType: 'area',
         
     | 
| 
      
 63 
     | 
    
         
            +
                  yAxisTitle: 'RPM',
         
     | 
| 
      
 64 
     | 
    
         
            +
                  seriesName: this.legend,
         
     | 
| 
      
 65 
     | 
    
         
            +
                  units: this.units
         
     | 
| 
      
 66 
     | 
    
         
            +
                });
         
     | 
| 
      
 67 
     | 
    
         
            +
              }
         
     | 
| 
      
 68 
     | 
    
         
            +
             
     | 
| 
      
 69 
     | 
    
         
            +
              renderRTChart(element, data) {
         
     | 
| 
      
 70 
     | 
    
         
            +
                return renderChart(element, data, {
         
     | 
| 
      
 71 
     | 
    
         
            +
                  chartType: 'area',
         
     | 
| 
      
 72 
     | 
    
         
            +
                  yAxisTitle: 'Time',
         
     | 
| 
      
 73 
     | 
    
         
            +
                  seriesName: 'Response Time',
         
     | 
| 
      
 74 
     | 
    
         
            +
                  units: 'ms'
         
     | 
| 
      
 75 
     | 
    
         
            +
                });
         
     | 
| 
      
 76 
     | 
    
         
            +
              }
         
     | 
| 
      
 77 
     | 
    
         
            +
             
     | 
| 
      
 78 
     | 
    
         
            +
              renderPercentageChart(element, data) {
         
     | 
| 
      
 79 
     | 
    
         
            +
                return renderChart(element, data, {
         
     | 
| 
      
 80 
     | 
    
         
            +
                  chartType: 'line',
         
     | 
| 
      
 81 
     | 
    
         
            +
                  yAxisTitle: '%',
         
     | 
| 
      
 82 
     | 
    
         
            +
                  seriesName: this.legend,
         
     | 
| 
      
 83 
     | 
    
         
            +
                  units: '%'
         
     | 
| 
      
 84 
     | 
    
         
            +
                });
         
     | 
| 
      
 85 
     | 
    
         
            +
              }
         
     | 
| 
      
 86 
     | 
    
         
            +
             
     | 
| 
      
 87 
     | 
    
         
            +
              renderUsageChart(element, data) {
         
     | 
| 
      
 88 
     | 
    
         
            +
                const { units, bytes } = calculateByteUnit(data);
         
     | 
| 
      
 89 
     | 
    
         
            +
                return renderChart(element, data, {
         
     | 
| 
      
 90 
     | 
    
         
            +
                  chartType: 'line',
         
     | 
| 
      
 91 
     | 
    
         
            +
                  yAxisTitle: this.legend,
         
     | 
| 
      
 92 
     | 
    
         
            +
                  seriesName: this.legend,
         
     | 
| 
      
 93 
     | 
    
         
            +
                  units: units,
         
     | 
| 
      
 94 
     | 
    
         
            +
                  dataTransform: (data) => {
         
     | 
| 
      
 95 
     | 
    
         
            +
                    return data.map(([timestamp, value]) => [timestamp, typeof value === 'number' ? (value / bytes).toFixed(2) : null]);
         
     | 
| 
      
 96 
     | 
    
         
            +
                  },
         
     | 
| 
      
 97 
     | 
    
         
            +
                });
         
     | 
| 
      
 98 
     | 
    
         
            +
              }
         
     | 
| 
      
 99 
     | 
    
         
            +
            }
         
     | 
| 
      
 100 
     | 
    
         
            +
             
     | 
| 
      
 101 
     | 
    
         
            +
            customElements.define('rails-performance-chart', RailsPerformanceChart);
         
     | 
| 
      
 102 
     | 
    
         
            +
             
     | 
| 
      
 103 
     | 
    
         
            +
            function calculateByteUnit(data) {
         
     | 
| 
      
 104 
     | 
    
         
            +
              let max = data.reduce((acc, [_, value]) => (value > acc ? value : acc), -Infinity);
         
     | 
| 
      
 105 
     | 
    
         
            +
              let pow = 0;
         
     | 
| 
      
 106 
     | 
    
         
            +
              while (max >= 1024 && pow < 5) {
         
     | 
| 
      
 107 
     | 
    
         
            +
                max /= 1024;
         
     | 
| 
      
 108 
     | 
    
         
            +
                pow += 1;
         
     | 
| 
      
 109 
     | 
    
         
            +
              }
         
     | 
| 
      
 110 
     | 
    
         
            +
             
     | 
| 
      
 111 
     | 
    
         
            +
              const units = ['bytes', 'KB', 'MB', 'GB', 'TB', 'PB'][pow];
         
     | 
| 
      
 112 
     | 
    
         
            +
              const bytes = Math.pow(1024, pow);
         
     | 
| 
      
 113 
     | 
    
         
            +
             
     | 
| 
      
 114 
     | 
    
         
            +
              return { units, bytes };
         
     | 
| 
      
 115 
     | 
    
         
            +
            }
         
     | 
| 
      
 116 
     | 
    
         
            +
             
     | 
| 
      
 117 
     | 
    
         
            +
            function renderChart(element, data, { chartType = 'area', yAxisTitle, seriesName, units, dataTransform = x => x } = {}) {
         
     | 
| 
      
 118 
     | 
    
         
            +
              const chart = new ApexCharts(
         
     | 
| 
      
 119 
     | 
    
         
            +
                element,
         
     | 
| 
      
 120 
     | 
    
         
            +
                {
         
     | 
| 
      
 121 
     | 
    
         
            +
                  chart: {
         
     | 
| 
      
 122 
     | 
    
         
            +
                    type: chartType,
         
     | 
| 
      
 123 
     | 
    
         
            +
                    height: 300,
         
     | 
| 
      
 124 
     | 
    
         
            +
                    width: '100%',
         
     | 
| 
      
 125 
     | 
    
         
            +
                    group: 'chart',
         
     | 
| 
      
 126 
     | 
    
         
            +
                    zoom: {
         
     | 
| 
      
 127 
     | 
    
         
            +
                      type: 'x',
         
     | 
| 
      
 128 
     | 
    
         
            +
                    },
         
     | 
| 
      
 129 
     | 
    
         
            +
                  },
         
     | 
| 
      
 130 
     | 
    
         
            +
                  colors: ['#ff5b5b'],
         
     | 
| 
      
 131 
     | 
    
         
            +
                  stroke: {
         
     | 
| 
      
 132 
     | 
    
         
            +
                    width: 1,
         
     | 
| 
      
 133 
     | 
    
         
            +
                  },
         
     | 
| 
      
 134 
     | 
    
         
            +
                  dataLabels: {
         
     | 
| 
      
 135 
     | 
    
         
            +
                    enabled: false
         
     | 
| 
      
 136 
     | 
    
         
            +
                  },
         
     | 
| 
      
 137 
     | 
    
         
            +
                  legend: {
         
     | 
| 
      
 138 
     | 
    
         
            +
                    show: false
         
     | 
| 
      
 139 
     | 
    
         
            +
                  },
         
     | 
| 
      
 140 
     | 
    
         
            +
                  xaxis: {
         
     | 
| 
      
 141 
     | 
    
         
            +
                    crosshairs: {
         
     | 
| 
      
 142 
     | 
    
         
            +
                      show: true
         
     | 
| 
      
 143 
     | 
    
         
            +
                    },
         
     | 
| 
      
 144 
     | 
    
         
            +
                    type: 'datetime',
         
     | 
| 
      
 145 
     | 
    
         
            +
                    labels: {
         
     | 
| 
      
 146 
     | 
    
         
            +
                      datetimeUTC: false,
         
     | 
| 
      
 147 
     | 
    
         
            +
                      style: {
         
     | 
| 
      
 148 
     | 
    
         
            +
                        colors: ["#a6b0cf"]
         
     | 
| 
      
 149 
     | 
    
         
            +
                      }
         
     | 
| 
      
 150 
     | 
    
         
            +
                    }
         
     | 
| 
      
 151 
     | 
    
         
            +
                  },
         
     | 
| 
      
 152 
     | 
    
         
            +
                  yaxis: {
         
     | 
| 
      
 153 
     | 
    
         
            +
                    min: 0,
         
     | 
| 
      
 154 
     | 
    
         
            +
                    title: {
         
     | 
| 
      
 155 
     | 
    
         
            +
                      text: yAxisTitle,
         
     | 
| 
      
 156 
     | 
    
         
            +
                      style: {
         
     | 
| 
      
 157 
     | 
    
         
            +
                        color: "#f6f6f6"
         
     | 
| 
      
 158 
     | 
    
         
            +
                      }
         
     | 
| 
      
 159 
     | 
    
         
            +
                    },
         
     | 
| 
      
 160 
     | 
    
         
            +
                    labels: {
         
     | 
| 
      
 161 
     | 
    
         
            +
                      style: {
         
     | 
| 
      
 162 
     | 
    
         
            +
                        colors: ["#a6b0cf"]
         
     | 
| 
      
 163 
     | 
    
         
            +
                      }
         
     | 
| 
      
 164 
     | 
    
         
            +
                    }
         
     | 
| 
      
 165 
     | 
    
         
            +
                  },
         
     | 
| 
      
 166 
     | 
    
         
            +
                  tooltip: {
         
     | 
| 
      
 167 
     | 
    
         
            +
                    style: {
         
     | 
| 
      
 168 
     | 
    
         
            +
                      fontSize: '16px'
         
     | 
| 
      
 169 
     | 
    
         
            +
                    },
         
     | 
| 
      
 170 
     | 
    
         
            +
                    marker: {
         
     | 
| 
      
 171 
     | 
    
         
            +
                      show: false,
         
     | 
| 
      
 172 
     | 
    
         
            +
                    },
         
     | 
| 
      
 173 
     | 
    
         
            +
                    x: {
         
     | 
| 
      
 174 
     | 
    
         
            +
                      show: false,
         
     | 
| 
      
 175 
     | 
    
         
            +
                      format: 'dd/MM/yy HH:mm'
         
     | 
| 
      
 176 
     | 
    
         
            +
                    },
         
     | 
| 
      
 177 
     | 
    
         
            +
                    y: {
         
     | 
| 
      
 178 
     | 
    
         
            +
                      formatter: (value) => value ? `${value} ${units}`.trim() : undefined,
         
     | 
| 
      
 179 
     | 
    
         
            +
                      title: {
         
     | 
| 
      
 180 
     | 
    
         
            +
                        formatter: () => '',
         
     | 
| 
      
 181 
     | 
    
         
            +
                      }
         
     | 
| 
      
 182 
     | 
    
         
            +
                    }
         
     | 
| 
      
 183 
     | 
    
         
            +
                  },
         
     | 
| 
      
 184 
     | 
    
         
            +
                  series: [{
         
     | 
| 
      
 185 
     | 
    
         
            +
                    name: seriesName,
         
     | 
| 
      
 186 
     | 
    
         
            +
                    data: dataTransform(data),
         
     | 
| 
      
 187 
     | 
    
         
            +
                  }],
         
     | 
| 
      
 188 
     | 
    
         
            +
                  annotations: window?.annotationsData || {}
         
     | 
| 
      
 189 
     | 
    
         
            +
                }
         
     | 
| 
      
 190 
     | 
    
         
            +
              );
         
     | 
| 
      
 191 
     | 
    
         
            +
              chart.render();
         
     | 
| 
      
 192 
     | 
    
         
            +
              return chart;
         
     | 
| 
      
 193 
     | 
    
         
            +
            }
         
     | 
| 
         @@ -1,8 +1,10 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            $ 
     | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
       3 
     | 
    
         
            -
             
     | 
| 
       4 
     | 
    
         
            -
             
     | 
| 
       5 
     | 
    
         
            -
             
     | 
| 
       6 
     | 
    
         
            -
                   
     | 
| 
       7 
     | 
    
         
            -
             
     | 
| 
       8 
     | 
    
         
            -
             
     | 
| 
      
 1 
     | 
    
         
            +
            import $ from 'jquery';
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            $(document).ready(function() {
         
     | 
| 
      
 4 
     | 
    
         
            +
              // Check for click events on the navbar burger icon
         
     | 
| 
      
 5 
     | 
    
         
            +
              $(".navbar-burger").click(function() {
         
     | 
| 
      
 6 
     | 
    
         
            +
                  // Toggle the "is-active" class on both the "navbar-burger" and the "navbar-menu"
         
     | 
| 
      
 7 
     | 
    
         
            +
                  $(".navbar-burger").toggleClass("is-active");
         
     | 
| 
      
 8 
     | 
    
         
            +
                  $(".navbar-menu").toggleClass("is-active");
         
     | 
| 
      
 9 
     | 
    
         
            +
              });
         
     | 
| 
      
 10 
     | 
    
         
            +
            });
         
     | 
| 
         @@ -1,3 +1,5 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            import $ from 'jquery';
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
       1 
3 
     | 
    
         
             
            function hidePanel() {
         
     | 
| 
       2 
4 
     | 
    
         
             
              $('.cd-panel').removeClass('cd-panel--is-visible');
         
     | 
| 
       3 
5 
     | 
    
         
             
              $('body').removeClass('panel-visible');
         
     | 
| 
         @@ -12,6 +14,9 @@ function showPanel() { 
     | 
|
| 
       12 
14 
     | 
    
         
             
              $('.cd-panel__content table').stupidtable();
         
     | 
| 
       13 
15 
     | 
    
         
             
            }
         
     | 
| 
       14 
16 
     | 
    
         | 
| 
      
 17 
     | 
    
         
            +
            window.hidePanel = hidePanel;
         
     | 
| 
      
 18 
     | 
    
         
            +
            window.showPanel = showPanel;
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
       15 
20 
     | 
    
         
             
            $(function() {
         
     | 
| 
       16 
21 
     | 
    
         
             
              var panel = {};
         
     | 
| 
       17 
22 
     | 
    
         
             
              window.panel = panel;
         
     | 
| 
         @@ -36,4 +41,3 @@ $(function() { 
     | 
|
| 
       36 
41 
     | 
    
         
             
              });
         
     | 
| 
       37 
42 
     | 
    
         | 
| 
       38 
43 
     | 
    
         
             
            });
         
     | 
| 
       39 
     | 
    
         
            -
             
     | 
| 
         @@ -1,10 +1,10 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            @media screen and (max-width: 1600px) {
         
     | 
| 
       2 
     | 
    
         
            -
              .container.is-fluid {
         
     | 
| 
       3 
     | 
    
         
            -
                padding-left: 2px;
         
     | 
| 
       4 
     | 
    
         
            -
                padding-right: 2px;
         
     | 
| 
       5 
     | 
    
         
            -
              }
         
     | 
| 
       6 
     | 
    
         
            -
             
     | 
| 
       7 
     | 
    
         
            -
              .section {
         
     | 
| 
       8 
     | 
    
         
            -
                padding: 1em;
         
     | 
| 
       9 
     | 
    
         
            -
              }
         
     | 
| 
       10 
     | 
    
         
            -
            }
         
     | 
| 
      
 1 
     | 
    
         
            +
            @media screen and (max-width: 1600px) {
         
     | 
| 
      
 2 
     | 
    
         
            +
              .container.is-fluid {
         
     | 
| 
      
 3 
     | 
    
         
            +
                padding-left: 2px;
         
     | 
| 
      
 4 
     | 
    
         
            +
                padding-right: 2px;
         
     | 
| 
      
 5 
     | 
    
         
            +
              }
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
              .section {
         
     | 
| 
      
 8 
     | 
    
         
            +
                padding: 1em;
         
     | 
| 
      
 9 
     | 
    
         
            +
              }
         
     | 
| 
      
 10 
     | 
    
         
            +
            }
         
     | 
| 
         @@ -98,6 +98,12 @@ 
     | 
|
| 
       98 
98 
     | 
    
         
             
              fill: hsl(141, 53%, 53%) !important;
         
     | 
| 
       99 
99 
     | 
    
         
             
            }
         
     | 
| 
       100 
100 
     | 
    
         | 
| 
      
 101 
     | 
    
         
            +
            /* Hide the element until it's defined, and prevent layout jump */
         
     | 
| 
      
 102 
     | 
    
         
            +
            rails-performance-chart:not(:defined) {
         
     | 
| 
      
 103 
     | 
    
         
            +
              display: block;
         
     | 
| 
      
 104 
     | 
    
         
            +
              opacity: 0;
         
     | 
| 
      
 105 
     | 
    
         
            +
            }
         
     | 
| 
      
 106 
     | 
    
         
            +
             
     | 
| 
       101 
107 
     | 
    
         
             
            .chart {
         
     | 
| 
       102 
108 
     | 
    
         
             
              height: 300px;
         
     | 
| 
       103 
109 
     | 
    
         
             
            }
         
     | 
| 
         @@ -111,14 +111,6 @@ module RailsPerformance 
     | 
|
| 
       111 
111 
     | 
    
         
             
                  @icons[name] ||= raw File.read(File.expand_path(File.dirname(__FILE__) + "/../../assets/images/#{name}.svg"))
         
     | 
| 
       112 
112 
     | 
    
         
             
                end
         
     | 
| 
       113 
113 
     | 
    
         | 
| 
       114 
     | 
    
         
            -
                def insert_css_file(file)
         
     | 
| 
       115 
     | 
    
         
            -
                  raw "<style>#{raw File.read File.expand_path(File.dirname(__FILE__) + "/../../views/rails_performance/stylesheets/#{file}")}</style>"
         
     | 
| 
       116 
     | 
    
         
            -
                end
         
     | 
| 
       117 
     | 
    
         
            -
             
     | 
| 
       118 
     | 
    
         
            -
                def insert_js_file(file)
         
     | 
| 
       119 
     | 
    
         
            -
                  raw "<script>#{raw File.read File.expand_path(File.dirname(__FILE__) + "/../../views/rails_performance/javascripts/#{file}")}</script>"
         
     | 
| 
       120 
     | 
    
         
            -
                end
         
     | 
| 
       121 
     | 
    
         
            -
             
     | 
| 
       122 
114 
     | 
    
         
             
                def format_datetime(e)
         
     | 
| 
       123 
115 
     | 
    
         
             
                  dt = RailsPerformance::Reports::BaseReport.time_in_app_time_zone(e)
         
     | 
| 
       124 
116 
     | 
    
         
             
                  I18n.l(dt, format: "%Y-%m-%d %H:%M:%S")
         
     | 
| 
         @@ -1,4 +1,4 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            <div class="cd-panel cd-panel--from-right js-cd-panel-main">
         
     | 
| 
      
 1 
     | 
    
         
            +
            <div class="cd-panel cd-panel--from-right js-cd-panel-main" data-skip-autoupdate>
         
     | 
| 
       2 
2 
     | 
    
         
             
              <div class="cd-panel__container">
         
     | 
| 
       3 
3 
     | 
    
         
             
                <nav class="panel">
         
     | 
| 
       4 
4 
     | 
    
         
             
                  <p class="panel-heading">
         
     | 
| 
         @@ -10,4 +10,6 @@ 
     | 
|
| 
       10 
10 
     | 
    
         
             
                  </div>
         
     | 
| 
       11 
11 
     | 
    
         
             
                </nav>
         
     | 
| 
       12 
12 
     | 
    
         
             
              </div> <!-- cd-panel__container -->
         
     | 
| 
       13 
     | 
    
         
            -
            </div> <!-- cd-panel -->
         
     | 
| 
      
 13 
     | 
    
         
            +
            </div> <!-- cd-panel -->
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
            <div class="panel-overlay" data-skip-autoupdate></div>
         
     | 
| 
         @@ -6,8 +6,23 @@ 
     | 
|
| 
       6 
6 
     | 
    
         
             
                <title>Rails Performance</title>
         
     | 
| 
       7 
7 
     | 
    
         
             
                <%= csrf_meta_tags %>
         
     | 
| 
       8 
8 
     | 
    
         
             
                <%= csp_meta_tag if ::Rails::VERSION::STRING.to_f >= 5.2 %>
         
     | 
| 
       9 
     | 
    
         
            -
             
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
                <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bulma@0.9.4/css/bulma.min.css">
         
     | 
| 
      
 11 
     | 
    
         
            +
                <%= engine_stylesheet_link_tag "style" %>
         
     | 
| 
      
 12 
     | 
    
         
            +
                <%= engine_stylesheet_link_tag "panel" %>
         
     | 
| 
      
 13 
     | 
    
         
            +
                <%= engine_stylesheet_link_tag "responsive" %>
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
       10 
15 
     | 
    
         
             
                <link rel="shortcut icon" href="/favicon.ico">
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
                <%= engine_javascript_importmap_tags "application", {
         
     | 
| 
      
 18 
     | 
    
         
            +
                  "@rails/ujs" => "https://cdn.jsdelivr.net/npm/@rails/ujs@7.1.3-4/+esm",
         
     | 
| 
      
 19 
     | 
    
         
            +
                  "jquery" => "https://cdn.jsdelivr.net/npm/jquery@3.7.1/+esm",
         
     | 
| 
      
 20 
     | 
    
         
            +
                  "apexcharts" => "https://cdn.jsdelivr.net/npm/apexcharts@3.45.0/+esm",
         
     | 
| 
      
 21 
     | 
    
         
            +
                  "ms" => "https://cdn.jsdelivr.net/npm/ms@2.1.3/+esm",
         
     | 
| 
      
 22 
     | 
    
         
            +
                  "stupid-table-plugin" => "https://cdn.jsdelivr.net/npm/stupid-table-plugin@1.1.3/+esm",
         
     | 
| 
      
 23 
     | 
    
         
            +
                  "idiomorph" => "https://cdn.jsdelivr.net/npm/idiomorph@0.7.4/+esm"
         
     | 
| 
      
 24 
     | 
    
         
            +
                } %>
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
       11 
26 
     | 
    
         
             
                <script>
         
     | 
| 
       12 
27 
     | 
    
         
             
                  window.annotationsData = <%= raw RailsPerformance::Reports::AnnotationsReport.new.data.to_json %>;
         
     | 
| 
       13 
28 
     | 
    
         
             
                </script>
         
     | 
| 
         @@ -36,12 +51,5 @@ 
     | 
|
| 
       36 
51 
     | 
    
         
             
                </footer>
         
     | 
| 
       37 
52 
     | 
    
         | 
| 
       38 
53 
     | 
    
         
             
                <%= render '/rails_performance/panel' %>
         
     | 
| 
       39 
     | 
    
         
            -
             
     | 
| 
       40 
     | 
    
         
            -
                <div class="panel-overlay"></div>
         
     | 
| 
       41 
     | 
    
         
            -
             
     | 
| 
       42 
     | 
    
         
            -
                <%= render '/rails_performance/javascripts/javascripts' %>
         
     | 
| 
       43 
     | 
    
         
            -
             
     | 
| 
       44 
     | 
    
         
            -
                <%= yield :on_load %>
         
     | 
| 
       45 
54 
     | 
    
         
             
              </body>
         
     | 
| 
       46 
     | 
    
         
            -
             
     | 
| 
       47 
55 
     | 
    
         
             
            </html>
         
     | 
| 
         @@ -1,8 +1,10 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            <h2 class="subtitle">Throughput</h2>
         
     | 
| 
       2 
     | 
    
         
            -
            < 
     | 
| 
      
 2 
     | 
    
         
            +
            <rails-performance-chart id="throughput_report_chart_mini" type="TIR" legend="RPM" units="rpm" class="chart_mini">
         
     | 
| 
      
 3 
     | 
    
         
            +
            </rails-performance-chart>
         
     | 
| 
       3 
4 
     | 
    
         | 
| 
       4 
5 
     | 
    
         
             
            <h2 class="subtitle">Average Response Time</h2>
         
     | 
| 
       5 
     | 
    
         
            -
            < 
     | 
| 
      
 6 
     | 
    
         
            +
            <rails-performance-chart id="response_time_report_chart_mini" type="RT" legend="Response Time" class="chart_mini">
         
     | 
| 
      
 7 
     | 
    
         
            +
            </rails-performance-chart>
         
     | 
| 
       6 
8 
     | 
    
         | 
| 
       7 
9 
     | 
    
         
             
            <h2 class="subtitle"><%= title %></h2>
         
     | 
| 
       8 
10 
     | 
    
         
             
            <table class="table is-fullwidth is-hoverable is-narrow is-size-8">
         
     | 
| 
         @@ -56,7 +56,9 @@ 
     | 
|
| 
       56 
56 
     | 
    
         
             
            <div class="card">
         
     | 
| 
       57 
57 
     | 
    
         
             
              <div class="card-content">
         
     | 
| 
       58 
58 
     | 
    
         
             
                <h2 class="subtitle">Custom Events Throughput Report</h2>
         
     | 
| 
       59 
     | 
    
         
            -
                < 
     | 
| 
      
 59 
     | 
    
         
            +
                <rails-performance-chart id="throughput_report_chart" type="TIR" legend="Events" units="events / minute" class="chart">
         
     | 
| 
      
 60 
     | 
    
         
            +
                  <%= raw @throughput_report_data.to_json %>
         
     | 
| 
      
 61 
     | 
    
         
            +
                </rails-performance-chart>
         
     | 
| 
       60 
62 
     | 
    
         
             
                <p class="content is-small">All custom events in the application</p>
         
     | 
| 
       61 
63 
     | 
    
         
             
              </div>
         
     | 
| 
       62 
64 
     | 
    
         
             
            </div>
         
     | 
| 
         @@ -66,18 +68,9 @@ 
     | 
|
| 
       66 
68 
     | 
    
         
             
            <div class="card">
         
     | 
| 
       67 
69 
     | 
    
         
             
              <div class="card-content">
         
     | 
| 
       68 
70 
     | 
    
         
             
                <h2 class="subtitle">Average Execution Time</h2>
         
     | 
| 
       69 
     | 
    
         
            -
                < 
     | 
| 
      
 71 
     | 
    
         
            +
                <rails-performance-chart id="response_time_report_chart" type="RT" legend="Response Time" class="chart">
         
     | 
| 
      
 72 
     | 
    
         
            +
                  <%= raw @response_time_report_data.to_json %>
         
     | 
| 
      
 73 
     | 
    
         
            +
                </rails-performance-chart>
         
     | 
| 
       70 
74 
     | 
    
         
             
                <p class="content is-small">All custom events in the application</p>
         
     | 
| 
       71 
75 
     | 
    
         
             
              </div>
         
     | 
| 
       72 
76 
     | 
    
         
             
            </div>
         
     | 
| 
       73 
     | 
    
         
            -
             
     | 
| 
       74 
     | 
    
         
            -
             
     | 
| 
       75 
     | 
    
         
            -
            <% content_for :on_load do %>
         
     | 
| 
       76 
     | 
    
         
            -
              <script>
         
     | 
| 
       77 
     | 
    
         
            -
                var data1 = <%= raw @throughput_report_data.to_json %>;
         
     | 
| 
       78 
     | 
    
         
            -
                showTIRChart('throughput_report_chart', data1, ' events / minute', 'Events');
         
     | 
| 
       79 
     | 
    
         
            -
             
     | 
| 
       80 
     | 
    
         
            -
                var data2 = <%= raw @response_time_report_data.to_json %>;
         
     | 
| 
       81 
     | 
    
         
            -
                showRTChart('response_time_report_chart', data2);
         
     | 
| 
       82 
     | 
    
         
            -
              </script>
         
     | 
| 
       83 
     | 
    
         
            -
            <% end %>
         
     | 
| 
         @@ -7,7 +7,9 @@ 
     | 
|
| 
       7 
7 
     | 
    
         
             
            <div class="card">
         
     | 
| 
       8 
8 
     | 
    
         
             
              <div class="card-content">
         
     | 
| 
       9 
9 
     | 
    
         
             
                <h2 class="subtitle">Delayed::Job Workers Throughput Report</h2>
         
     | 
| 
       10 
     | 
    
         
            -
                < 
     | 
| 
      
 10 
     | 
    
         
            +
                <rails-performance-chart id="throughput_report_chart" type="TIR" legend="Jobs" units="jobs / minute" class="chart">
         
     | 
| 
      
 11 
     | 
    
         
            +
                  <%= raw @throughput_report_data.to_json %>
         
     | 
| 
      
 12 
     | 
    
         
            +
                </rails-performance-chart>
         
     | 
| 
       11 
13 
     | 
    
         
             
                <p class="content is-small">All workers in the application</p>
         
     | 
| 
       12 
14 
     | 
    
         
             
              </div>
         
     | 
| 
       13 
15 
     | 
    
         
             
            </div>
         
     | 
| 
         @@ -17,7 +19,9 @@ 
     | 
|
| 
       17 
19 
     | 
    
         
             
            <div class="card">
         
     | 
| 
       18 
20 
     | 
    
         
             
              <div class="card-content">
         
     | 
| 
       19 
21 
     | 
    
         
             
                <h2 class="subtitle">Average Execution Time</h2>
         
     | 
| 
       20 
     | 
    
         
            -
                < 
     | 
| 
      
 22 
     | 
    
         
            +
                <rails-performance-chart id="response_time_report_chart" type="RT" legend="Response Time" class="chart">
         
     | 
| 
      
 23 
     | 
    
         
            +
                  <%= raw @response_time_report_data.to_json %>
         
     | 
| 
      
 24 
     | 
    
         
            +
                </rails-performance-chart>
         
     | 
| 
       21 
25 
     | 
    
         
             
                <p class="content is-small">All workers in the application</p>
         
     | 
| 
       22 
26 
     | 
    
         
             
              </div>
         
     | 
| 
       23 
27 
     | 
    
         
             
            </div>
         
     | 
| 
         @@ -61,14 +65,3 @@ 
     | 
|
| 
       61 
65 
     | 
    
         
             
                </table>
         
     | 
| 
       62 
66 
     | 
    
         
             
              </div>
         
     | 
| 
       63 
67 
     | 
    
         
             
            </div>
         
     | 
| 
       64 
     | 
    
         
            -
             
     | 
| 
       65 
     | 
    
         
            -
             
     | 
| 
       66 
     | 
    
         
            -
            <% content_for :on_load do %>
         
     | 
| 
       67 
     | 
    
         
            -
              <script>
         
     | 
| 
       68 
     | 
    
         
            -
                var data1 = <%= raw @throughput_report_data.to_json %>;
         
     | 
| 
       69 
     | 
    
         
            -
                showTIRChart('throughput_report_chart', data1, ' jobs / minute', 'Jobs');
         
     | 
| 
       70 
     | 
    
         
            -
             
     | 
| 
       71 
     | 
    
         
            -
                var data2 = <%= raw @response_time_report_data.to_json %>;
         
     | 
| 
       72 
     | 
    
         
            -
                showRTChart('response_time_report_chart', data2);
         
     | 
| 
       73 
     | 
    
         
            -
              </script>
         
     | 
| 
       74 
     | 
    
         
            -
            <% end %>
         
     | 
| 
         @@ -7,7 +7,9 @@ 
     | 
|
| 
       7 
7 
     | 
    
         
             
            <div class="card">
         
     | 
| 
       8 
8 
     | 
    
         
             
              <div class="card-content">
         
     | 
| 
       9 
9 
     | 
    
         
             
                <h2 class="subtitle">Grape Throughput Report</h2>
         
     | 
| 
       10 
     | 
    
         
            -
                < 
     | 
| 
      
 10 
     | 
    
         
            +
                <rails-performance-chart id="throughput_report_chart" type="TIR" legend="Requests" units="requests / minute" class="chart">
         
     | 
| 
      
 11 
     | 
    
         
            +
                  <%= raw @throughput_report_data.to_json %>
         
     | 
| 
      
 12 
     | 
    
         
            +
                </rails-performance-chart>
         
     | 
| 
       11 
13 
     | 
    
         
             
                <p class="content is-small"></p>
         
     | 
| 
       12 
14 
     | 
    
         
             
              </div>
         
     | 
| 
       13 
15 
     | 
    
         
             
            </div>
         
     | 
| 
         @@ -54,11 +56,3 @@ 
     | 
|
| 
       54 
56 
     | 
    
         
             
                </table>
         
     | 
| 
       55 
57 
     | 
    
         
             
              </div>
         
     | 
| 
       56 
58 
     | 
    
         
             
            </div>
         
     | 
| 
       57 
     | 
    
         
            -
             
     | 
| 
       58 
     | 
    
         
            -
             
     | 
| 
       59 
     | 
    
         
            -
            <% content_for :on_load do %>
         
     | 
| 
       60 
     | 
    
         
            -
              <script>
         
     | 
| 
       61 
     | 
    
         
            -
                var data1 = <%= raw @throughput_report_data.to_json %>;
         
     | 
| 
       62 
     | 
    
         
            -
                showTIRChart('throughput_report_chart', data1, ' requests / minute', 'Requests');
         
     | 
| 
       63 
     | 
    
         
            -
              </script>
         
     | 
| 
       64 
     | 
    
         
            -
            <% end %>
         
     |