Class: RailsErrorDashboard::Configuration
- Inherits:
-
Object
- Object
- RailsErrorDashboard::Configuration
- Defined in:
- lib/rails_error_dashboard/configuration.rb
Instance Attribute Summary collapse
-
#app_version ⇒ Object
Enhanced metrics.
-
#application_name ⇒ Object
Multi-app support - Application name.
-
#async_adapter ⇒ Object
:sidekiq, :solid_queue, or :async.
-
#async_logging ⇒ Object
Async logging configuration.
-
#baseline_alert_cooldown_minutes ⇒ Object
Minutes between alerts for same error type (default: 120).
-
#baseline_alert_severities ⇒ Object
Array of severities to alert on (default: [:critical, :high]).
-
#baseline_alert_threshold_std_devs ⇒ Object
Number of std devs to trigger alert (default: 2.0).
-
#custom_severity_rules ⇒ Object
Advanced configuration options Custom severity classification rules (hash of error_type => severity).
-
#dashboard_base_url ⇒ Object
Returns the value of attribute dashboard_base_url.
-
#dashboard_password ⇒ Object
Returns the value of attribute dashboard_password.
-
#dashboard_username ⇒ Object
Dashboard authentication (always required).
-
#database ⇒ Object
Database connection name for shared error dashboard DB.
-
#discord_webhook_url ⇒ Object
Discord notifications.
-
#enable_baseline_alerts ⇒ Object
Baseline alert configuration.
-
#enable_co_occurring_errors ⇒ Object
Detect errors happening together.
-
#enable_discord_notifications ⇒ Object
Returns the value of attribute enable_discord_notifications.
-
#enable_email_notifications ⇒ Object
Returns the value of attribute enable_email_notifications.
-
#enable_error_cascades ⇒ Object
Parent→child error relationships.
-
#enable_error_correlation ⇒ Object
Version/user/time correlation.
-
#enable_error_subscriber ⇒ Object
Enable/disable Rails.error subscriber.
-
#enable_internal_logging ⇒ Object
Internal logging configuration.
-
#enable_middleware ⇒ Object
Enable/disable error catching middleware.
-
#enable_occurrence_patterns ⇒ Object
Cyclical/burst pattern detection.
-
#enable_pagerduty_notifications ⇒ Object
Returns the value of attribute enable_pagerduty_notifications.
-
#enable_platform_comparison ⇒ Object
iOS vs Android analytics.
-
#enable_rate_limiting ⇒ Object
Rate limiting configuration.
-
#enable_similar_errors ⇒ Object
Advanced error analysis features.
-
#enable_slack_notifications ⇒ Object
Returns the value of attribute enable_slack_notifications.
-
#enable_webhook_notifications ⇒ Object
Returns the value of attribute enable_webhook_notifications.
-
#git_repository_url ⇒ Object
Git repository URL for linking commits (e.g., “github.com/user/repo”).
-
#git_sha ⇒ Object
Returns the value of attribute git_sha.
-
#ignored_exceptions ⇒ Object
Exceptions to ignore (array of strings, regexes, or classes).
-
#log_level ⇒ Object
Returns the value of attribute log_level.
-
#max_backtrace_lines ⇒ Object
Backtrace configuration.
-
#notification_callbacks ⇒ Object
readonly
Notification callbacks (managed via helper methods, not set directly).
-
#notification_email_from ⇒ Object
Returns the value of attribute notification_email_from.
-
#notification_email_recipients ⇒ Object
Returns the value of attribute notification_email_recipients.
-
#pagerduty_integration_key ⇒ Object
PagerDuty notifications (critical errors only).
-
#rate_limit_per_minute ⇒ Object
Returns the value of attribute rate_limit_per_minute.
-
#retention_days ⇒ Object
Retention policy (days to keep errors).
-
#sampling_rate ⇒ Object
Sampling rate for non-critical errors (0.0 to 1.0, default 1.0 = 100%).
-
#slack_webhook_url ⇒ Object
Notifications.
-
#total_users_for_impact ⇒ Object
For user impact % calculation.
-
#use_separate_database ⇒ Object
Separate database configuration.
-
#user_model ⇒ Object
User model (for associations).
-
#webhook_urls ⇒ Object
Generic webhook notifications.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
-
#reset! ⇒ Object
Reset configuration to defaults.
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 |
# File 'lib/rails_error_dashboard/configuration.rb', line 98 def initialize # Default values - Authentication is ALWAYS required @dashboard_username = ENV.fetch("ERROR_DASHBOARD_USER", "gandalf") @dashboard_password = ENV.fetch("ERROR_DASHBOARD_PASSWORD", "youshallnotpass") @user_model = "User" # Multi-app support defaults @application_name = ENV["APPLICATION_NAME"] # Auto-detected if not set @database = nil # Use primary database by default # Notification settings (disabled by default - enable during installation or in initializer) @slack_webhook_url = ENV["SLACK_WEBHOOK_URL"] @notification_email_recipients = ENV.fetch("ERROR_NOTIFICATION_EMAILS", "").split(",").map(&:strip) @notification_email_from = ENV.fetch("ERROR_NOTIFICATION_FROM", "errors@example.com") @dashboard_base_url = ENV["DASHBOARD_BASE_URL"] @enable_slack_notifications = false @enable_email_notifications = false # Discord notification settings @discord_webhook_url = ENV["DISCORD_WEBHOOK_URL"] @enable_discord_notifications = false # PagerDuty notification settings (critical errors only) @pagerduty_integration_key = ENV["PAGERDUTY_INTEGRATION_KEY"] @enable_pagerduty_notifications = false # Generic webhook settings (array of URLs) @webhook_urls = ENV.fetch("WEBHOOK_URLS", "").split(",").map(&:strip).reject(&:empty?) @enable_webhook_notifications = false @use_separate_database = ENV.fetch("USE_SEPARATE_ERROR_DB", "false") == "true" @retention_days = 90 @enable_middleware = true @enable_error_subscriber = true # Advanced configuration defaults @custom_severity_rules = {} @ignored_exceptions = [] @sampling_rate = 1.0 # 100% by default @async_logging = false @async_adapter = :sidekiq # Battle-tested default @max_backtrace_lines = 50 # Rate limiting defaults @enable_rate_limiting = false # OFF by default (opt-in) @rate_limit_per_minute = 100 # Requests per minute per IP for API endpoints # Enhanced metrics defaults @app_version = ENV["APP_VERSION"] @git_sha = ENV["GIT_SHA"] @total_users_for_impact = nil # Auto-detect if not set @git_repository_url = ENV["GIT_REPOSITORY_URL"] # Advanced error analysis features (all OFF by default - opt-in) @enable_similar_errors = false # Fuzzy error matching @enable_co_occurring_errors = false # Co-occurring error detection @enable_error_cascades = false # Error cascade detection @enable_error_correlation = false # Version/user/time correlation @enable_platform_comparison = false # Platform health comparison @enable_occurrence_patterns = false # Pattern detection # Baseline alert defaults @enable_baseline_alerts = false # OFF by default (opt-in) @baseline_alert_threshold_std_devs = ENV.fetch("BASELINE_ALERT_THRESHOLD", "2.0").to_f @baseline_alert_severities = [ :critical, :high ] # Alert on critical and high severity anomalies @baseline_alert_cooldown_minutes = ENV.fetch("BASELINE_ALERT_COOLDOWN", "120").to_i # Internal logging defaults - SILENT by default @enable_internal_logging = false # Opt-in for debugging @log_level = :silent # Silent by default, use :debug, :info, :warn, :error, or :silent @notification_callbacks = { error_logged: [], critical_error: [], error_resolved: [] } end |
Instance Attribute Details
#app_version ⇒ Object
Enhanced metrics
70 71 72 |
# File 'lib/rails_error_dashboard/configuration.rb', line 70 def app_version @app_version end |
#application_name ⇒ Object
Multi-app support - Application name
13 14 15 |
# File 'lib/rails_error_dashboard/configuration.rb', line 13 def application_name @application_name end |
#async_adapter ⇒ Object
:sidekiq, :solid_queue, or :async
60 61 62 |
# File 'lib/rails_error_dashboard/configuration.rb', line 60 def async_adapter @async_adapter end |
#async_logging ⇒ Object
Async logging configuration
59 60 61 |
# File 'lib/rails_error_dashboard/configuration.rb', line 59 def async_logging @async_logging end |
#baseline_alert_cooldown_minutes ⇒ Object
Minutes between alerts for same error type (default: 120)
89 90 91 |
# File 'lib/rails_error_dashboard/configuration.rb', line 89 def baseline_alert_cooldown_minutes @baseline_alert_cooldown_minutes end |
#baseline_alert_severities ⇒ Object
Array of severities to alert on (default: [:critical, :high])
88 89 90 |
# File 'lib/rails_error_dashboard/configuration.rb', line 88 def baseline_alert_severities @baseline_alert_severities end |
#baseline_alert_threshold_std_devs ⇒ Object
Number of std devs to trigger alert (default: 2.0)
87 88 89 |
# File 'lib/rails_error_dashboard/configuration.rb', line 87 def baseline_alert_threshold_std_devs @baseline_alert_threshold_std_devs end |
#custom_severity_rules ⇒ Object
Advanced configuration options Custom severity classification rules (hash of error_type => severity)
50 51 52 |
# File 'lib/rails_error_dashboard/configuration.rb', line 50 def custom_severity_rules @custom_severity_rules end |
#dashboard_base_url ⇒ Object
Returns the value of attribute dashboard_base_url.
20 21 22 |
# File 'lib/rails_error_dashboard/configuration.rb', line 20 def dashboard_base_url @dashboard_base_url end |
#dashboard_password ⇒ Object
Returns the value of attribute dashboard_password.
7 8 9 |
# File 'lib/rails_error_dashboard/configuration.rb', line 7 def dashboard_password @dashboard_password end |
#dashboard_username ⇒ Object
Dashboard authentication (always required)
6 7 8 |
# File 'lib/rails_error_dashboard/configuration.rb', line 6 def dashboard_username @dashboard_username end |
#database ⇒ Object
Database connection name for shared error dashboard DB
14 15 16 |
# File 'lib/rails_error_dashboard/configuration.rb', line 14 def database @database end |
#discord_webhook_url ⇒ Object
Discord notifications
25 26 27 |
# File 'lib/rails_error_dashboard/configuration.rb', line 25 def discord_webhook_url @discord_webhook_url end |
#enable_baseline_alerts ⇒ Object
Baseline alert configuration
86 87 88 |
# File 'lib/rails_error_dashboard/configuration.rb', line 86 def enable_baseline_alerts @enable_baseline_alerts end |
#enable_co_occurring_errors ⇒ Object
Detect errors happening together
79 80 81 |
# File 'lib/rails_error_dashboard/configuration.rb', line 79 def enable_co_occurring_errors @enable_co_occurring_errors end |
#enable_discord_notifications ⇒ Object
Returns the value of attribute enable_discord_notifications.
26 27 28 |
# File 'lib/rails_error_dashboard/configuration.rb', line 26 def enable_discord_notifications @enable_discord_notifications end |
#enable_email_notifications ⇒ Object
Returns the value of attribute enable_email_notifications.
22 23 24 |
# File 'lib/rails_error_dashboard/configuration.rb', line 22 def enable_email_notifications @enable_email_notifications end |
#enable_error_cascades ⇒ Object
Parent→child error relationships
80 81 82 |
# File 'lib/rails_error_dashboard/configuration.rb', line 80 def enable_error_cascades @enable_error_cascades end |
#enable_error_correlation ⇒ Object
Version/user/time correlation
81 82 83 |
# File 'lib/rails_error_dashboard/configuration.rb', line 81 def enable_error_correlation @enable_error_correlation end |
#enable_error_subscriber ⇒ Object
Enable/disable Rails.error subscriber
46 47 48 |
# File 'lib/rails_error_dashboard/configuration.rb', line 46 def enable_error_subscriber @enable_error_subscriber end |
#enable_internal_logging ⇒ Object
Internal logging configuration
95 96 97 |
# File 'lib/rails_error_dashboard/configuration.rb', line 95 def enable_internal_logging @enable_internal_logging end |
#enable_middleware ⇒ Object
Enable/disable error catching middleware
43 44 45 |
# File 'lib/rails_error_dashboard/configuration.rb', line 43 def enable_middleware @enable_middleware end |
#enable_occurrence_patterns ⇒ Object
Cyclical/burst pattern detection
83 84 85 |
# File 'lib/rails_error_dashboard/configuration.rb', line 83 def enable_occurrence_patterns @enable_occurrence_patterns end |
#enable_pagerduty_notifications ⇒ Object
Returns the value of attribute enable_pagerduty_notifications.
30 31 32 |
# File 'lib/rails_error_dashboard/configuration.rb', line 30 def enable_pagerduty_notifications @enable_pagerduty_notifications end |
#enable_platform_comparison ⇒ Object
iOS vs Android analytics
82 83 84 |
# File 'lib/rails_error_dashboard/configuration.rb', line 82 def enable_platform_comparison @enable_platform_comparison end |
#enable_rate_limiting ⇒ Object
Rate limiting configuration
66 67 68 |
# File 'lib/rails_error_dashboard/configuration.rb', line 66 def enable_rate_limiting @enable_rate_limiting end |
#enable_similar_errors ⇒ Object
Advanced error analysis features
78 79 80 |
# File 'lib/rails_error_dashboard/configuration.rb', line 78 def enable_similar_errors @enable_similar_errors end |
#enable_slack_notifications ⇒ Object
Returns the value of attribute enable_slack_notifications.
21 22 23 |
# File 'lib/rails_error_dashboard/configuration.rb', line 21 def enable_slack_notifications @enable_slack_notifications end |
#enable_webhook_notifications ⇒ Object
Returns the value of attribute enable_webhook_notifications.
34 35 36 |
# File 'lib/rails_error_dashboard/configuration.rb', line 34 def enable_webhook_notifications @enable_webhook_notifications end |
#git_repository_url ⇒ Object
Git repository URL for linking commits (e.g., “github.com/user/repo”)
75 76 77 |
# File 'lib/rails_error_dashboard/configuration.rb', line 75 def git_repository_url @git_repository_url end |
#git_sha ⇒ Object
Returns the value of attribute git_sha.
71 72 73 |
# File 'lib/rails_error_dashboard/configuration.rb', line 71 def git_sha @git_sha end |
#ignored_exceptions ⇒ Object
Exceptions to ignore (array of strings, regexes, or classes)
53 54 55 |
# File 'lib/rails_error_dashboard/configuration.rb', line 53 def ignored_exceptions @ignored_exceptions end |
#log_level ⇒ Object
Returns the value of attribute log_level.
96 97 98 |
# File 'lib/rails_error_dashboard/configuration.rb', line 96 def log_level @log_level end |
#max_backtrace_lines ⇒ Object
Backtrace configuration
63 64 65 |
# File 'lib/rails_error_dashboard/configuration.rb', line 63 def max_backtrace_lines @max_backtrace_lines end |
#notification_callbacks ⇒ Object (readonly)
Notification callbacks (managed via helper methods, not set directly)
92 93 94 |
# File 'lib/rails_error_dashboard/configuration.rb', line 92 def notification_callbacks @notification_callbacks end |
#notification_email_from ⇒ Object
Returns the value of attribute notification_email_from.
19 20 21 |
# File 'lib/rails_error_dashboard/configuration.rb', line 19 def notification_email_from @notification_email_from end |
#notification_email_recipients ⇒ Object
Returns the value of attribute notification_email_recipients.
18 19 20 |
# File 'lib/rails_error_dashboard/configuration.rb', line 18 def notification_email_recipients @notification_email_recipients end |
#pagerduty_integration_key ⇒ Object
PagerDuty notifications (critical errors only)
29 30 31 |
# File 'lib/rails_error_dashboard/configuration.rb', line 29 def pagerduty_integration_key @pagerduty_integration_key end |
#rate_limit_per_minute ⇒ Object
Returns the value of attribute rate_limit_per_minute.
67 68 69 |
# File 'lib/rails_error_dashboard/configuration.rb', line 67 def rate_limit_per_minute @rate_limit_per_minute end |
#retention_days ⇒ Object
Retention policy (days to keep errors)
40 41 42 |
# File 'lib/rails_error_dashboard/configuration.rb', line 40 def retention_days @retention_days end |
#sampling_rate ⇒ Object
Sampling rate for non-critical errors (0.0 to 1.0, default 1.0 = 100%)
56 57 58 |
# File 'lib/rails_error_dashboard/configuration.rb', line 56 def sampling_rate @sampling_rate end |
#slack_webhook_url ⇒ Object
Notifications
17 18 19 |
# File 'lib/rails_error_dashboard/configuration.rb', line 17 def slack_webhook_url @slack_webhook_url end |
#total_users_for_impact ⇒ Object
For user impact % calculation
72 73 74 |
# File 'lib/rails_error_dashboard/configuration.rb', line 72 def total_users_for_impact @total_users_for_impact end |
#use_separate_database ⇒ Object
Separate database configuration
37 38 39 |
# File 'lib/rails_error_dashboard/configuration.rb', line 37 def use_separate_database @use_separate_database end |
#user_model ⇒ Object
User model (for associations)
10 11 12 |
# File 'lib/rails_error_dashboard/configuration.rb', line 10 def user_model @user_model end |
#webhook_urls ⇒ Object
Generic webhook notifications
33 34 35 |
# File 'lib/rails_error_dashboard/configuration.rb', line 33 def webhook_urls @webhook_urls end |
Instance Method Details
#reset! ⇒ Object
Reset configuration to defaults
180 181 182 |
# File 'lib/rails_error_dashboard/configuration.rb', line 180 def reset! initialize end |