Class: SolidEvents::Configuration
- Inherits:
-
Object
- Object
- SolidEvents::Configuration
- Defined in:
- lib/solid_events/configuration.rb
Constant Summary collapse
- DEFAULT_IGNORE_NAMESPACES =
%w[ solid_events solid_errors solid_queue solid_cache solid_cable active_storage action_text noticed ].freeze
- DEFAULT_IGNORE_MODEL_PREFIXES =
%w[Noticed::].freeze
- DEFAULT_IGNORE_SQL_FRAGMENTS =
%w[schema_migrations ar_internal_metadata].freeze
- CORE_IGNORE_MODELS =
%w[ SolidEvents::Trace SolidEvents::Event SolidEvents::RecordLink SolidEvents::ErrorLink ].freeze
Instance Attribute Summary collapse
-
#allow_controller_prefixes ⇒ Object
Returns the value of attribute allow_controller_prefixes.
-
#allow_job_prefixes ⇒ Object
Returns the value of attribute allow_job_prefixes.
-
#allow_model_prefixes ⇒ Object
Returns the value of attribute allow_model_prefixes.
-
#allow_sql_fragments ⇒ Object
Returns the value of attribute allow_sql_fragments.
-
#allow_sql_tables ⇒ Object
Returns the value of attribute allow_sql_tables.
-
#always_sample_context_keys ⇒ Object
Returns the value of attribute always_sample_context_keys.
-
#always_sample_when ⇒ Object
Returns the value of attribute always_sample_when.
-
#api_token ⇒ Object
Returns the value of attribute api_token.
-
#connects_to ⇒ Object
Returns the value of attribute connects_to.
-
#deployment_id ⇒ Object
Returns the value of attribute deployment_id.
-
#emit_canonical_log_line ⇒ Object
Returns the value of attribute emit_canonical_log_line.
-
#environment_name ⇒ Object
Returns the value of attribute environment_name.
-
#error_retention_period ⇒ Object
Returns the value of attribute error_retention_period.
-
#evaluate_incidents_on_request ⇒ Object
Returns the value of attribute evaluate_incidents_on_request.
-
#feature_slice_keys ⇒ Object
Returns the value of attribute feature_slice_keys.
-
#ignore_controller_prefixes ⇒ Object
Returns the value of attribute ignore_controller_prefixes.
-
#ignore_job_prefixes ⇒ Object
Returns the value of attribute ignore_job_prefixes.
-
#ignore_model_prefixes ⇒ Object
Returns the value of attribute ignore_model_prefixes.
-
#ignore_models ⇒ Object
Returns the value of attribute ignore_models.
-
#ignore_namespaces ⇒ Object
Returns the value of attribute ignore_namespaces.
-
#ignore_paths ⇒ Object
Returns the value of attribute ignore_paths.
-
#ignore_sql_fragments ⇒ Object
Returns the value of attribute ignore_sql_fragments.
-
#ignore_sql_tables ⇒ Object
Returns the value of attribute ignore_sql_tables.
-
#incident_dedupe_window ⇒ Object
Returns the value of attribute incident_dedupe_window.
-
#incident_error_spike_threshold_pct ⇒ Object
Returns the value of attribute incident_error_spike_threshold_pct.
-
#incident_min_samples ⇒ Object
Returns the value of attribute incident_min_samples.
-
#incident_multi_signal_error_rate_pct ⇒ Object
Returns the value of attribute incident_multi_signal_error_rate_pct.
-
#incident_multi_signal_p95_factor ⇒ Object
Returns the value of attribute incident_multi_signal_p95_factor.
-
#incident_multi_signal_sql_duration_ms ⇒ Object
Returns the value of attribute incident_multi_signal_sql_duration_ms.
-
#incident_notifier ⇒ Object
Returns the value of attribute incident_notifier.
-
#incident_p95_regression_factor ⇒ Object
Returns the value of attribute incident_p95_regression_factor.
-
#incident_retention_period ⇒ Object
Returns the value of attribute incident_retention_period.
-
#incident_slo_burn_rate_threshold ⇒ Object
Returns the value of attribute incident_slo_burn_rate_threshold.
-
#incident_slo_target_error_rate_pct ⇒ Object
Returns the value of attribute incident_slo_target_error_rate_pct.
-
#incident_suppression_rules ⇒ Object
Returns the value of attribute incident_suppression_rules.
-
#max_context_payload_bytes ⇒ Object
Returns the value of attribute max_context_payload_bytes.
-
#max_event_payload_bytes ⇒ Object
Returns the value of attribute max_event_payload_bytes.
-
#payload_truncation_placeholder ⇒ Object
Returns the value of attribute payload_truncation_placeholder.
-
#persist_sub_events ⇒ Object
Returns the value of attribute persist_sub_events.
-
#redaction_paths ⇒ Object
Returns the value of attribute redaction_paths.
-
#redaction_placeholder ⇒ Object
Returns the value of attribute redaction_placeholder.
-
#region ⇒ Object
Returns the value of attribute region.
-
#retention_period ⇒ Object
Returns the value of attribute retention_period.
-
#sample_rate ⇒ Object
Returns the value of attribute sample_rate.
-
#sensitive_keys ⇒ Object
Returns the value of attribute sensitive_keys.
-
#service_name ⇒ Object
Returns the value of attribute service_name.
-
#service_version ⇒ Object
Returns the value of attribute service_version.
-
#state_diff_allowlist ⇒ Object
Returns the value of attribute state_diff_allowlist.
-
#state_diff_blocklist ⇒ Object
Returns the value of attribute state_diff_blocklist.
-
#state_diff_max_changed_fields ⇒ Object
Returns the value of attribute state_diff_max_changed_fields.
-
#tail_sample_slow_ms ⇒ Object
Returns the value of attribute tail_sample_slow_ms.
-
#wide_event_primary ⇒ Object
Returns the value of attribute wide_event_primary.
Instance Method Summary collapse
- #effective_ignore_controller_prefixes ⇒ Object
- #effective_ignore_job_prefixes ⇒ Object
- #effective_ignore_model_prefixes ⇒ Object
- #effective_ignore_sql_fragments ⇒ Object
- #effective_ignore_sql_tables(present_tables = []) ⇒ Object
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
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 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
# File 'lib/solid_events/configuration.rb', line 48 def initialize @connects_to = nil @ignore_models = CORE_IGNORE_MODELS.dup @ignore_paths = %w[/up /health /assets /rails/active_storage] @ignore_namespaces = DEFAULT_IGNORE_NAMESPACES.dup @ignore_model_prefixes = [] @ignore_sql_fragments = [] @ignore_sql_tables = [] @ignore_job_prefixes = [] @ignore_controller_prefixes = [] @allow_model_prefixes = [] @allow_sql_fragments = [] @allow_sql_tables = [] @allow_job_prefixes = [] @allow_controller_prefixes = [] @sample_rate = 1.0 @tail_sample_slow_ms = 2000.0 @always_sample_context_keys = [] @always_sample_when = nil @emit_canonical_log_line = true @service_name = detect_service_name @service_version = ENV["APP_VERSION"] @deployment_id = ENV["DEPLOYMENT_ID"] @environment_name = ENV["RAILS_ENV"] || ENV["RACK_ENV"] || "development" @region = ENV["APP_REGION"] @sensitive_keys = %w[ password password_confirmation secret token access_token refresh_token authorization cookie session csrf authenticity_token api_key private_key encrypted encrypted_password credit_card card_number cvv ssn otp ] @redaction_paths = {} @redaction_placeholder = "[REDACTED]" @max_context_payload_bytes = 16_384 @max_event_payload_bytes = 8_192 @payload_truncation_placeholder = "[TRUNCATED]" @wide_event_primary = false @persist_sub_events = true @incident_error_spike_threshold_pct = 20.0 @incident_p95_regression_factor = 1.5 @incident_min_samples = 20 @incident_dedupe_window = 1.hour @incident_slo_target_error_rate_pct = 1.0 @incident_slo_burn_rate_threshold = 2.0 @incident_multi_signal_error_rate_pct = 10.0 @incident_multi_signal_p95_factor = 1.4 @incident_multi_signal_sql_duration_ms = 200.0 @incident_suppression_rules = [] @incident_notifier = nil @api_token = ENV["SOLID_EVENTS_API_TOKEN"] @evaluate_incidents_on_request = true @feature_slice_keys = %w[feature_flag experiment release_channel plan] @state_diff_allowlist = [] @state_diff_blocklist = [] @state_diff_max_changed_fields = 20 @retention_period = 30.days @error_retention_period = 90.days @incident_retention_period = 180.days end |
Instance Attribute Details
#allow_controller_prefixes ⇒ Object
Returns the value of attribute allow_controller_prefixes.
25 26 27 |
# File 'lib/solid_events/configuration.rb', line 25 def allow_controller_prefixes @allow_controller_prefixes end |
#allow_job_prefixes ⇒ Object
Returns the value of attribute allow_job_prefixes.
25 26 27 |
# File 'lib/solid_events/configuration.rb', line 25 def allow_job_prefixes @allow_job_prefixes end |
#allow_model_prefixes ⇒ Object
Returns the value of attribute allow_model_prefixes.
25 26 27 |
# File 'lib/solid_events/configuration.rb', line 25 def allow_model_prefixes @allow_model_prefixes end |
#allow_sql_fragments ⇒ Object
Returns the value of attribute allow_sql_fragments.
25 26 27 |
# File 'lib/solid_events/configuration.rb', line 25 def allow_sql_fragments @allow_sql_fragments end |
#allow_sql_tables ⇒ Object
Returns the value of attribute allow_sql_tables.
25 26 27 |
# File 'lib/solid_events/configuration.rb', line 25 def allow_sql_tables @allow_sql_tables end |
#always_sample_context_keys ⇒ Object
Returns the value of attribute always_sample_context_keys.
25 26 27 |
# File 'lib/solid_events/configuration.rb', line 25 def always_sample_context_keys @always_sample_context_keys end |
#always_sample_when ⇒ Object
Returns the value of attribute always_sample_when.
25 26 27 |
# File 'lib/solid_events/configuration.rb', line 25 def always_sample_when @always_sample_when end |
#api_token ⇒ Object
Returns the value of attribute api_token.
25 26 27 |
# File 'lib/solid_events/configuration.rb', line 25 def api_token @api_token end |
#connects_to ⇒ Object
Returns the value of attribute connects_to.
25 26 27 |
# File 'lib/solid_events/configuration.rb', line 25 def connects_to @connects_to end |
#deployment_id ⇒ Object
Returns the value of attribute deployment_id.
25 26 27 |
# File 'lib/solid_events/configuration.rb', line 25 def deployment_id @deployment_id end |
#emit_canonical_log_line ⇒ Object
Returns the value of attribute emit_canonical_log_line.
25 26 27 |
# File 'lib/solid_events/configuration.rb', line 25 def emit_canonical_log_line @emit_canonical_log_line end |
#environment_name ⇒ Object
Returns the value of attribute environment_name.
25 26 27 |
# File 'lib/solid_events/configuration.rb', line 25 def environment_name @environment_name end |
#error_retention_period ⇒ Object
Returns the value of attribute error_retention_period.
25 26 27 |
# File 'lib/solid_events/configuration.rb', line 25 def error_retention_period @error_retention_period end |
#evaluate_incidents_on_request ⇒ Object
Returns the value of attribute evaluate_incidents_on_request.
25 26 27 |
# File 'lib/solid_events/configuration.rb', line 25 def evaluate_incidents_on_request @evaluate_incidents_on_request end |
#feature_slice_keys ⇒ Object
Returns the value of attribute feature_slice_keys.
25 26 27 |
# File 'lib/solid_events/configuration.rb', line 25 def feature_slice_keys @feature_slice_keys end |
#ignore_controller_prefixes ⇒ Object
Returns the value of attribute ignore_controller_prefixes.
25 26 27 |
# File 'lib/solid_events/configuration.rb', line 25 def ignore_controller_prefixes @ignore_controller_prefixes end |
#ignore_job_prefixes ⇒ Object
Returns the value of attribute ignore_job_prefixes.
25 26 27 |
# File 'lib/solid_events/configuration.rb', line 25 def ignore_job_prefixes @ignore_job_prefixes end |
#ignore_model_prefixes ⇒ Object
Returns the value of attribute ignore_model_prefixes.
25 26 27 |
# File 'lib/solid_events/configuration.rb', line 25 def ignore_model_prefixes @ignore_model_prefixes end |
#ignore_models ⇒ Object
Returns the value of attribute ignore_models.
46 47 48 |
# File 'lib/solid_events/configuration.rb', line 46 def ignore_models @ignore_models end |
#ignore_namespaces ⇒ Object
Returns the value of attribute ignore_namespaces.
25 26 27 |
# File 'lib/solid_events/configuration.rb', line 25 def ignore_namespaces @ignore_namespaces end |
#ignore_paths ⇒ Object
Returns the value of attribute ignore_paths.
25 26 27 |
# File 'lib/solid_events/configuration.rb', line 25 def ignore_paths @ignore_paths end |
#ignore_sql_fragments ⇒ Object
Returns the value of attribute ignore_sql_fragments.
25 26 27 |
# File 'lib/solid_events/configuration.rb', line 25 def ignore_sql_fragments @ignore_sql_fragments end |
#ignore_sql_tables ⇒ Object
Returns the value of attribute ignore_sql_tables.
25 26 27 |
# File 'lib/solid_events/configuration.rb', line 25 def ignore_sql_tables @ignore_sql_tables end |
#incident_dedupe_window ⇒ Object
Returns the value of attribute incident_dedupe_window.
25 26 27 |
# File 'lib/solid_events/configuration.rb', line 25 def incident_dedupe_window @incident_dedupe_window end |
#incident_error_spike_threshold_pct ⇒ Object
Returns the value of attribute incident_error_spike_threshold_pct.
25 26 27 |
# File 'lib/solid_events/configuration.rb', line 25 def incident_error_spike_threshold_pct @incident_error_spike_threshold_pct end |
#incident_min_samples ⇒ Object
Returns the value of attribute incident_min_samples.
25 26 27 |
# File 'lib/solid_events/configuration.rb', line 25 def incident_min_samples @incident_min_samples end |
#incident_multi_signal_error_rate_pct ⇒ Object
Returns the value of attribute incident_multi_signal_error_rate_pct.
25 26 27 |
# File 'lib/solid_events/configuration.rb', line 25 def incident_multi_signal_error_rate_pct @incident_multi_signal_error_rate_pct end |
#incident_multi_signal_p95_factor ⇒ Object
Returns the value of attribute incident_multi_signal_p95_factor.
25 26 27 |
# File 'lib/solid_events/configuration.rb', line 25 def incident_multi_signal_p95_factor @incident_multi_signal_p95_factor end |
#incident_multi_signal_sql_duration_ms ⇒ Object
Returns the value of attribute incident_multi_signal_sql_duration_ms.
25 26 27 |
# File 'lib/solid_events/configuration.rb', line 25 def incident_multi_signal_sql_duration_ms @incident_multi_signal_sql_duration_ms end |
#incident_notifier ⇒ Object
Returns the value of attribute incident_notifier.
25 26 27 |
# File 'lib/solid_events/configuration.rb', line 25 def incident_notifier @incident_notifier end |
#incident_p95_regression_factor ⇒ Object
Returns the value of attribute incident_p95_regression_factor.
25 26 27 |
# File 'lib/solid_events/configuration.rb', line 25 def incident_p95_regression_factor @incident_p95_regression_factor end |
#incident_retention_period ⇒ Object
Returns the value of attribute incident_retention_period.
25 26 27 |
# File 'lib/solid_events/configuration.rb', line 25 def incident_retention_period @incident_retention_period end |
#incident_slo_burn_rate_threshold ⇒ Object
Returns the value of attribute incident_slo_burn_rate_threshold.
25 26 27 |
# File 'lib/solid_events/configuration.rb', line 25 def incident_slo_burn_rate_threshold @incident_slo_burn_rate_threshold end |
#incident_slo_target_error_rate_pct ⇒ Object
Returns the value of attribute incident_slo_target_error_rate_pct.
25 26 27 |
# File 'lib/solid_events/configuration.rb', line 25 def incident_slo_target_error_rate_pct @incident_slo_target_error_rate_pct end |
#incident_suppression_rules ⇒ Object
Returns the value of attribute incident_suppression_rules.
25 26 27 |
# File 'lib/solid_events/configuration.rb', line 25 def incident_suppression_rules @incident_suppression_rules end |
#max_context_payload_bytes ⇒ Object
Returns the value of attribute max_context_payload_bytes.
25 26 27 |
# File 'lib/solid_events/configuration.rb', line 25 def max_context_payload_bytes @max_context_payload_bytes end |
#max_event_payload_bytes ⇒ Object
Returns the value of attribute max_event_payload_bytes.
25 26 27 |
# File 'lib/solid_events/configuration.rb', line 25 def max_event_payload_bytes @max_event_payload_bytes end |
#payload_truncation_placeholder ⇒ Object
Returns the value of attribute payload_truncation_placeholder.
25 26 27 |
# File 'lib/solid_events/configuration.rb', line 25 def payload_truncation_placeholder @payload_truncation_placeholder end |
#persist_sub_events ⇒ Object
Returns the value of attribute persist_sub_events.
25 26 27 |
# File 'lib/solid_events/configuration.rb', line 25 def persist_sub_events @persist_sub_events end |
#redaction_paths ⇒ Object
Returns the value of attribute redaction_paths.
25 26 27 |
# File 'lib/solid_events/configuration.rb', line 25 def redaction_paths @redaction_paths end |
#redaction_placeholder ⇒ Object
Returns the value of attribute redaction_placeholder.
25 26 27 |
# File 'lib/solid_events/configuration.rb', line 25 def redaction_placeholder @redaction_placeholder end |
#region ⇒ Object
Returns the value of attribute region.
25 26 27 |
# File 'lib/solid_events/configuration.rb', line 25 def region @region end |
#retention_period ⇒ Object
Returns the value of attribute retention_period.
25 26 27 |
# File 'lib/solid_events/configuration.rb', line 25 def retention_period @retention_period end |
#sample_rate ⇒ Object
Returns the value of attribute sample_rate.
25 26 27 |
# File 'lib/solid_events/configuration.rb', line 25 def sample_rate @sample_rate end |
#sensitive_keys ⇒ Object
Returns the value of attribute sensitive_keys.
25 26 27 |
# File 'lib/solid_events/configuration.rb', line 25 def sensitive_keys @sensitive_keys end |
#service_name ⇒ Object
Returns the value of attribute service_name.
25 26 27 |
# File 'lib/solid_events/configuration.rb', line 25 def service_name @service_name end |
#service_version ⇒ Object
Returns the value of attribute service_version.
25 26 27 |
# File 'lib/solid_events/configuration.rb', line 25 def service_version @service_version end |
#state_diff_allowlist ⇒ Object
Returns the value of attribute state_diff_allowlist.
25 26 27 |
# File 'lib/solid_events/configuration.rb', line 25 def state_diff_allowlist @state_diff_allowlist end |
#state_diff_blocklist ⇒ Object
Returns the value of attribute state_diff_blocklist.
25 26 27 |
# File 'lib/solid_events/configuration.rb', line 25 def state_diff_blocklist @state_diff_blocklist end |
#state_diff_max_changed_fields ⇒ Object
Returns the value of attribute state_diff_max_changed_fields.
25 26 27 |
# File 'lib/solid_events/configuration.rb', line 25 def state_diff_max_changed_fields @state_diff_max_changed_fields end |
#tail_sample_slow_ms ⇒ Object
Returns the value of attribute tail_sample_slow_ms.
25 26 27 |
# File 'lib/solid_events/configuration.rb', line 25 def tail_sample_slow_ms @tail_sample_slow_ms end |
#wide_event_primary ⇒ Object
Returns the value of attribute wide_event_primary.
25 26 27 |
# File 'lib/solid_events/configuration.rb', line 25 def wide_event_primary @wide_event_primary end |
Instance Method Details
#effective_ignore_controller_prefixes ⇒ Object
138 139 140 141 |
# File 'lib/solid_events/configuration.rb', line 138 def effective_ignore_controller_prefixes defaults = namespace_model_prefixes ((defaults + Array(@ignore_controller_prefixes).map(&:to_s)) - Array(@allow_controller_prefixes).map(&:to_s)).uniq end |
#effective_ignore_job_prefixes ⇒ Object
133 134 135 136 |
# File 'lib/solid_events/configuration.rb', line 133 def effective_ignore_job_prefixes defaults = namespace_job_prefixes ((defaults + Array(@ignore_job_prefixes).map(&:to_s)) - Array(@allow_job_prefixes).map(&:to_s)).uniq end |
#effective_ignore_model_prefixes ⇒ Object
112 113 114 115 |
# File 'lib/solid_events/configuration.rb', line 112 def effective_ignore_model_prefixes defaults = namespace_model_prefixes + DEFAULT_IGNORE_MODEL_PREFIXES ((defaults + Array(@ignore_model_prefixes).map(&:to_s)) - Array(@allow_model_prefixes).map(&:to_s)).uniq end |
#effective_ignore_sql_fragments ⇒ Object
117 118 119 120 |
# File 'lib/solid_events/configuration.rb', line 117 def effective_ignore_sql_fragments defaults = namespace_sql_fragments + DEFAULT_IGNORE_SQL_FRAGMENTS ((defaults + Array(@ignore_sql_fragments).map(&:to_s)) - Array(@allow_sql_fragments).map(&:to_s)).uniq end |
#effective_ignore_sql_tables(present_tables = []) ⇒ Object
122 123 124 125 126 127 128 129 130 131 |
# File 'lib/solid_events/configuration.rb', line 122 def effective_ignore_sql_tables(present_tables = []) namespace_prefixes = namespace_sql_fragments default_from_present = Array(present_tables).map(&:to_s).select do |table| namespace_prefixes.any? { |prefix| table.start_with?(prefix) } end explicit = Array(@ignore_sql_tables).map(&:to_s) allows = Array(@allow_sql_tables).map(&:to_s) ((default_from_present + explicit) - allows).uniq end |