Class: Lapsoss::Configuration
- Inherits:
-
Object
- Object
- Lapsoss::Configuration
- Includes:
- Validators
- Defined in:
- lib/lapsoss/configuration.rb
Instance Attribute Summary collapse
-
#adapter_configs ⇒ Object
readonly
Returns the value of attribute adapter_configs.
-
#async ⇒ Object
Returns the value of attribute async.
-
#backtrace_context_lines ⇒ Object
Returns the value of attribute backtrace_context_lines.
-
#backtrace_enable_code_context ⇒ Object
Returns the value of attribute backtrace_enable_code_context.
-
#backtrace_exclude_patterns ⇒ Object
Returns the value of attribute backtrace_exclude_patterns.
-
#backtrace_in_app_patterns ⇒ Object
Returns the value of attribute backtrace_in_app_patterns.
-
#backtrace_max_frames ⇒ Object
Returns the value of attribute backtrace_max_frames.
-
#backtrace_strip_load_path ⇒ Object
Returns the value of attribute backtrace_strip_load_path.
-
#before_send ⇒ Object
Returns the value of attribute before_send.
-
#capture_rails_events ⇒ Object
Returns the value of attribute capture_rails_events.
-
#capture_request_context ⇒ Object
Returns the value of attribute capture_request_context.
-
#debug ⇒ Object
Returns the value of attribute debug.
-
#default_context ⇒ Object
readonly
Returns the value of attribute default_context.
-
#enable_pipeline ⇒ Object
Returns the value of attribute enable_pipeline.
-
#enabled ⇒ Object
Returns the value of attribute enabled.
-
#environment ⇒ Object
Returns the value of attribute environment.
-
#error_handler ⇒ Object
Returns the value of attribute error_handler.
-
#exclusion_filter ⇒ Object
Returns the value of attribute exclusion_filter.
-
#fingerprint_callback ⇒ Object
Returns the value of attribute fingerprint_callback.
-
#fingerprint_include_environment ⇒ Object
Returns the value of attribute fingerprint_include_environment.
-
#fingerprint_patterns ⇒ Object
Returns the value of attribute fingerprint_patterns.
-
#force_sync_http ⇒ Object
Returns the value of attribute force_sync_http.
-
#logger ⇒ Object
Returns the value of attribute logger.
-
#normalize_fingerprint_ids ⇒ Object
Returns the value of attribute normalize_fingerprint_ids.
-
#normalize_fingerprint_paths ⇒ Object
Returns the value of attribute normalize_fingerprint_paths.
-
#pipeline_builder ⇒ Object
Returns the value of attribute pipeline_builder.
-
#rails_event_filter ⇒ Object
Returns the value of attribute rails_event_filter.
-
#randomize_scrub_length ⇒ Object
Returns the value of attribute randomize_scrub_length.
-
#release ⇒ Object
Returns the value of attribute release.
-
#sample_rate ⇒ Object
Returns the value of attribute sample_rate.
-
#sampling_strategy ⇒ Object
Returns the value of attribute sampling_strategy.
-
#scrub_all ⇒ Object
Returns the value of attribute scrub_all.
-
#scrub_fields ⇒ Object
Returns the value of attribute scrub_fields.
-
#skip_rails_cache_errors ⇒ Object
Returns the value of attribute skip_rails_cache_errors.
-
#transport_backoff_multiplier ⇒ Object
Returns the value of attribute transport_backoff_multiplier.
-
#transport_initial_backoff ⇒ Object
Returns the value of attribute transport_initial_backoff.
-
#transport_jitter ⇒ Object
Returns the value of attribute transport_jitter.
-
#transport_max_backoff ⇒ Object
Returns the value of attribute transport_max_backoff.
-
#transport_max_retries ⇒ Object
Returns the value of attribute transport_max_retries.
-
#transport_ssl_verify ⇒ Object
Returns the value of attribute transport_ssl_verify.
-
#transport_timeout ⇒ Object
Returns the value of attribute transport_timeout.
-
#whitelist_fields ⇒ Object
Returns the value of attribute whitelist_fields.
Instance Method Summary collapse
-
#adapter_names ⇒ Object
Get configured adapter names.
-
#adapters_configured? ⇒ Boolean
Check if any adapters are configured.
-
#apply! ⇒ Object
Apply configuration by registering all adapters.
- #async? ⇒ Boolean
- #clear! ⇒ Object
-
#configure_pipeline {|@pipeline_builder| ... } ⇒ Object
Pipeline configuration.
-
#configure_sampling(strategy = nil, &block) ⇒ Object
Sampling configuration.
- #create_sampling_strategy ⇒ Object
- #debug? ⇒ Boolean
- #default_extra ⇒ Object
-
#default_extra=(extra) ⇒ Object
Default extra context setter/getter.
- #default_tags ⇒ Object
-
#default_tags=(tags) ⇒ Object
Default tags setter/getter.
- #default_user ⇒ Object
-
#default_user=(user) ⇒ Object
Default user setter/getter.
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #pipeline ⇒ Object
- #pipeline=(value) ⇒ Object
-
#register_adapter(name, type, **settings) ⇒ Object
Register a named adapter configuration.
-
#use_appsignal(name: :appsignal, **settings) ⇒ Object
Convenience method for AppSignal.
-
#use_bugsnag(name: :bugsnag, **settings) ⇒ Object
Backwards compatibility for Bugsnag.
-
#use_insight_hub(name: :insight_hub, **settings) ⇒ Object
Convenience method for Insight Hub.
-
#use_jaeger(name: :jaeger, **settings) ⇒ Object
Convenience method for Jaeger (OTLP-compatible).
-
#use_logger(name: :logger, **settings) ⇒ Object
Convenience method for Logger.
-
#use_openobserve(name: :openobserve, **settings) ⇒ Object
Convenience method for OpenObserve.
-
#use_otlp(name: :otlp, **settings) ⇒ Object
Convenience method for OTLP (OpenTelemetry Protocol) Works with SigNoz, Jaeger, Tempo, Honeycomb, etc.
-
#use_rollbar(name: :rollbar, **settings) ⇒ Object
Convenience method for Rollbar.
-
#use_sentry(name: :sentry, **settings) ⇒ Object
Convenience method for Sentry.
-
#use_signoz(name: :signoz, **settings) ⇒ Object
Convenience method for SigNoz (OTLP-compatible).
-
#use_telebugs(name: :telebugs, **settings) ⇒ Object
Convenience method for Telebugs (Sentry-compatible).
-
#use_tempo(name: :tempo, **settings) ⇒ Object
Convenience method for Grafana Tempo (OTLP-compatible).
-
#validate! ⇒ Object
Configuration validation - just log warnings, don't fail.
Methods included from Validators
logger, validate_api_key!, validate_callable!, validate_dsn!, validate_environment!, validate_presence!, validate_retries!, validate_sample_rate!, validate_timeout!, validate_url!
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 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 |
# File 'lib/lapsoss/configuration.rb', line 21 def initialize @adapter_configs = {} @async = true @logger = Logger.new(nil) # Default null logger @environment = nil @enabled = true @release = nil @debug = false @before_send = nil @sample_rate = 1.0 @default_context = {} @error_handler = nil @scrub_fields = nil # Will use defaults from Scrubber @scrub_all = false @whitelist_fields = [] @randomize_scrub_length = false # Transport reliability settings @transport_timeout = 5 @transport_max_retries = 3 @transport_initial_backoff = 1.0 @transport_max_backoff = 64.0 @transport_backoff_multiplier = 2.0 @transport_jitter = true @transport_ssl_verify = true # Fingerprinting settings @fingerprint_callback = nil @fingerprint_patterns = nil # Will use defaults from Fingerprinter @normalize_fingerprint_paths = true @normalize_fingerprint_ids = true @fingerprint_include_environment = false # Backtrace processing settings @backtrace_context_lines = 3 @backtrace_in_app_patterns = [] @backtrace_exclude_patterns = [] @backtrace_strip_load_path = true @backtrace_max_frames = 100 @backtrace_enable_code_context = true # Pipeline settings @enable_pipeline = true @pipeline_builder = nil @pipeline = nil @sampling_strategy = nil # Rails error filtering @skip_rails_cache_errors = true # Rails.event structured events as breadcrumbs (Rails 8.1+) @capture_rails_events = true @rails_event_filter = nil # HTTP client settings @force_sync_http = false # Capture request context in middleware @capture_request_context = true # Exclusion filter @exclusion_filter = nil end |
Instance Attribute Details
#adapter_configs ⇒ Object (readonly)
Returns the value of attribute adapter_configs.
18 19 20 |
# File 'lib/lapsoss/configuration.rb', line 18 def adapter_configs @adapter_configs end |
#async ⇒ Object
Returns the value of attribute async.
9 10 11 |
# File 'lib/lapsoss/configuration.rb', line 9 def async @async end |
#backtrace_context_lines ⇒ Object
Returns the value of attribute backtrace_context_lines.
9 10 11 |
# File 'lib/lapsoss/configuration.rb', line 9 def backtrace_context_lines @backtrace_context_lines end |
#backtrace_enable_code_context ⇒ Object
Returns the value of attribute backtrace_enable_code_context.
9 10 11 |
# File 'lib/lapsoss/configuration.rb', line 9 def backtrace_enable_code_context @backtrace_enable_code_context end |
#backtrace_exclude_patterns ⇒ Object
Returns the value of attribute backtrace_exclude_patterns.
9 10 11 |
# File 'lib/lapsoss/configuration.rb', line 9 def backtrace_exclude_patterns @backtrace_exclude_patterns end |
#backtrace_in_app_patterns ⇒ Object
Returns the value of attribute backtrace_in_app_patterns.
9 10 11 |
# File 'lib/lapsoss/configuration.rb', line 9 def backtrace_in_app_patterns @backtrace_in_app_patterns end |
#backtrace_max_frames ⇒ Object
Returns the value of attribute backtrace_max_frames.
9 10 11 |
# File 'lib/lapsoss/configuration.rb', line 9 def backtrace_max_frames @backtrace_max_frames end |
#backtrace_strip_load_path ⇒ Object
Returns the value of attribute backtrace_strip_load_path.
9 10 11 |
# File 'lib/lapsoss/configuration.rb', line 9 def backtrace_strip_load_path @backtrace_strip_load_path end |
#before_send ⇒ Object
Returns the value of attribute before_send.
18 19 20 |
# File 'lib/lapsoss/configuration.rb', line 18 def before_send @before_send end |
#capture_rails_events ⇒ Object
Returns the value of attribute capture_rails_events.
9 10 11 |
# File 'lib/lapsoss/configuration.rb', line 9 def capture_rails_events @capture_rails_events end |
#capture_request_context ⇒ Object
Returns the value of attribute capture_request_context.
9 10 11 |
# File 'lib/lapsoss/configuration.rb', line 9 def capture_request_context @capture_request_context end |
#debug ⇒ Object
Returns the value of attribute debug.
9 10 11 |
# File 'lib/lapsoss/configuration.rb', line 9 def debug @debug end |
#default_context ⇒ Object (readonly)
Returns the value of attribute default_context.
18 19 20 |
# File 'lib/lapsoss/configuration.rb', line 18 def default_context @default_context end |
#enable_pipeline ⇒ Object
Returns the value of attribute enable_pipeline.
9 10 11 |
# File 'lib/lapsoss/configuration.rb', line 9 def enable_pipeline @enable_pipeline end |
#enabled ⇒ Object
Returns the value of attribute enabled.
9 10 11 |
# File 'lib/lapsoss/configuration.rb', line 9 def enabled @enabled end |
#environment ⇒ Object
Returns the value of attribute environment.
18 19 20 |
# File 'lib/lapsoss/configuration.rb', line 18 def environment @environment end |
#error_handler ⇒ Object
Returns the value of attribute error_handler.
18 19 20 |
# File 'lib/lapsoss/configuration.rb', line 18 def error_handler @error_handler end |
#exclusion_filter ⇒ Object
Returns the value of attribute exclusion_filter.
9 10 11 |
# File 'lib/lapsoss/configuration.rb', line 9 def exclusion_filter @exclusion_filter end |
#fingerprint_callback ⇒ Object
Returns the value of attribute fingerprint_callback.
18 19 20 |
# File 'lib/lapsoss/configuration.rb', line 18 def fingerprint_callback @fingerprint_callback end |
#fingerprint_include_environment ⇒ Object
Returns the value of attribute fingerprint_include_environment.
9 10 11 |
# File 'lib/lapsoss/configuration.rb', line 9 def fingerprint_include_environment @fingerprint_include_environment end |
#fingerprint_patterns ⇒ Object
Returns the value of attribute fingerprint_patterns.
9 10 11 |
# File 'lib/lapsoss/configuration.rb', line 9 def fingerprint_patterns @fingerprint_patterns end |
#force_sync_http ⇒ Object
Returns the value of attribute force_sync_http.
9 10 11 |
# File 'lib/lapsoss/configuration.rb', line 9 def force_sync_http @force_sync_http end |
#logger ⇒ Object
Returns the value of attribute logger.
9 10 11 |
# File 'lib/lapsoss/configuration.rb', line 9 def logger @logger end |
#normalize_fingerprint_ids ⇒ Object
Returns the value of attribute normalize_fingerprint_ids.
9 10 11 |
# File 'lib/lapsoss/configuration.rb', line 9 def normalize_fingerprint_ids @normalize_fingerprint_ids end |
#normalize_fingerprint_paths ⇒ Object
Returns the value of attribute normalize_fingerprint_paths.
9 10 11 |
# File 'lib/lapsoss/configuration.rb', line 9 def normalize_fingerprint_paths @normalize_fingerprint_paths end |
#pipeline_builder ⇒ Object
Returns the value of attribute pipeline_builder.
9 10 11 |
# File 'lib/lapsoss/configuration.rb', line 9 def pipeline_builder @pipeline_builder end |
#rails_event_filter ⇒ Object
Returns the value of attribute rails_event_filter.
9 10 11 |
# File 'lib/lapsoss/configuration.rb', line 9 def rails_event_filter @rails_event_filter end |
#randomize_scrub_length ⇒ Object
Returns the value of attribute randomize_scrub_length.
9 10 11 |
# File 'lib/lapsoss/configuration.rb', line 9 def randomize_scrub_length @randomize_scrub_length end |
#release ⇒ Object
Returns the value of attribute release.
9 10 11 |
# File 'lib/lapsoss/configuration.rb', line 9 def release @release end |
#sample_rate ⇒ Object
Returns the value of attribute sample_rate.
18 19 20 |
# File 'lib/lapsoss/configuration.rb', line 18 def sample_rate @sample_rate end |
#sampling_strategy ⇒ Object
Returns the value of attribute sampling_strategy.
9 10 11 |
# File 'lib/lapsoss/configuration.rb', line 9 def sampling_strategy @sampling_strategy end |
#scrub_all ⇒ Object
Returns the value of attribute scrub_all.
9 10 11 |
# File 'lib/lapsoss/configuration.rb', line 9 def scrub_all @scrub_all end |
#scrub_fields ⇒ Object
Returns the value of attribute scrub_fields.
9 10 11 |
# File 'lib/lapsoss/configuration.rb', line 9 def scrub_fields @scrub_fields end |
#skip_rails_cache_errors ⇒ Object
Returns the value of attribute skip_rails_cache_errors.
9 10 11 |
# File 'lib/lapsoss/configuration.rb', line 9 def skip_rails_cache_errors @skip_rails_cache_errors end |
#transport_backoff_multiplier ⇒ Object
Returns the value of attribute transport_backoff_multiplier.
18 19 20 |
# File 'lib/lapsoss/configuration.rb', line 18 def transport_backoff_multiplier @transport_backoff_multiplier end |
#transport_initial_backoff ⇒ Object
Returns the value of attribute transport_initial_backoff.
18 19 20 |
# File 'lib/lapsoss/configuration.rb', line 18 def transport_initial_backoff @transport_initial_backoff end |
#transport_jitter ⇒ Object
Returns the value of attribute transport_jitter.
9 10 11 |
# File 'lib/lapsoss/configuration.rb', line 9 def transport_jitter @transport_jitter end |
#transport_max_backoff ⇒ Object
Returns the value of attribute transport_max_backoff.
18 19 20 |
# File 'lib/lapsoss/configuration.rb', line 18 def transport_max_backoff @transport_max_backoff end |
#transport_max_retries ⇒ Object
Returns the value of attribute transport_max_retries.
18 19 20 |
# File 'lib/lapsoss/configuration.rb', line 18 def transport_max_retries @transport_max_retries end |
#transport_ssl_verify ⇒ Object
Returns the value of attribute transport_ssl_verify.
18 19 20 |
# File 'lib/lapsoss/configuration.rb', line 18 def transport_ssl_verify @transport_ssl_verify end |
#transport_timeout ⇒ Object
Returns the value of attribute transport_timeout.
18 19 20 |
# File 'lib/lapsoss/configuration.rb', line 18 def transport_timeout @transport_timeout end |
#whitelist_fields ⇒ Object
Returns the value of attribute whitelist_fields.
9 10 11 |
# File 'lib/lapsoss/configuration.rb', line 9 def whitelist_fields @whitelist_fields end |
Instance Method Details
#adapter_names ⇒ Object
Get configured adapter names
171 172 173 |
# File 'lib/lapsoss/configuration.rb', line 171 def adapter_names @adapter_configs.keys end |
#adapters_configured? ⇒ Boolean
Check if any adapters are configured
166 167 168 |
# File 'lib/lapsoss/configuration.rb', line 166 def adapters_configured? !@adapter_configs.empty? end |
#apply! ⇒ Object
Apply configuration by registering all adapters
153 154 155 156 157 158 159 160 161 162 163 |
# File 'lib/lapsoss/configuration.rb', line 153 def apply! Registry.instance.clear! @adapter_configs.each do |name, config| Registry.instance.register( name, config[:type], **config[:settings] ) end end |
#async? ⇒ Boolean
210 211 212 |
# File 'lib/lapsoss/configuration.rb', line 210 def async? @async end |
#clear! ⇒ Object
202 203 204 |
# File 'lib/lapsoss/configuration.rb', line 202 def clear! initialize end |
#configure_pipeline {|@pipeline_builder| ... } ⇒ Object
Pipeline configuration
215 216 217 218 219 |
# File 'lib/lapsoss/configuration.rb', line 215 def configure_pipeline @pipeline_builder = PipelineBuilder.new yield(@pipeline_builder) if block_given? @pipeline_builder end |
#configure_sampling(strategy = nil, &block) ⇒ Object
Sampling configuration
231 232 233 234 235 236 237 |
# File 'lib/lapsoss/configuration.rb', line 231 def configure_sampling(strategy = nil, &block) if strategy @sampling_strategy = strategy elsif block_given? @sampling_strategy = block end end |
#create_sampling_strategy ⇒ Object
239 240 241 242 243 244 245 246 247 248 249 250 |
# File 'lib/lapsoss/configuration.rb', line 239 def create_sampling_strategy case @sampling_strategy when Numeric Sampling::UniformSampler.new(@sampling_strategy) when Proc @sampling_strategy when nil Sampling::UniformSampler.new(@sample_rate) else @sampling_strategy end end |
#debug? ⇒ Boolean
206 207 208 |
# File 'lib/lapsoss/configuration.rb', line 206 def debug? @debug end |
#default_extra ⇒ Object
198 199 200 |
# File 'lib/lapsoss/configuration.rb', line 198 def default_extra @default_context[:extra] ||= {} end |
#default_extra=(extra) ⇒ Object
Default extra context setter/getter
194 195 196 |
# File 'lib/lapsoss/configuration.rb', line 194 def default_extra=(extra) @default_context[:extra] = extra end |
#default_tags ⇒ Object
180 181 182 |
# File 'lib/lapsoss/configuration.rb', line 180 def @default_context[:tags] ||= {} end |
#default_tags=(tags) ⇒ Object
Default tags setter/getter
176 177 178 |
# File 'lib/lapsoss/configuration.rb', line 176 def () @default_context[:tags] = end |
#default_user ⇒ Object
189 190 191 |
# File 'lib/lapsoss/configuration.rb', line 189 def default_user @default_context[:user] end |
#default_user=(user) ⇒ Object
Default user setter/getter
185 186 187 |
# File 'lib/lapsoss/configuration.rb', line 185 def default_user=(user) @default_context[:user] = user end |
#pipeline ⇒ Object
221 222 223 |
# File 'lib/lapsoss/configuration.rb', line 221 def pipeline @pipeline || @pipeline_builder&.pipeline end |
#pipeline=(value) ⇒ Object
225 226 227 228 |
# File 'lib/lapsoss/configuration.rb', line 225 def pipeline=(value) validate_callable!(value, "pipeline") if value @pipeline = value end |
#register_adapter(name, type, **settings) ⇒ Object
Register a named adapter configuration
81 82 83 84 85 86 |
# File 'lib/lapsoss/configuration.rb', line 81 def register_adapter(name, type, **settings) @adapter_configs[name.to_sym] = { type: type&.to_sym, settings: settings } end |
#use_appsignal(name: :appsignal, **settings) ⇒ Object
Convenience method for AppSignal
99 100 101 |
# File 'lib/lapsoss/configuration.rb', line 99 def use_appsignal(name: :appsignal, **settings) register_adapter(name, :appsignal, **settings) end |
#use_bugsnag(name: :bugsnag, **settings) ⇒ Object
Backwards compatibility for Bugsnag
109 110 111 |
# File 'lib/lapsoss/configuration.rb', line 109 def use_bugsnag(name: :bugsnag, **settings) register_adapter(name, :bugsnag, **settings) end |
#use_insight_hub(name: :insight_hub, **settings) ⇒ Object
Convenience method for Insight Hub
104 105 106 |
# File 'lib/lapsoss/configuration.rb', line 104 def use_insight_hub(name: :insight_hub, **settings) register_adapter(name, :insight_hub, **settings) end |
#use_jaeger(name: :jaeger, **settings) ⇒ Object
Convenience method for Jaeger (OTLP-compatible)
141 142 143 144 |
# File 'lib/lapsoss/configuration.rb', line 141 def use_jaeger(name: :jaeger, **settings) settings[:endpoint] ||= "http://localhost:4318" register_adapter(name, :otlp, **settings) end |
#use_logger(name: :logger, **settings) ⇒ Object
Convenience method for Logger
119 120 121 |
# File 'lib/lapsoss/configuration.rb', line 119 def use_logger(name: :logger, **settings) register_adapter(name, :logger, **settings) end |
#use_openobserve(name: :openobserve, **settings) ⇒ Object
Convenience method for OpenObserve
124 125 126 |
# File 'lib/lapsoss/configuration.rb', line 124 def use_openobserve(name: :openobserve, **settings) register_adapter(name, :openobserve, **settings) end |
#use_otlp(name: :otlp, **settings) ⇒ Object
Convenience method for OTLP (OpenTelemetry Protocol) Works with SigNoz, Jaeger, Tempo, Honeycomb, etc.
130 131 132 |
# File 'lib/lapsoss/configuration.rb', line 130 def use_otlp(name: :otlp, **settings) register_adapter(name, :otlp, **settings) end |
#use_rollbar(name: :rollbar, **settings) ⇒ Object
Convenience method for Rollbar
114 115 116 |
# File 'lib/lapsoss/configuration.rb', line 114 def (name: :rollbar, **settings) register_adapter(name, :rollbar, **settings) end |
#use_sentry(name: :sentry, **settings) ⇒ Object
Convenience method for Sentry
89 90 91 |
# File 'lib/lapsoss/configuration.rb', line 89 def use_sentry(name: :sentry, **settings) register_adapter(name, :sentry, **settings) end |
#use_signoz(name: :signoz, **settings) ⇒ Object
Convenience method for SigNoz (OTLP-compatible)
135 136 137 138 |
# File 'lib/lapsoss/configuration.rb', line 135 def use_signoz(name: :signoz, **settings) settings[:endpoint] ||= "http://localhost:4318" register_adapter(name, :otlp, **settings) end |
#use_telebugs(name: :telebugs, **settings) ⇒ Object
Convenience method for Telebugs (Sentry-compatible)
94 95 96 |
# File 'lib/lapsoss/configuration.rb', line 94 def use_telebugs(name: :telebugs, **settings) register_adapter(name, :telebugs, **settings) end |
#use_tempo(name: :tempo, **settings) ⇒ Object
Convenience method for Grafana Tempo (OTLP-compatible)
147 148 149 150 |
# File 'lib/lapsoss/configuration.rb', line 147 def use_tempo(name: :tempo, **settings) settings[:endpoint] ||= "http://localhost:4318" register_adapter(name, :otlp, **settings) end |
#validate! ⇒ Object
Configuration validation - just log warnings, don't fail
312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 |
# File 'lib/lapsoss/configuration.rb', line 312 def validate! # Check sample rate is between 0 and 1 if @sample_rate && (@sample_rate < 0 || @sample_rate > 1) logger.warn "sample_rate should be between 0 and 1, got #{@sample_rate}" end # Check callables validate_callable!(@before_send, "before_send") validate_callable!(@error_handler, "error_handler") validate_callable!(@fingerprint_callback, "fingerprint_callback") # Log if environment looks unusual validate_environment!(@environment, "environment") if @environment # Just log if transport settings look unusual if @transport_timeout && @transport_timeout <= 0 logger.warn "transport_timeout should be positive, got #{@transport_timeout}" end if @transport_max_retries && @transport_max_retries < 0 logger.warn "transport_max_retries should be non-negative, got #{@transport_max_retries}" end if @transport_initial_backoff && @transport_max_backoff && @transport_initial_backoff > @transport_max_backoff logger.warn "transport_initial_backoff (#{@transport_initial_backoff}) should be less than transport_max_backoff (#{@transport_max_backoff})" end # Validate adapter configurations exist @adapter_configs.each do |name, config| if config[:type].blank? logger.warn "Adapter '#{name}' has no type specified" end end true end |