solid_apm 0.11.2 → 0.12.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: 5ae3dca7dc8bedd15f5e89ee1c533d5f7e95707c4afa8b550f679a799a3bed0e
4
- data.tar.gz: 4b45583cb978b1b7515e4b3482f1bbc0fc9e67963228a5deaf74163abceeb333
3
+ metadata.gz: 8842bfe3a66179077da889c3d8bae05eec4696d9fdd4839b54bac7a658d7f2c8
4
+ data.tar.gz: ee87c079419ad5d4fc45709c3534e6a2f406601efed22bac6a47e8eb819d5758
5
5
  SHA512:
6
- metadata.gz: 01cebd760d13efbfac07743552fc34a91b9230d60bee26ba061ee7aca5e2db536f3f57580b35442bbb7996ae991d6c9b824f40a5efd134f7e8f15ea0ced30f10
7
- data.tar.gz: a48210bbf993f9da2c4a8200a3cbc01c2c661147bd5b6451ad5486029859fe0c6c29f1aa84f146c40943d535176d4ad8e388fb9cfc3d741e605099255e294e62
6
+ metadata.gz: 934096ab8bf0b3f339588939a7b06d62b2a1cc86a54f1b426407a5aad3434a720b6ee0556341ba1d2950c36f29bb9987e34618c8b0d6181dd3e721853724818a
7
+ data.tar.gz: 12ceaacfe88e697a17277fb0421aaf10b2a90b97513ea1a214a0aeb7cbb09fa854a999d958cfe7e4160c05b8f52ef37daa841d9e54b01bc5b9565d8e7d968c42
data/README.md CHANGED
@@ -7,6 +7,10 @@ Rails engine to manage APM data without using a third party service.
7
7
  <img src="./docs/img_1.png" width="600px">
8
8
  <img src="./docs/img_2.png" width="600px">
9
9
 
10
+
11
+ > [!NOTE]
12
+ For a more **mature** solution (but dependent on Redis) have look to [rails_performance](https://github.com/igorkasyanchuk/rails_performance).
13
+
10
14
  ## Installation
11
15
 
12
16
  Add to your Gemfile:
@@ -95,6 +99,18 @@ The sampling is done per-thread using a round-robin counter, ensuring even distr
95
99
  This is useful for high-traffic applications where you want to reduce the volume of
96
100
  APM data while still maintaining representative performance insights.
97
101
 
102
+ ### Test Environment
103
+
104
+ **SolidAPM is automatically disabled in the test
105
+ environment** to prevent test pollution and improve test performance.
106
+
107
+ You can disable SolidAPM in other environments if needed:
108
+
109
+ ```ruby
110
+ # config/environments/staging.rb
111
+ SolidApm.enabled = false
112
+ ```
113
+
98
114
  ### Transaction Name Filtering
99
115
 
100
116
  Filter specific transactions by name using exact string matches or regular expressions:
@@ -4,7 +4,9 @@ module SolidApm
4
4
  class Engine < ::Rails::Engine
5
5
  isolate_namespace SolidApm
6
6
 
7
- config.app_middleware.use Middleware
7
+ initializer 'solid_apm.middleware', before: :build_middleware_stack do |app|
8
+ app.middleware.use SolidApm::Middleware if SolidApm.enabled
9
+ end
8
10
 
9
11
  initializer 'solid_apm.assets' do |app|
10
12
  # Add engine's assets to the load path for both Propshaft and Sprockets
@@ -49,7 +51,7 @@ module SolidApm
49
51
  end
50
52
 
51
53
  config.after_initialize do
52
- SpanSubscriber::Base.subscribe!
54
+ SpanSubscriber::Base.subscribe! if SolidApm.enabled
53
55
  end
54
56
  end
55
57
  end
@@ -7,10 +7,12 @@ module SolidApm
7
7
  end
8
8
 
9
9
  def call(env)
10
+ return @app.call(env) unless SolidApm.enabled
11
+
10
12
  self.class.init_transaction
11
13
  status, headers, body = @app.call(env)
12
14
 
13
- env['rack.after_reply'] ||= []
15
+ env['rack.after_reply'] ||= []
14
16
  env['rack.after_reply'] << ->() do
15
17
  self.class.call
16
18
  rescue StandardError => e
@@ -25,8 +27,8 @@ module SolidApm
25
27
  SpanSubscriber::Base.transaction = nil
26
28
 
27
29
  if transaction.nil? ||
28
- transaction_filtered?(transaction.name) ||
29
- !Sampler.should_sample?
30
+ transaction_filtered?(transaction.name) ||
31
+ !Sampler.should_sample?
30
32
 
31
33
  SpanSubscriber::Base.spans = nil
32
34
  return
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ module SolidApm
4
+ class Railtie < Rails::Railtie
5
+ config.before_initialize do
6
+ # Always disable in test environment to prevent test pollution
7
+ SolidApm.enabled = false if Rails.env.test?
8
+ end
9
+ end
10
+ end
@@ -1,3 +1,3 @@
1
1
  module SolidApm
2
- VERSION = "0.11.2"
2
+ VERSION = "0.12.1"
3
3
  end
data/lib/solid_apm.rb CHANGED
@@ -4,6 +4,7 @@ require 'active_median'
4
4
  require 'apexcharts'
5
5
 
6
6
  require 'solid_apm/version'
7
+ require 'solid_apm/railtie'
7
8
  require 'solid_apm/engine'
8
9
  require 'solid_apm/sampler'
9
10
  require 'solid_apm/cleanup_service'
@@ -13,6 +14,7 @@ module SolidApm
13
14
  mattr_accessor :mcp_server_config, default: {}
14
15
  mattr_accessor :silence_active_record_logger, default: true
15
16
  mattr_accessor :transaction_sampling, default: 1
17
+ mattr_accessor :enabled, default: true
16
18
  mattr_accessor(
17
19
  :transaction_filters, default: [
18
20
  /^SolidApm::/,
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: solid_apm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.2
4
+ version: 0.12.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jean-Francis Bastien
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 1980-01-02 00:00:00.000000000 Z
10
+ date: 2026-02-03 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: actionpack
@@ -151,6 +151,7 @@ files:
151
151
  - lib/solid_apm/mcp/impactful_transactions_resource.rb
152
152
  - lib/solid_apm/mcp/spans_for_transaction_tool.rb
153
153
  - lib/solid_apm/middleware.rb
154
+ - lib/solid_apm/railtie.rb
154
155
  - lib/solid_apm/sampler.rb
155
156
  - lib/solid_apm/version.rb
156
157
  - lib/tasks/solid_apm_tasks.rake
@@ -175,7 +176,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
175
176
  - !ruby/object:Gem::Version
176
177
  version: '0'
177
178
  requirements: []
178
- rubygems_version: 3.6.9
179
+ rubygems_version: 3.6.2
179
180
  specification_version: 4
180
181
  summary: SolidApm is a DB base engine for Application Performance Monitoring.
181
182
  test_files: []