activeinsights 1.1.1 → 1.2.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 192b4bd4748a82c5e01887fb8f54fe0a76c7ffdf1a8780d190879aaed37f5182
4
- data.tar.gz: d02890ed7d5dbfe9bd6339fd15c9997fdf295dc4d5dc145114b431298d420947
3
+ metadata.gz: 39be8c6402f757c5e3db80481b1275bdd0c221eb067fbaf0f274c418d598d72a
4
+ data.tar.gz: 2edea1bfb069a9015aa1d2612a96eb8db248a9b420d55c68c0022d008cb28c3c
5
5
  SHA512:
6
- metadata.gz: 25e424494797d134e929d9521c0052ae4e0a10138eba7a12d997b783d1857e76ba10dc4a20fc9492be05784ede505d7f233365eed8b7270e97363bd896ee453b
7
- data.tar.gz: e05659cbd9d081dbfa0c6e6e63c65b6ef3d8fe13d2c69abd6db316dc85cc7b787066e628bbe2418626f1d6c2eb72d1d0bee1fd92f1132f5b7baddd403a766bdb
6
+ metadata.gz: d50aae6bb1cad6a11568a52883b3a66f0d3b0c8d5fedd716b7ebf0aeddb943ff33126eeb13e81a97175240ba9cd7ef82f584d204267af9352fc7b07bdc6f7744
7
+ data.tar.gz: 66f45dfa2400ed9622e06af1bf34c55876b8513c7f4fd56598ece347a9dff644d4b70f45efb035221ebd035938b3cff119cf941071ac4cbcfa5200c8e6562535
data/README.md CHANGED
@@ -1,10 +1,12 @@
1
1
  # ActiveInsights
2
2
 
3
- One of the fundemental tools needed when taking your Rails app to production is
4
- a way to track response times. Unfortunately, theres no free, easy,
5
- open source way to track them for small or medium apps. Skylight, Honeybadger,
3
+ One of the fundamental tools needed when taking your Rails app to production is
4
+ a way to track response times. Unfortunately, there aren't many free, easy,
5
+ open source ways to track them for small or medium apps. Skylight, Honeybadger,
6
6
  Sentry, AppSignal, etc. are great, but they are are closed source and
7
7
  there should be an easy open source alternative where you control the data.
8
+ With Rails 8's ethos of No PAAS, there should be a way for new apps to start out
9
+ with a basic error reporter and not be forced to pay a third party for one.
8
10
 
9
11
  ActiveInsights hooks into the ActiveSupport [instrumention](https://guides.rubyonrails.org/active_support_instrumentation.html#)
10
12
  baked directly into Rails. ActiveInsights tracks RPM, RPM per controller, and
@@ -34,13 +36,13 @@ Or install it yourself as:
34
36
  $ gem install activeinsights
35
37
  ```
36
38
 
37
- And then install migrations:
39
+ Run the installer and migrate:
38
40
  ```bash
39
- bin/rails g active_insights:install
41
+ bin/rails active_insights:install
40
42
  bin/rails rails db:migrate
41
43
  ```
42
44
 
43
- This also mounts a route in your routes file to view the insights at `/insights`.
45
+ This will mount a route in your routes file to view the insights at `/insights`.
44
46
 
45
47
 
46
48
  ##### Config
@@ -58,6 +60,11 @@ You can supply an array of ignored endpoints
58
60
  config.active_insights.ignored_endpoints = ["Rails::HealthController#show"]
59
61
  ```
60
62
 
63
+ If you are using Sprockets, add the ActiveInsights css file to manifest.js:
64
+ ```javascript
65
+ //= link active_insights/application.css
66
+ ```
67
+
61
68
  ## Development
62
69
 
63
70
  After checking out the repo, run `bin/setup` to install dependencies. Then, run
@@ -3,15 +3,15 @@
3
3
  module ActiveInsights
4
4
  class Request < ::ActiveInsights::Record
5
5
  def self.setup(started, finished, unique_id, payload)
6
- create!(started_at: started, finished_at: finished, uuid: unique_id,
7
- http_method: payload[:method], **payload.slice(
8
- :controller, :action, :format, :status, :view_runtime,
9
- :db_runtime
10
- ))
6
+ create!(started_at: started, ip_address: payload[:request].remote_ip,
7
+ finished_at: finished, uuid: unique_id,
8
+ http_method: payload[:method],
9
+ **payload.slice(:controller, :action, :format, :status,
10
+ :view_runtime, :db_runtime, :path))
11
11
  end
12
12
 
13
13
  def percentage(others)
14
- (parsed_durations.sum / others.flat_map(&:parsed_durations).sum) * 100.0
14
+ (agony / others.sum(&:agony)) * 100.0
15
15
  end
16
16
  end
17
17
  end
@@ -50,7 +50,7 @@
50
50
  <tr>
51
51
  <td><%= link_to model.formatted_controller, controller_p_values_path(@date.first.to_date, model.formatted_controller) %></td>
52
52
  <td><%= per_minute(model.parsed_durations.size, (@date.last - @date.first).seconds) %></td>
53
- <td><%= number_to_percentage model.percentage(@requests.excluding(model)), precision: 1 %></td>
53
+ <td><%= number_to_percentage model.percentage(@requests), precision: 1 %></td>
54
54
  <td><%= model.p50 %> ms</td>
55
55
  <td><%= model.p95 %> ms</td>
56
56
  <td><%= model.p99 %> ms</td>
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ class AddIpAddressToRequests < ActiveRecord::Migration[7.1]
4
+ def change
5
+ add_column :active_insights_requests, :ip_address, :string
6
+ end
7
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ActiveInsights
4
- VERSION = "1.1.1"
4
+ VERSION = "1.2.0"
5
5
  end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ class ActiveInsights::UpdateGenerator < Rails::Generators::Base
4
+ def create_migrations
5
+ rails_command "active_insights:install:migrations", inline: true
6
+ end
7
+ end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ desc "Copy over the migrations and mount route for ActiveInsights"
4
+ namespace :active_insights do
5
+ task install: :environment do
6
+ Rails::Command.invoke :generate, ["active_insights:install"]
7
+ end
8
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activeinsights
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nick Pezza
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-10-03 00:00:00.000000000 Z
11
+ date: 2024-10-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: chartkick
@@ -90,6 +90,7 @@ files:
90
90
  - config/initializers/importmap.rb
91
91
  - config/routes.rb
92
92
  - db/migrate/20240111225806_create_active_insights_tables.rb
93
+ - db/migrate/20241015142450_add_ip_address_to_requests.rb
93
94
  - lib/active_insights.rb
94
95
  - lib/active_insights/engine.rb
95
96
  - lib/active_insights/seeders/jobs.rb
@@ -97,6 +98,8 @@ files:
97
98
  - lib/active_insights/version.rb
98
99
  - lib/activeinsights.rb
99
100
  - lib/generators/active_insights/install/install_generator.rb
101
+ - lib/generators/active_insights/update/update_generator.rb
102
+ - lib/tasks/active_insights_tasks.rake
100
103
  homepage: https://github.com/npezza93/activeinsights
101
104
  licenses:
102
105
  - MIT