activeinsights 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 224f2e05720b4f7ed167aef5cb469c741f38092d6151b6654087ad8b2f9d1c97
4
- data.tar.gz: 4c78b34bfd30da47e0583752f814211a6bc0d26aa6715312a726a9b9b36b1e58
3
+ metadata.gz: 357a2bfdbba595c8b40f5a63b2417d49bc6f4288c688e0d75ab77ba378cd078e
4
+ data.tar.gz: 52e2ad59d758b76ad46aa01cf592a3365dfe3baa407556196acbc027cbec121a
5
5
  SHA512:
6
- metadata.gz: c6718d87d6db17476c8ecc4c9738bc3069064a0a842afbc01d6279993515607a67cf6d41535b32a93bebd7097869871fd19f28662093df3851aae2b11e88ef51
7
- data.tar.gz: fdf1d55c14ed9d7ec9c98e7f98c71aa9e9e5bcf6520ff4c728412ea3199cb9f9e95c06f5733c7fb3c84b8e554f1d2576895fc63ebad8387dfb624a902d972091
6
+ metadata.gz: fc8e3e23c6d340f047392bf9f21cd8e1bc1b255d9d072e7f30f4b2494d639522e3f1276021461ff87649c48bc0c61854ba234422ad2e508e0efbced367a28ab0
7
+ data.tar.gz: 1f184e727faf3f5a50ecc017158ee97058b5de3dacb4d8e0b8d3ba9d4725f62f245a4220d47a9221fb6dbfcbe700943c92f213ca4c58e2ef15586f22238d60b0
@@ -7,7 +7,7 @@ module ActiveInsights
7
7
  ActiveInsights::Request.where(started_at: @date).
8
8
  with_durations.select(:formatted_controller).
9
9
  group(:formatted_controller).
10
- sort_by { |model| model.durations.count(",") + 1 }.reverse
10
+ sort_by(&:agony).reverse
11
11
  end
12
12
  end
13
13
  end
@@ -39,7 +39,7 @@ module ActiveInsights
39
39
  private
40
40
 
41
41
  def percentile_value(data, percentile)
42
- value = data[(percentile * data.size).ceil - 1]
42
+ value = data.sort[(percentile * data.size).ceil - 1]
43
43
 
44
44
  value&.round(1) || "N/A"
45
45
  end
@@ -4,10 +4,12 @@ module ActiveInsights
4
4
  class Request < ::ActiveInsights::Record
5
5
  scope :with_durations, lambda {
6
6
  case connection.adapter_name
7
- when "SQLite", "Mysql2", "Mysql2Spatial", "Mysql2Rgeo", "Trilogy"
8
- select("GROUP_CONCAT(duration) AS durations")
7
+ when "SQLite"
8
+ select("JSON_GROUP_ARRAY(duration) AS durations")
9
+ when "Mysql2", "Mysql2Spatial", "Mysql2Rgeo", "Trilogy"
10
+ select("JSON_ARRAYAGG(duration) AS durations")
9
11
  when "PostgreSQL"
10
- select("STRING_AGG(CAST(duration AS varchar), ',') AS durations")
12
+ select("JSON_AGG(duration) AS durations")
11
13
  end
12
14
  }
13
15
  scope :minute_by_minute, lambda {
@@ -42,7 +44,11 @@ module ActiveInsights
42
44
  def parsed_durations
43
45
  return unless respond_to?(:durations)
44
46
 
45
- @parsed_durations ||= durations.split(",").map(&:to_f).sort
47
+ @parsed_durations ||=
48
+ if durations.is_a?(Array) then durations
49
+ else
50
+ JSON.parse(durations)
51
+ end.sort
46
52
  end
47
53
 
48
54
  def pretty_started_at
@@ -41,7 +41,7 @@
41
41
  </tr>
42
42
  </thead>
43
43
  <tbody>
44
- <% @requests.sort_by(&:agony).reverse.each do |model| %>
44
+ <% @requests.each do |model| %>
45
45
  <tr>
46
46
  <td><%= link_to model.formatted_controller, controller_p_values_path(@date.first.to_date, model.formatted_controller) %></td>
47
47
  <td><%= per_minute(model.parsed_durations.size, (@date.last - @date.first).seconds) %></td>
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ActiveInsights
4
- VERSION = "0.1.3"
4
+ VERSION = "0.1.4"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activeinsights
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nick Pezza