Class: Sentry::Configuration
- Inherits:
-
Object
- Object
- Sentry::Configuration
- Includes:
- ArgumentCheckingHelper, CustomInspection, LoggingHelper
- Defined in:
- lib/sentry/configuration.rb
Constant Summary collapse
- PUMA_IGNORE_DEFAULT =
These exceptions could enter Puma’s ‘lowlevel_error_handler` callback and the SDK’s Puma integration But they are mostly considered as noise and should be ignored by default Please see github.com/getsentry/sentry-ruby/pull/2026 for more information
[ 'Puma::MiniSSL::SSLError', 'Puma::HttpParserError', 'Puma::HttpParserError501' ].freeze
- IGNORE_DEFAULT =
Most of these errors generate 4XX responses. In general, Sentry clients only automatically report 5xx responses.
[ 'Mongoid::Errors::DocumentNotFound', 'Rack::QueryParser::InvalidParameterError', 'Rack::QueryParser::ParameterTypeError', 'Sinatra::NotFound' ].freeze
- RACK_ENV_WHITELIST_DEFAULT =
%w[ REMOTE_ADDR SERVER_NAME SERVER_PORT ].freeze
- HEROKU_DYNO_METADATA_MESSAGE =
"You are running on Heroku but haven't enabled Dyno Metadata. For Sentry's "\ "release detection to work correctly, please run `heroku labs:enable runtime-dyno-metadata`".freeze
- LOG_PREFIX =
"** [Sentry] ".freeze
- MODULE_SEPARATOR =
"::".freeze
- SKIP_INSPECTION_ATTRIBUTES =
[:@linecache, :@stacktrace_builder]
- INSTRUMENTERS =
[:sentry, :otel]
- PROPAGATION_TARGETS_MATCH_ALL =
/.*/.freeze
- DEFAULT_PATCHES =
%i[redis puma http].freeze
Instance Attribute Summary collapse
-
#app_dirs_pattern ⇒ Regexp?
Directories to be recognized as part of your app.
-
#async ⇒ Proc?
deprecated
Deprecated.
It will be removed in the next major release. Please read github.com/getsentry/sentry-ruby/issues/1522 for more information
-
#auto_session_tracking ⇒ Boolean
Track sessions in request/response cycles automatically.
-
#background_worker_max_queue ⇒ Integer
The maximum queue size for the background worker.
-
#background_worker_threads ⇒ Integer
to send events in a non-blocking way, sentry-ruby has its own background worker by default, the worker holds a thread pool that has [the number of processors] threads but you can configure it with this configuration option E.g.: config.background_worker_threads = 5.
-
#backtrace_cleanup_callback ⇒ Proc?
a proc/lambda that takes an array of stack traces it’ll be used to silence (reduce) backtrace of the exception.
-
#before_breadcrumb ⇒ Proc
Optional Proc, called before adding the breadcrumb to the current scope.
-
#before_send ⇒ Proc
Optional Proc, called before sending an event to the server.
-
#before_send_transaction ⇒ Proc
Optional Proc, called before sending an event to the server.
-
#breadcrumbs_logger ⇒ Array<Symbol>
An array of breadcrumbs loggers to be used.
-
#context_lines ⇒ Integer?
Number of lines of code context to capture, or nil for none.
-
#cron ⇒ Cron::Configuration
readonly
Cron related configuration.
-
#debug ⇒ Boolean
Whether the SDK should run in the debugging mode.
-
#dsn ⇒ String
the dsn value, whether it’s set via ‘config.dsn=` or `ENV`.
-
#enable_backpressure_handling ⇒ Boolean
Whether to downsample transactions automatically because of backpressure.
-
#enable_tracing ⇒ Boolean?
Easier way to use performance tracing If set to true, will set traces_sample_rate to 1.0.
-
#enabled_environments ⇒ Array<String>
Whitelist of enabled_environments that will send notifications to Sentry.
-
#enabled_patches ⇒ Array<Symbol>
Array of patches to apply.
-
#environment ⇒ String
RACK_ENV by default.
-
#exclude_loggers ⇒ Array<String>
Logger ‘progname’s to exclude from breadcrumbs.
-
#excluded_exceptions ⇒ Array<String>
Array of exception classes that should never be sent.
-
#include_local_variables ⇒ Boolean
(also: #capture_exception_frame_locals)
Whether to capture local variables from the raised exception’s frame.
-
#inspect_exception_causes_for_exclusion ⇒ Boolean
(also: #inspect_exception_causes_for_exclusion?)
Boolean to check nested exceptions when deciding if to exclude.
-
#instrumenter ⇒ Symbol
The instrumenter to use, :sentry or :otel.
-
#linecache ⇒ LineCache
You may provide your own LineCache for matching paths with source files.
-
#logger ⇒ Logger
Logger used by Sentry.
-
#max_breadcrumbs ⇒ Integer
Max number of breadcrumbs a breadcrumb buffer can hold.
-
#metrics ⇒ Metrics::Configuration
readonly
Metrics related configuration.
-
#profiles_sample_rate ⇒ Float?
Take a float between 0.0 and 1.0 as the sample rate for capturing profiles.
-
#project_root ⇒ String
Project directory root for in_app detection.
-
#propagate_traces ⇒ Boolean
Insert sentry-trace to outgoing requests’ headers.
-
#rack_env_whitelist ⇒ Array<String>
Array of rack env parameters to be included in the event sent to sentry.
-
#release ⇒ String
Release tag to be passed with every event sent to Sentry.
-
#sample_rate ⇒ Float
The sampling factor to apply to events.
-
#send_client_reports ⇒ Boolean
Send diagnostic client reports about dropped events, true by default tries to attach to an existing envelope max once every 30s.
-
#send_default_pii ⇒ Boolean
When send_default_pii’s value is false (default), sensitive information like - user ip - user cookie - request body - query string will not be sent to Sentry.
-
#send_modules ⇒ Boolean
Include module versions in reports - boolean.
- #server_name ⇒ String
-
#skip_rake_integration ⇒ Boolean
Allow to skip Sentry emails within rake tasks.
-
#spotlight ⇒ Boolean, String
Whether to capture events and traces into Spotlight.
-
#trace_propagation_targets ⇒ Array<String, Regexp>
Allowlist of outgoing request targets to which sentry-trace and baggage headers are attached.
-
#traces_sample_rate ⇒ Float?
Take a float between 0.0 and 1.0 as the sample rate for tracing events (transactions).
-
#traces_sampler ⇒ Proc
Take a Proc that controls the sample rate for every tracing event, e.g.
-
#transport ⇒ Transport::Configuration
readonly
Transport related configuration.
-
#trusted_proxies ⇒ Object
IP ranges for trusted proxies that will be skipped when calculating IP address.
Class Method Summary collapse
-
.add_post_initialization_callback(&block) ⇒ Object
allow extensions to add their hooks to the Configuration class.
-
.post_initialization_callbacks ⇒ Object
Post initialization callbacks are called at the end of initialization process allowing extending the configuration of sentry-ruby by multiple extensions.
Instance Method Summary collapse
-
#capture_exception_frame_locals=(value) ⇒ Object
deprecated
Deprecated.
Use #include_local_variables= instead.
- #csp_report_uri ⇒ String?
- #detect_release ⇒ Object private
- #enabled_in_current_env? ⇒ Boolean
- #error_messages ⇒ Object private
- #exception_class_allowed?(exc) ⇒ Boolean
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #is_numeric_or_nil?(value) ⇒ Boolean
- #profiling_enabled? ⇒ Boolean
- #sample_allowed? ⇒ Boolean
- #sending_allowed? ⇒ Boolean
- #sending_to_dsn_allowed? ⇒ Boolean
- #session_tracking? ⇒ Boolean
- #stacktrace_builder ⇒ Object private
- #tracing_enabled? ⇒ Boolean
- #valid_sample_rate?(sample_rate) ⇒ Boolean
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 |
# File 'lib/sentry/configuration.rb', line 351 def initialize self.app_dirs_pattern = nil self.debug = false self.background_worker_threads = Concurrent.processor_count self.background_worker_max_queue = BackgroundWorker::DEFAULT_MAX_QUEUE self.backtrace_cleanup_callback = nil self. = BreadcrumbBuffer::DEFAULT_SIZE self. = [] self.context_lines = 3 self.include_local_variables = false self.environment = environment_from_env self.enabled_environments = [] self.exclude_loggers = [] self.excluded_exceptions = IGNORE_DEFAULT + PUMA_IGNORE_DEFAULT self.inspect_exception_causes_for_exclusion = true self.linecache = ::Sentry::LineCache.new self.logger = ::Sentry::Logger.new(STDOUT) self.project_root = Dir.pwd self.propagate_traces = true self.sample_rate = 1.0 self.send_modules = true self.send_default_pii = false self.skip_rake_integration = false self.send_client_reports = true self.auto_session_tracking = true self.enable_backpressure_handling = false self.trusted_proxies = [] self.dsn = ENV['SENTRY_DSN'] self.spotlight = false self.server_name = server_name_from_env self.instrumenter = :sentry self.trace_propagation_targets = [PROPAGATION_TARGETS_MATCH_ALL] self.enabled_patches = DEFAULT_PATCHES.dup self.before_send = nil self.before_send_transaction = nil self.rack_env_whitelist = RACK_ENV_WHITELIST_DEFAULT self.traces_sampler = nil self.enable_tracing = nil @transport = Transport::Configuration.new @cron = Cron::Configuration.new @metrics = Metrics::Configuration.new @gem_specs = Hash[Gem::Specification.map { |spec| [spec.name, spec.version.to_s] }] if Gem::Specification.respond_to?(:map) run_post_initialization_callbacks end |
Instance Attribute Details
#app_dirs_pattern ⇒ Regexp?
Directories to be recognized as part of your app. e.g. if you have an ‘engines` dir at the root of your project, you may want to set this to something like /(app|config|engines|lib)/
26 27 28 |
# File 'lib/sentry/configuration.rb', line 26 def app_dirs_pattern @app_dirs_pattern end |
#async ⇒ Proc?
It will be removed in the next major release. Please read github.com/getsentry/sentry-ruby/issues/1522 for more information
Provide an object that responds to ‘call` to send events asynchronously. E.g.: lambda { |event| Thread.new { Sentry.send_event(event) } }
33 34 35 |
# File 'lib/sentry/configuration.rb', line 33 def async @async end |
#auto_session_tracking ⇒ Boolean
Track sessions in request/response cycles automatically
269 270 271 |
# File 'lib/sentry/configuration.rb', line 269 def auto_session_tracking @auto_session_tracking end |
#background_worker_max_queue ⇒ Integer
The maximum queue size for the background worker. Jobs will be rejected above this limit.
Default is BackgroundWorker::DEFAULT_MAX_QUEUE.
50 51 52 |
# File 'lib/sentry/configuration.rb', line 50 def background_worker_max_queue @background_worker_max_queue end |
#background_worker_threads ⇒ Integer
to send events in a non-blocking way, sentry-ruby has its own background worker by default, the worker holds a thread pool that has [the number of processors] threads but you can configure it with this configuration option E.g.: config.background_worker_threads = 5
if you want to send events synchronously, set the value to 0 E.g.: config.background_worker_threads = 0
43 44 45 |
# File 'lib/sentry/configuration.rb', line 43 def background_worker_threads @background_worker_threads end |
#backtrace_cleanup_callback ⇒ Proc?
a proc/lambda that takes an array of stack traces it’ll be used to silence (reduce) backtrace of the exception
61 62 63 |
# File 'lib/sentry/configuration.rb', line 61 def backtrace_cleanup_callback @backtrace_cleanup_callback end |
#before_breadcrumb ⇒ Proc
Optional Proc, called before adding the breadcrumb to the current scope
70 71 72 |
# File 'lib/sentry/configuration.rb', line 70 def @before_breadcrumb end |
#before_send ⇒ Proc
Optional Proc, called before sending an event to the server
84 85 86 |
# File 'lib/sentry/configuration.rb', line 84 def before_send @before_send end |
#before_send_transaction ⇒ Proc
Optional Proc, called before sending an event to the server
97 98 99 |
# File 'lib/sentry/configuration.rb', line 97 def before_send_transaction @before_send_transaction end |
#breadcrumbs_logger ⇒ Array<Symbol>
An array of breadcrumbs loggers to be used. Available options are:
-
:sentry_logger
-
:http_logger
-
:redis_logger
And if you also use sentry-rails:
-
:active_support_logger
-
:monotonic_active_support_logger
109 110 111 |
# File 'lib/sentry/configuration.rb', line 109 def @breadcrumbs_logger end |
#context_lines ⇒ Integer?
Number of lines of code context to capture, or nil for none
117 118 119 |
# File 'lib/sentry/configuration.rb', line 117 def context_lines @context_lines end |
#cron ⇒ Cron::Configuration (readonly)
Cron related configuration.
237 238 239 |
# File 'lib/sentry/configuration.rb', line 237 def cron @cron end |
#debug ⇒ Boolean
Whether the SDK should run in the debugging mode. Default is false. If set to true, SDK errors will be logged with backtrace
126 127 128 |
# File 'lib/sentry/configuration.rb', line 126 def debug @debug end |
#dsn ⇒ String
the dsn value, whether it’s set via ‘config.dsn=` or `ENV`
130 131 132 |
# File 'lib/sentry/configuration.rb', line 130 def dsn @dsn end |
#enable_backpressure_handling ⇒ Boolean
Whether to downsample transactions automatically because of backpressure. Starts a new monitor thread to check health of the SDK every 10 seconds. Default is false
275 276 277 |
# File 'lib/sentry/configuration.rb', line 275 def enable_backpressure_handling @enable_backpressure_handling end |
#enable_tracing ⇒ Boolean?
Easier way to use performance tracing If set to true, will set traces_sample_rate to 1.0
260 261 262 |
# File 'lib/sentry/configuration.rb', line 260 def enable_tracing @enable_tracing end |
#enabled_environments ⇒ Array<String>
Whitelist of enabled_environments that will send notifications to Sentry. Array of Strings.
134 135 136 |
# File 'lib/sentry/configuration.rb', line 134 def enabled_environments @enabled_environments end |
#enabled_patches ⇒ Array<Symbol>
Array of patches to apply. Default is DEFAULT_PATCHES
295 296 297 |
# File 'lib/sentry/configuration.rb', line 295 def enabled_patches @enabled_patches end |
#environment ⇒ String
RACK_ENV by default.
121 122 123 |
# File 'lib/sentry/configuration.rb', line 121 def environment @environment end |
#exclude_loggers ⇒ Array<String>
Logger ‘progname’s to exclude from breadcrumbs
138 139 140 |
# File 'lib/sentry/configuration.rb', line 138 def exclude_loggers @exclude_loggers end |
#excluded_exceptions ⇒ Array<String>
Array of exception classes that should never be sent. See IGNORE_DEFAULT. You should probably append to this rather than overwrite it.
143 144 145 |
# File 'lib/sentry/configuration.rb', line 143 def excluded_exceptions @excluded_exceptions end |
#include_local_variables ⇒ Boolean Also known as: capture_exception_frame_locals
Whether to capture local variables from the raised exception’s frame. Default is false.
152 153 154 |
# File 'lib/sentry/configuration.rb', line 152 def include_local_variables @include_local_variables end |
#inspect_exception_causes_for_exclusion ⇒ Boolean Also known as: inspect_exception_causes_for_exclusion?
Boolean to check nested exceptions when deciding if to exclude. Defaults to true
147 148 149 |
# File 'lib/sentry/configuration.rb', line 147 def inspect_exception_causes_for_exclusion @inspect_exception_causes_for_exclusion end |
#instrumenter ⇒ Symbol
The instrumenter to use, :sentry or :otel
284 285 286 |
# File 'lib/sentry/configuration.rb', line 284 def instrumenter @instrumenter end |
#linecache ⇒ LineCache
You may provide your own LineCache for matching paths with source files. This may be useful if you need to get source code from places other than the disk.
178 179 180 |
# File 'lib/sentry/configuration.rb', line 178 def linecache @linecache end |
#logger ⇒ Logger
Logger used by Sentry. In Rails, this is the Rails logger, otherwise Sentry provides its own Sentry::Logger.
183 184 185 |
# File 'lib/sentry/configuration.rb', line 183 def logger @logger end |
#max_breadcrumbs ⇒ Integer
Max number of breadcrumbs a breadcrumb buffer can hold
113 114 115 |
# File 'lib/sentry/configuration.rb', line 113 def @max_breadcrumbs end |
#metrics ⇒ Metrics::Configuration (readonly)
Metrics related configuration.
241 242 243 |
# File 'lib/sentry/configuration.rb', line 241 def metrics @metrics end |
#profiles_sample_rate ⇒ Float?
Take a float between 0.0 and 1.0 as the sample rate for capturing profiles. Note that this rate is relative to traces_sample_rate / traces_sampler, i.e. the profile is sampled by this rate after the transaction is sampled.
290 291 292 |
# File 'lib/sentry/configuration.rb', line 290 def profiles_sample_rate @profiles_sample_rate end |
#project_root ⇒ String
Project directory root for in_app detection. Could be Rails root, etc. Set automatically for Rails.
188 189 190 |
# File 'lib/sentry/configuration.rb', line 188 def project_root @project_root end |
#propagate_traces ⇒ Boolean
Insert sentry-trace to outgoing requests’ headers
192 193 194 |
# File 'lib/sentry/configuration.rb', line 192 def propagate_traces @propagate_traces end |
#rack_env_whitelist ⇒ Array<String>
Array of rack env parameters to be included in the event sent to sentry.
196 197 198 |
# File 'lib/sentry/configuration.rb', line 196 def rack_env_whitelist @rack_env_whitelist end |
#release ⇒ String
Release tag to be passed with every event sent to Sentry. We automatically try to set this to a git SHA or Capistrano release.
201 202 203 |
# File 'lib/sentry/configuration.rb', line 201 def release @release end |
#sample_rate ⇒ Float
The sampling factor to apply to events. A value of 0.0 will not send any events, and a value of 1.0 will send 100% of events.
206 207 208 |
# File 'lib/sentry/configuration.rb', line 206 def sample_rate @sample_rate end |
#send_client_reports ⇒ Boolean
Send diagnostic client reports about dropped events, true by default tries to attach to an existing envelope max once every 30s
265 266 267 |
# File 'lib/sentry/configuration.rb', line 265 def send_client_reports @send_client_reports end |
#send_default_pii ⇒ Boolean
When send_default_pii’s value is false (default), sensitive information like
-
user ip
-
user cookie
-
request body
-
query string
will not be sent to Sentry.
219 220 221 |
# File 'lib/sentry/configuration.rb', line 219 def send_default_pii @send_default_pii end |
#send_modules ⇒ Boolean
Include module versions in reports - boolean.
210 211 212 |
# File 'lib/sentry/configuration.rb', line 210 def send_modules @send_modules end |
#server_name ⇒ String
229 230 231 |
# File 'lib/sentry/configuration.rb', line 229 def server_name @server_name end |
#skip_rake_integration ⇒ Boolean
Allow to skip Sentry emails within rake tasks
223 224 225 |
# File 'lib/sentry/configuration.rb', line 223 def skip_rake_integration @skip_rake_integration end |
#spotlight ⇒ Boolean, String
Whether to capture events and traces into Spotlight. Default is false. If you set this to true, Sentry will send events and traces to the local Sidecar proxy at localhost:8969/stream. If you want to use a different Sidecar proxy address, set this to String with the proxy URL.
160 161 162 |
# File 'lib/sentry/configuration.rb', line 160 def spotlight @spotlight end |
#trace_propagation_targets ⇒ Array<String, Regexp>
Allowlist of outgoing request targets to which sentry-trace and baggage headers are attached. Default is all (/.*/)
280 281 282 |
# File 'lib/sentry/configuration.rb', line 280 def trace_propagation_targets @trace_propagation_targets end |
#traces_sample_rate ⇒ Float?
Take a float between 0.0 and 1.0 as the sample rate for tracing events (transactions).
245 246 247 |
# File 'lib/sentry/configuration.rb', line 245 def traces_sample_rate @traces_sample_rate end |
#traces_sampler ⇒ Proc
Take a Proc that controls the sample rate for every tracing event, e.g.
255 256 257 |
# File 'lib/sentry/configuration.rb', line 255 def traces_sampler @traces_sampler end |
#transport ⇒ Transport::Configuration (readonly)
Transport related configuration.
233 234 235 |
# File 'lib/sentry/configuration.rb', line 233 def transport @transport end |
#trusted_proxies ⇒ Object
IP ranges for trusted proxies that will be skipped when calculating IP address.
226 227 228 |
# File 'lib/sentry/configuration.rb', line 226 def trusted_proxies @trusted_proxies end |
Class Method Details
.add_post_initialization_callback(&block) ⇒ Object
allow extensions to add their hooks to the Configuration class
346 347 348 |
# File 'lib/sentry/configuration.rb', line 346 def add_post_initialization_callback(&block) post_initialization_callbacks << block end |
.post_initialization_callbacks ⇒ Object
Post initialization callbacks are called at the end of initialization process allowing extending the configuration of sentry-ruby by multiple extensions
341 342 343 |
# File 'lib/sentry/configuration.rb', line 341 def post_initialization_callbacks @post_initialization_callbacks ||= [] end |
Instance Method Details
#capture_exception_frame_locals=(value) ⇒ Object
Use #include_local_variables= instead.
166 167 168 169 170 171 172 |
# File 'lib/sentry/configuration.rb', line 166 def capture_exception_frame_locals=(value) log_warn <<~MSG `capture_exception_frame_locals` is now deprecated in favor of `include_local_variables`. MSG self.include_local_variables = value end |
#csp_report_uri ⇒ String?
542 543 544 545 546 547 548 549 |
# File 'lib/sentry/configuration.rb', line 542 def csp_report_uri if dsn && dsn.valid? uri = dsn.csp_report_uri uri += "&sentry_release=#{CGI.escape(release)}" if release && !release.empty? uri += "&sentry_environment=#{CGI.escape(environment)}" if environment && !environment.empty? uri end end |
#detect_release ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
563 564 565 566 567 568 569 570 571 572 573 |
# File 'lib/sentry/configuration.rb', line 563 def detect_release return unless sending_allowed? @release ||= ReleaseDetector.detect_release(project_root: project_root, running_on_heroku: running_on_heroku?) if running_on_heroku? && release.nil? log_warn(HEROKU_DYNO_METADATA_MESSAGE) end rescue => e log_error("Error detecting release", e, debug: debug) end |
#enabled_in_current_env? ⇒ Boolean
520 521 522 |
# File 'lib/sentry/configuration.rb', line 520 def enabled_in_current_env? enabled_environments.empty? || enabled_environments.include?(environment) end |
#error_messages ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
576 577 578 579 |
# File 'lib/sentry/configuration.rb', line 576 def @errors = [@errors[0]] + @errors[1..-1].map(&:downcase) # fix case of all but first @errors.join(", ") end |
#exception_class_allowed?(exc) ⇒ Boolean
507 508 509 510 511 512 513 514 515 516 517 518 |
# File 'lib/sentry/configuration.rb', line 507 def exception_class_allowed?(exc) if exc.is_a?(Sentry::Error) # Try to prevent error reporting loops log_debug("Refusing to capture Sentry error: #{exc.inspect}") false elsif excluded_exception?(exc) log_debug("User excluded error: #{exc.inspect}") false else true end end |
#is_numeric_or_nil?(value) ⇒ Boolean
472 473 474 |
# File 'lib/sentry/configuration.rb', line 472 def is_numeric_or_nil?(value) value.is_a?(Numeric) || value.nil? end |
#profiling_enabled? ⇒ Boolean
535 536 537 538 539 |
# File 'lib/sentry/configuration.rb', line 535 def profiling_enabled? valid_sampler = !!(valid_sample_rate?(@profiles_sample_rate)) tracing_enabled? && valid_sampler && sending_allowed? end |
#sample_allowed? ⇒ Boolean
497 498 499 500 501 |
# File 'lib/sentry/configuration.rb', line 497 def sample_allowed? return true if sample_rate == 1.0 Random.rand < sample_rate end |
#sending_allowed? ⇒ Boolean
487 488 489 |
# File 'lib/sentry/configuration.rb', line 487 def sending_allowed? spotlight || sending_to_dsn_allowed? end |
#sending_to_dsn_allowed? ⇒ Boolean
491 492 493 494 495 |
# File 'lib/sentry/configuration.rb', line 491 def sending_to_dsn_allowed? @errors = [] valid? && capture_in_environment? end |
#session_tracking? ⇒ Boolean
503 504 505 |
# File 'lib/sentry/configuration.rb', line 503 def session_tracking? auto_session_tracking && enabled_in_current_env? end |
#stacktrace_builder ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
552 553 554 555 556 557 558 559 560 |
# File 'lib/sentry/configuration.rb', line 552 def stacktrace_builder @stacktrace_builder ||= StacktraceBuilder.new( project_root: @project_root.to_s, app_dirs_pattern: @app_dirs_pattern, linecache: @linecache, context_lines: @context_lines, backtrace_cleanup_callback: @backtrace_cleanup_callback ) end |
#tracing_enabled? ⇒ Boolean
529 530 531 532 533 |
# File 'lib/sentry/configuration.rb', line 529 def tracing_enabled? valid_sampler = !!((valid_sample_rate?(@traces_sample_rate)) || @traces_sampler) (@enable_tracing != false) && valid_sampler && sending_allowed? end |
#valid_sample_rate?(sample_rate) ⇒ Boolean
524 525 526 527 |
# File 'lib/sentry/configuration.rb', line 524 def valid_sample_rate?(sample_rate) return false unless sample_rate.is_a?(Numeric) sample_rate >= 0.0 && sample_rate <= 1.0 end |