Class: Logsy::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/logsy/configuration.rb

Constant Summary collapse

DEFAULT_IGNORED_CALLER_PATHS =
[
  %r{/logger\.rb\z},
  %r{/active_support/(tagged_logging|logger|broadcast_logger|log_subscriber)},
  %r{/lograge/},
  %r{/sprockets/},
  %r{/quiet_assets/},
  %r{/lib/logsy/},
  # Rack middlewares sit in every request's call stack, so without this
  # they'd be picked as the "app frame" for lines emitted below them
  # (e.g. "Started GET ..." would be attributed to a health_check
  # middleware). Matches app/middleware and app/middlewares.
  %r{/app/middlewares?/}
].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/logsy/configuration.rb', line 28

def initialize
  @job_propagated_keys        = [:request_id]
  @ignored_caller_paths       = DEFAULT_IGNORED_CALLER_PATHS.dup
  @include_caller_location    = true
  @request_summary_event_name = 'request'
  @job_summary_event_name     = 'job'
  # When true (the default), the Railtie auto-includes Logsy::JobHooks
  # into ActiveJob::Base, so every job emits a summary wide event with
  # no per-app setup. Set to false to opt out and include it manually.
  @auto_include_job_hooks     = true
  # How many stack frames to inspect before giving up on attributing
  # the log line to app code. App frames sit within a few dozen frames
  # of the logger; framework-only lines (no app frame at all) would
  # otherwise pay a full walk of a 100+ deep Rails stack on every line.
  @caller_location_max_depth  = 64
end

Instance Attribute Details

#auto_include_job_hooksObject

Tag keys that should be carried across job boundaries (e.g. when a background job is enqueued from a web request, the job inherits these). The middleware that does the actual carrying is job-runner specific (Logsy ships one for Sidekiq).



23
24
25
# File 'lib/logsy/configuration.rb', line 23

def auto_include_job_hooks
  @auto_include_job_hooks
end

#caller_location_max_depthObject

Tag keys that should be carried across job boundaries (e.g. when a background job is enqueued from a web request, the job inherits these). The middleware that does the actual carrying is job-runner specific (Logsy ships one for Sidekiq).



23
24
25
# File 'lib/logsy/configuration.rb', line 23

def caller_location_max_depth
  @caller_location_max_depth
end

#ignored_caller_pathsObject

Tag keys that should be carried across job boundaries (e.g. when a background job is enqueued from a web request, the job inherits these). The middleware that does the actual carrying is job-runner specific (Logsy ships one for Sidekiq).



23
24
25
# File 'lib/logsy/configuration.rb', line 23

def ignored_caller_paths
  @ignored_caller_paths
end

#include_caller_locationObject

Tag keys that should be carried across job boundaries (e.g. when a background job is enqueued from a web request, the job inherits these). The middleware that does the actual carrying is job-runner specific (Logsy ships one for Sidekiq).



23
24
25
# File 'lib/logsy/configuration.rb', line 23

def include_caller_location
  @include_caller_location
end

#job_propagated_keysObject

Tag keys that should be carried across job boundaries (e.g. when a background job is enqueued from a web request, the job inherits these). The middleware that does the actual carrying is job-runner specific (Logsy ships one for Sidekiq).



23
24
25
# File 'lib/logsy/configuration.rb', line 23

def job_propagated_keys
  @job_propagated_keys
end

#job_summary_event_nameObject

Tag keys that should be carried across job boundaries (e.g. when a background job is enqueued from a web request, the job inherits these). The middleware that does the actual carrying is job-runner specific (Logsy ships one for Sidekiq).



23
24
25
# File 'lib/logsy/configuration.rb', line 23

def job_summary_event_name
  @job_summary_event_name
end

#request_summary_event_nameObject

Tag keys that should be carried across job boundaries (e.g. when a background job is enqueued from a web request, the job inherits these). The middleware that does the actual carrying is job-runner specific (Logsy ships one for Sidekiq).



23
24
25
# File 'lib/logsy/configuration.rb', line 23

def request_summary_event_name
  @request_summary_event_name
end