Class: Sciosano::Configuration
- Inherits:
-
Object
- Object
- Sciosano::Configuration
- Defined in:
- lib/sciosano/configuration.rb
Overview
Configuration for sciosano client
Instance Attribute Summary collapse
-
#active_job_enabled ⇒ Boolean
Enable ActiveJob integration.
-
#api_key ⇒ String
API key for authentication (required).
-
#app_id ⇒ String?
Application ID (optional, extracted from API key if not provided).
-
#async ⇒ Boolean
Enable async sending (non-blocking).
-
#before_send ⇒ Proc?
Callback before sending report.
-
#debug ⇒ Boolean
Enable debug logging.
-
#endpoint ⇒ String
API endpoint URL.
-
#environment ⇒ String
Environment name (development, staging, production).
-
#filter_parameters ⇒ Array<String, Symbol, Regexp>
Parameters to filter from reports.
-
#ignore_patterns ⇒ Array<Class, String, Regexp>
Patterns to ignore (exception classes or message patterns).
-
#max_breadcrumbs ⇒ Integer
Maximum breadcrumbs to keep.
-
#rails_enabled ⇒ Boolean
Enable Rails integration.
-
#release ⇒ String?
Release/version identifier.
-
#sample_rate ⇒ Float
Sample rate for error capture (0.0 to 1.0).
-
#sidekiq_enabled ⇒ Boolean
Enable Sidekiq integration.
-
#timeout ⇒ Integer
Timeout for API requests in seconds.
Instance Method Summary collapse
-
#development? ⇒ Boolean
Check if environment is development.
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
-
#production? ⇒ Boolean
Check if environment is production.
-
#valid? ⇒ Boolean
Check if configuration is valid.
-
#validate! ⇒ Object
Validate configuration.
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/sciosano/configuration.rb', line 70 def initialize @api_key = nil @app_id = nil @endpoint = "https://api.sciosano.com" @environment = ENV.fetch("RAILS_ENV", ENV.fetch("RACK_ENV", "development")) @release = nil @debug = false @sample_rate = 1.0 @max_breadcrumbs = 100 @timeout = 5 @async = true @before_send = nil @ignore_patterns = default_ignore_patterns @rails_enabled = true @sidekiq_enabled = true @active_job_enabled = true @filter_parameters = default_filter_parameters end |
Instance Attribute Details
#active_job_enabled ⇒ Boolean
Enable ActiveJob integration
64 65 66 |
# File 'lib/sciosano/configuration.rb', line 64 def active_job_enabled @active_job_enabled end |
#api_key ⇒ String
API key for authentication (required)
8 9 10 |
# File 'lib/sciosano/configuration.rb', line 8 def api_key @api_key end |
#app_id ⇒ String?
Application ID (optional, extracted from API key if not provided)
12 13 14 |
# File 'lib/sciosano/configuration.rb', line 12 def app_id @app_id end |
#async ⇒ Boolean
Enable async sending (non-blocking)
44 45 46 |
# File 'lib/sciosano/configuration.rb', line 44 def async @async end |
#before_send ⇒ Proc?
Callback before sending report
48 49 50 |
# File 'lib/sciosano/configuration.rb', line 48 def before_send @before_send end |
#debug ⇒ Boolean
Enable debug logging
28 29 30 |
# File 'lib/sciosano/configuration.rb', line 28 def debug @debug end |
#endpoint ⇒ String
API endpoint URL
16 17 18 |
# File 'lib/sciosano/configuration.rb', line 16 def endpoint @endpoint end |
#environment ⇒ String
Environment name (development, staging, production)
20 21 22 |
# File 'lib/sciosano/configuration.rb', line 20 def environment @environment end |
#filter_parameters ⇒ Array<String, Symbol, Regexp>
Parameters to filter from reports
68 69 70 |
# File 'lib/sciosano/configuration.rb', line 68 def filter_parameters @filter_parameters end |
#ignore_patterns ⇒ Array<Class, String, Regexp>
Patterns to ignore (exception classes or message patterns)
52 53 54 |
# File 'lib/sciosano/configuration.rb', line 52 def ignore_patterns @ignore_patterns end |
#max_breadcrumbs ⇒ Integer
Maximum breadcrumbs to keep
36 37 38 |
# File 'lib/sciosano/configuration.rb', line 36 def @max_breadcrumbs end |
#rails_enabled ⇒ Boolean
Enable Rails integration
56 57 58 |
# File 'lib/sciosano/configuration.rb', line 56 def rails_enabled @rails_enabled end |
#release ⇒ String?
Release/version identifier
24 25 26 |
# File 'lib/sciosano/configuration.rb', line 24 def release @release end |
#sample_rate ⇒ Float
Sample rate for error capture (0.0 to 1.0)
32 33 34 |
# File 'lib/sciosano/configuration.rb', line 32 def sample_rate @sample_rate end |
#sidekiq_enabled ⇒ Boolean
Enable Sidekiq integration
60 61 62 |
# File 'lib/sciosano/configuration.rb', line 60 def sidekiq_enabled @sidekiq_enabled end |
#timeout ⇒ Integer
Timeout for API requests in seconds
40 41 42 |
# File 'lib/sciosano/configuration.rb', line 40 def timeout @timeout end |
Instance Method Details
#development? ⇒ Boolean
Check if environment is development
111 112 113 |
# File 'lib/sciosano/configuration.rb', line 111 def development? environment == "development" end |
#production? ⇒ Boolean
Check if environment is production
118 119 120 |
# File 'lib/sciosano/configuration.rb', line 118 def production? environment == "production" end |
#valid? ⇒ Boolean
Check if configuration is valid
101 102 103 104 105 106 |
# File 'lib/sciosano/configuration.rb', line 101 def valid? validate! true rescue ConfigurationError false end |
#validate! ⇒ Object
Validate configuration
92 93 94 95 96 |
# File 'lib/sciosano/configuration.rb', line 92 def validate! raise ConfigurationError, "API key is required" if api_key.nil? || api_key.empty? raise ConfigurationError, "Invalid API key format" unless api_key.match?(/^sciosano_\w+_[a-zA-Z0-9]+$/) raise ConfigurationError, "Sample rate must be between 0.0 and 1.0" unless (0.0..1.0).cover?(sample_rate) end |