Class: Koderift::Rails::Configuration
- Inherits:
-
Object
- Object
- Koderift::Rails::Configuration
- Defined in:
- lib/koderift/rails/configuration.rb
Instance Attribute Summary collapse
-
#current_user ⇒ Object
Lambda called with the controller instance to get the current user.
-
#enabled ⇒ Object
Whether to enable the instrumentation.
-
#external_call_ignore_hosts ⇒ Object
Hosts to exclude from external call tracking (e.g. internal services, localhost, known noise).
-
#filter_params ⇒ Object
Parameters to filter from captured request params.
-
#max_breadcrumbs ⇒ Object
Maximum number of breadcrumbs to capture per request.
-
#project_token ⇒ Object
Required: identifies which project this app reports to.
-
#rum_enabled ⇒ Object
Whether to enable Browser RUM.
-
#rum_sampling_rate ⇒ Object
Fraction of sessions to capture (0.0–1.0).
-
#slow_job_threshold_ms ⇒ Object
Threshold in milliseconds above which a Sidekiq job is marked 'slow' in the emitted log payload.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #valid? ⇒ 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 |
# File 'lib/koderift/rails/configuration.rb', line 41 def initialize @project_token = nil @current_user = default_current_user @filter_params = %w[ password password_confirmation token secret authenticity_token credit_card cvv ssn ] @max_breadcrumbs = 20 @external_call_ignore_hosts = [] @enabled = true @rum_enabled = true @rum_sampling_rate = 0.1 @slow_job_threshold_ms = 30_000 end |
Instance Attribute Details
#current_user ⇒ Object
Lambda called with the controller instance to get the current user. Default tries common patterns. Override if your app is different. Example: ->(controller) { controller.current_user }
13 14 15 |
# File 'lib/koderift/rails/configuration.rb', line 13 def current_user @current_user end |
#enabled ⇒ Object
Whether to enable the instrumentation. Set to false to disable without removing the gem.
27 28 29 |
# File 'lib/koderift/rails/configuration.rb', line 27 def enabled @enabled end |
#external_call_ignore_hosts ⇒ Object
Hosts to exclude from external call tracking (e.g. internal services, localhost, known noise). Always excludes 127.0.0.1 and localhost.
23 24 25 |
# File 'lib/koderift/rails/configuration.rb', line 23 def external_call_ignore_hosts @external_call_ignore_hosts end |
#filter_params ⇒ Object
Parameters to filter from captured request params.
16 17 18 |
# File 'lib/koderift/rails/configuration.rb', line 16 def filter_params @filter_params end |
#max_breadcrumbs ⇒ Object
Maximum number of breadcrumbs to capture per request.
19 20 21 |
# File 'lib/koderift/rails/configuration.rb', line 19 def @max_breadcrumbs end |
#project_token ⇒ Object
Required: identifies which project this app reports to. Set from an environment variable in the initializer.
8 9 10 |
# File 'lib/koderift/rails/configuration.rb', line 8 def project_token @project_token end |
#rum_enabled ⇒ Object
Whether to enable Browser RUM. Set to false for API-only apps. Defaults to true — the meta tag is harmless if rum.js is not loaded.
31 32 33 |
# File 'lib/koderift/rails/configuration.rb', line 31 def rum_enabled @rum_enabled end |
#rum_sampling_rate ⇒ Object
Fraction of sessions to capture (0.0–1.0). Default 0.1 (10%). Passed to rum.js so sampling happens client-side.
35 36 37 |
# File 'lib/koderift/rails/configuration.rb', line 35 def rum_sampling_rate @rum_sampling_rate end |
#slow_job_threshold_ms ⇒ Object
Threshold in milliseconds above which a Sidekiq job is marked 'slow' in the emitted log payload. Default 30_000 (30 seconds).
39 40 41 |
# File 'lib/koderift/rails/configuration.rb', line 39 def slow_job_threshold_ms @slow_job_threshold_ms end |
Instance Method Details
#valid? ⇒ Boolean
57 58 59 |
# File 'lib/koderift/rails/configuration.rb', line 57 def valid? project_token.present? end |