Class: BrainzLab::Rails::Configuration
- Inherits:
-
Object
- Object
- BrainzLab::Rails::Configuration
- Defined in:
- lib/brainzlab/rails/configuration.rb
Instance Attribute Summary collapse
-
#action_cable_enabled ⇒ Object
Returns the value of attribute action_cable_enabled.
-
#action_controller_enabled ⇒ Object
Collector settings.
-
#action_mailer_enabled ⇒ Object
Returns the value of attribute action_mailer_enabled.
-
#action_view_enabled ⇒ Object
Returns the value of attribute action_view_enabled.
-
#active_job_enabled ⇒ Object
Returns the value of attribute active_job_enabled.
-
#active_record_enabled ⇒ Object
Returns the value of attribute active_record_enabled.
-
#active_storage_enabled ⇒ Object
Returns the value of attribute active_storage_enabled.
-
#async_processing ⇒ Object
Performance.
-
#batch_size ⇒ Object
Batch events before sending.
-
#cache_efficiency_tracking ⇒ Object
Returns the value of attribute cache_efficiency_tracking.
-
#cache_enabled ⇒ Object
Returns the value of attribute cache_enabled.
-
#flush_interval_ms ⇒ Object
Flush interval for batched events.
-
#flux_enabled ⇒ Object
Metrics.
-
#ignored_actions ⇒ Object
Filtering.
-
#ignored_job_classes ⇒ Object
Job classes to ignore.
-
#ignored_sql_patterns ⇒ Object
SQL patterns to ignore (e.g., SCHEMA queries).
-
#n_plus_one_detection ⇒ Object
Analyzer settings.
-
#nerve_enabled ⇒ Object
Job monitoring.
-
#pulse_enabled ⇒ Object
Product routing - which products receive which events.
-
#recall_enabled ⇒ Object
Structured logging.
-
#reflex_enabled ⇒ Object
Error tracking.
-
#sample_rate ⇒ Object
Sampling.
-
#slow_query_threshold_ms ⇒ Object
Returns the value of attribute slow_query_threshold_ms.
Instance Method Summary collapse
- #flux_effectively_enabled? ⇒ Boolean
- #ignored_action?(controller, action) ⇒ Boolean
- #ignored_job?(job_class) ⇒ Boolean
- #ignored_sql?(sql) ⇒ Boolean
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #nerve_effectively_enabled? ⇒ Boolean
- #pulse_effectively_enabled? ⇒ Boolean
- #recall_effectively_enabled? ⇒ Boolean
- #reflex_effectively_enabled? ⇒ Boolean
- #should_sample? ⇒ Boolean
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/brainzlab/rails/configuration.rb', line 41 def initialize # Default: all products enabled (respects main SDK settings) @pulse_enabled = true @recall_enabled = true @reflex_enabled = true @flux_enabled = true @nerve_enabled = true # Default: all collectors enabled @action_controller_enabled = true @action_view_enabled = true @active_record_enabled = true @active_job_enabled = true @action_cable_enabled = true @action_mailer_enabled = true @active_storage_enabled = true @cache_enabled = true # Default: analyzers enabled with sensible thresholds @n_plus_one_detection = true @slow_query_threshold_ms = 100 @cache_efficiency_tracking = true # Default: ignore common noise @ignored_actions = [] @ignored_sql_patterns = [ /\ASELECT.*FROM.*schema_migrations/i, /\ASELECT.*FROM.*ar_internal_metadata/i ] @ignored_job_classes = [] # Default: capture everything @sample_rate = 1.0 # Default: async with batching @async_processing = true @batch_size = 100 @flush_interval_ms = 1000 end |
Instance Attribute Details
#action_cable_enabled ⇒ Object
Returns the value of attribute action_cable_enabled.
18 19 20 |
# File 'lib/brainzlab/rails/configuration.rb', line 18 def action_cable_enabled @action_cable_enabled end |
#action_controller_enabled ⇒ Object
Collector settings
14 15 16 |
# File 'lib/brainzlab/rails/configuration.rb', line 14 def action_controller_enabled @action_controller_enabled end |
#action_mailer_enabled ⇒ Object
Returns the value of attribute action_mailer_enabled.
19 20 21 |
# File 'lib/brainzlab/rails/configuration.rb', line 19 def action_mailer_enabled @action_mailer_enabled end |
#action_view_enabled ⇒ Object
Returns the value of attribute action_view_enabled.
15 16 17 |
# File 'lib/brainzlab/rails/configuration.rb', line 15 def action_view_enabled @action_view_enabled end |
#active_job_enabled ⇒ Object
Returns the value of attribute active_job_enabled.
17 18 19 |
# File 'lib/brainzlab/rails/configuration.rb', line 17 def active_job_enabled @active_job_enabled end |
#active_record_enabled ⇒ Object
Returns the value of attribute active_record_enabled.
16 17 18 |
# File 'lib/brainzlab/rails/configuration.rb', line 16 def active_record_enabled @active_record_enabled end |
#active_storage_enabled ⇒ Object
Returns the value of attribute active_storage_enabled.
20 21 22 |
# File 'lib/brainzlab/rails/configuration.rb', line 20 def active_storage_enabled @active_storage_enabled end |
#async_processing ⇒ Object
Performance
37 38 39 |
# File 'lib/brainzlab/rails/configuration.rb', line 37 def async_processing @async_processing end |
#batch_size ⇒ Object
Batch events before sending
38 39 40 |
# File 'lib/brainzlab/rails/configuration.rb', line 38 def batch_size @batch_size end |
#cache_efficiency_tracking ⇒ Object
Returns the value of attribute cache_efficiency_tracking.
26 27 28 |
# File 'lib/brainzlab/rails/configuration.rb', line 26 def cache_efficiency_tracking @cache_efficiency_tracking end |
#cache_enabled ⇒ Object
Returns the value of attribute cache_enabled.
21 22 23 |
# File 'lib/brainzlab/rails/configuration.rb', line 21 def cache_enabled @cache_enabled end |
#flush_interval_ms ⇒ Object
Flush interval for batched events
39 40 41 |
# File 'lib/brainzlab/rails/configuration.rb', line 39 def flush_interval_ms @flush_interval_ms end |
#flux_enabled ⇒ Object
Metrics
10 11 12 |
# File 'lib/brainzlab/rails/configuration.rb', line 10 def flux_enabled @flux_enabled end |
#ignored_actions ⇒ Object
Filtering
29 30 31 |
# File 'lib/brainzlab/rails/configuration.rb', line 29 def ignored_actions @ignored_actions end |
#ignored_job_classes ⇒ Object
Job classes to ignore
31 32 33 |
# File 'lib/brainzlab/rails/configuration.rb', line 31 def ignored_job_classes @ignored_job_classes end |
#ignored_sql_patterns ⇒ Object
SQL patterns to ignore (e.g., SCHEMA queries)
30 31 32 |
# File 'lib/brainzlab/rails/configuration.rb', line 30 def ignored_sql_patterns @ignored_sql_patterns end |
#n_plus_one_detection ⇒ Object
Analyzer settings
24 25 26 |
# File 'lib/brainzlab/rails/configuration.rb', line 24 def n_plus_one_detection @n_plus_one_detection end |
#nerve_enabled ⇒ Object
Job monitoring
11 12 13 |
# File 'lib/brainzlab/rails/configuration.rb', line 11 def nerve_enabled @nerve_enabled end |
#pulse_enabled ⇒ Object
Product routing - which products receive which events
7 8 9 |
# File 'lib/brainzlab/rails/configuration.rb', line 7 def pulse_enabled @pulse_enabled end |
#recall_enabled ⇒ Object
Structured logging
8 9 10 |
# File 'lib/brainzlab/rails/configuration.rb', line 8 def recall_enabled @recall_enabled end |
#reflex_enabled ⇒ Object
Error tracking
9 10 11 |
# File 'lib/brainzlab/rails/configuration.rb', line 9 def reflex_enabled @reflex_enabled end |
#sample_rate ⇒ Object
Sampling
34 35 36 |
# File 'lib/brainzlab/rails/configuration.rb', line 34 def sample_rate @sample_rate end |
#slow_query_threshold_ms ⇒ Object
Returns the value of attribute slow_query_threshold_ms.
25 26 27 |
# File 'lib/brainzlab/rails/configuration.rb', line 25 def slow_query_threshold_ms @slow_query_threshold_ms end |
Instance Method Details
#flux_effectively_enabled? ⇒ Boolean
93 94 95 |
# File 'lib/brainzlab/rails/configuration.rb', line 93 def flux_effectively_enabled? @flux_enabled && BrainzLab.configuration&.flux_enabled end |
#ignored_action?(controller, action) ⇒ Boolean
108 109 110 |
# File 'lib/brainzlab/rails/configuration.rb', line 108 def ignored_action?(controller, action) @ignored_actions.include?("#{controller}##{action}") end |
#ignored_job?(job_class) ⇒ Boolean
116 117 118 |
# File 'lib/brainzlab/rails/configuration.rb', line 116 def ignored_job?(job_class) @ignored_job_classes.include?(job_class.to_s) end |
#ignored_sql?(sql) ⇒ Boolean
112 113 114 |
# File 'lib/brainzlab/rails/configuration.rb', line 112 def ignored_sql?(sql) @ignored_sql_patterns.any? { |pattern| sql.match?(pattern) } end |
#nerve_effectively_enabled? ⇒ Boolean
97 98 99 |
# File 'lib/brainzlab/rails/configuration.rb', line 97 def nerve_effectively_enabled? @nerve_enabled end |
#pulse_effectively_enabled? ⇒ Boolean
81 82 83 |
# File 'lib/brainzlab/rails/configuration.rb', line 81 def pulse_effectively_enabled? @pulse_enabled && BrainzLab.configuration&.pulse_effectively_enabled? end |
#recall_effectively_enabled? ⇒ Boolean
85 86 87 |
# File 'lib/brainzlab/rails/configuration.rb', line 85 def recall_effectively_enabled? @recall_enabled && BrainzLab.configuration&.recall_effectively_enabled? end |
#reflex_effectively_enabled? ⇒ Boolean
89 90 91 |
# File 'lib/brainzlab/rails/configuration.rb', line 89 def reflex_effectively_enabled? @reflex_enabled && BrainzLab.configuration&.reflex_effectively_enabled? end |
#should_sample? ⇒ Boolean
101 102 103 104 105 106 |
# File 'lib/brainzlab/rails/configuration.rb', line 101 def should_sample? return true if @sample_rate >= 1.0 return false if @sample_rate <= 0.0 rand < @sample_rate end |