rails_pulse 0.3.0 → 0.3.1

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: 73e953ecde75c821f2b087aa65de061abcb05b817afa5a1bbaa2c0493bae2f7a
4
- data.tar.gz: 405125c84023db9fe95cc614c0786fb9ead5601f6085987e0acdf22913e5ff38
3
+ metadata.gz: bc7710c1fd792d4caca32fe285af8c8d9c11f53cd5e31ba177e061d44f92600e
4
+ data.tar.gz: 483b8c6a00e0e24d2331895299dfdee8629bc44c39a5717697d1914317da39f4
5
5
  SHA512:
6
- metadata.gz: a3d92ff1d329fd5e08cc874e048520acc4b57400cdb7a3c14cfd67eee3b3d970758f74f978b1ec6325f19b4112c68a60eee5a4b8ec26195c604ad03f25f85a50
7
- data.tar.gz: 4536029a848aaf8ccec5b852b8c3d14ae1a7948282b5282809793134b75c3869c37a8867d137918b86107ebcadde16f2a85b4dca00aacc36203cfc37c5b2a9b2
6
+ metadata.gz: 79604b447464e692b6640be70cba507516481d1633e2ff556171c0e55a55fc6cc6d4077b1018bf567d2a72ec4b312fdcd05e575dfc6b5cc76635363b37655266
7
+ data.tar.gz: ffdc4668b94956f68697b9339aa1de8a2065f99e9346e8fa1e93e97d3e12adf0dc32cf4fc5b8ddc8a7bbe24d44392ec6d03f69060f6574d5bb05e2eda6285915
@@ -125,7 +125,7 @@ module RailsPulse
125
125
  end
126
126
 
127
127
  def set_request
128
- @request = Request.find(params[:id])
128
+ @request = Request.includes(operations: :query).find(params[:id])
129
129
  end
130
130
  end
131
131
  end
@@ -40,8 +40,8 @@ RailsPulse::Schema ||= lambda do |connection|
40
40
 
41
41
  unless connection.table_exists?(:rails_pulse_queries)
42
42
  connection.create_table :rails_pulse_queries do |t|
43
- t.string :hashed_sql, limit: 32, null: false, comment: "MD5 hash of normalized SQL for indexing"
44
- t.text :normalized_sql, null: false, comment: "Normalized SQL query string (e.g., SELECT * FROM users WHERE id = ?)"
43
+ t.string :hashed_sql, limit: 32, null: false, comment: "MD5 hash of normalized SQL for fast lookups and uniqueness"
44
+ t.text :normalized_sql, null: false, comment: "Full normalized SQL query string (e.g., SELECT * FROM users WHERE id = ?)"
45
45
  t.datetime :analyzed_at, comment: "When query analysis was last performed"
46
46
  t.text :explain_plan, comment: "EXPLAIN output from actual SQL execution"
47
47
  t.text :issues, comment: "JSON array of detected performance issues"
@@ -68,6 +68,7 @@ RailsPulse::Schema ||= lambda do |connection|
68
68
  t.string :controller_action, comment: "Controller and action handling the request (e.g., PostsController#show)"
69
69
  t.timestamp :occurred_at, null: false, comment: "When the request started"
70
70
  t.text :tags, comment: "JSON array of tags for filtering and categorization"
71
+ t.integer :response_size_bytes, comment: "HTTP response body size in bytes"
71
72
  t.timestamps
72
73
  end
73
74
 
@@ -131,6 +132,10 @@ RailsPulse::Schema ||= lambda do |connection|
131
132
  t.string :codebase_location, comment: "File and line number (e.g., app/models/user.rb:25)"
132
133
  t.float :start_time, null: false, default: 0.0, comment: "Operation start time in milliseconds"
133
134
  t.timestamp :occurred_at, null: false, comment: "When the request started"
135
+ t.integer :row_count, comment: "Number of rows returned (SQL operations, Rails 7.1+)"
136
+ t.boolean :cache_hit, comment: "Whether a cache_read operation hit the cache"
137
+ t.text :repeated_query_group, comment: "Normalized SQL key identifying an N+1 group"
138
+ t.integer :repetition_count, comment: "Number of times this query pattern repeated in the request"
134
139
  t.timestamps
135
140
  end
136
141
 
@@ -154,7 +159,7 @@ RailsPulse::Schema ||= lambda do |connection|
154
159
  t.string :period_type, null: false, comment: "Aggregation period type: hour, day, week, month"
155
160
 
156
161
  # Polymorphic association to handle both routes and queries
157
- t.references :summarizable, polymorphic: true, null: false, index: false, comment: "Link to Route or Query"
162
+ t.references :summarizable, polymorphic: true, null: false, index: true, comment: "Link to Route or Query"
158
163
  # This creates summarizable_type (e.g., 'RailsPulse::Route', 'RailsPulse::Query')
159
164
  # and summarizable_id (route_id or query_id)
160
165
 
@@ -1,3 +1,3 @@
1
1
  module RailsPulse
2
- VERSION = "0.3.0"
2
+ VERSION = "0.3.1"
3
3
  end
data/lib/rails_pulse.rb CHANGED
@@ -16,7 +16,11 @@ module RailsPulse
16
16
  end
17
17
 
18
18
  def logger
19
- @logger ||= ActiveSupport::TaggedLogging.new(Rails.logger).tagged("RailsPulse")
19
+ if defined?(Rails) && Rails.respond_to?(:logger) && Rails.logger
20
+ @logger ||= ActiveSupport::TaggedLogging.new(Rails.logger).tagged("RailsPulse")
21
+ else
22
+ Logger.new($stdout)
23
+ end
20
24
  end
21
25
 
22
26
  def clear_metric_cache!
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_pulse
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Scott Harvey
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2026-04-30 00:00:00.000000000 Z
11
+ date: 2026-05-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails