class Dogcatcher::Config
Configuration for Dogcatcher
Constants
- DEFAULT_METRIC_NAME
Attributes
Datadog API key.
This must be configured in order to sent events to the Datadog API.
Used to clean the backtrace.
By default it does no cleaning.
Name of the metric that will be sent
Optional program name that will be included in the event information.
When true, an event will be sent via the enabled method.
When true, a metric will be sent via the enabled method.
The host and port where statsd events will be sent.
By default the host is 127.0.0.1
and the port is 8125
.
When each is set to true
then exceptions will be sent via the corresponding method. Both can be enabled/disabled at the same time.
By default these are unset; dogapi will be used if an API key is provided else statsd will be used.
Public Class Methods
# File lib/dogcatcher/config.rb, line 50 def initialize @statsd_host = '127.0.0.1' @statsd_port = 8125 @gem_tags = true @backtrace_cleaner = ActiveSupport::BacktraceCleaner.new @custom_tags = [] @send_metric = true @send_event = true @metric_name = DEFAULT_METRIC_NAME end
Public Instance Methods
Adds a backtrace filter. The given line in the backtrace will be replaced with the line returned by the given block.
@yieldparam [String] line in the backtrace @yieldreturn [String] filtered line in the backtrace
# File lib/dogcatcher/config.rb, line 66 def add_filter backtrace_cleaner.add_filter { |line| yield line } end
Adds a backtrace silencer. Excludes the given line from the backtrace if the given block returns true
.
@yieldparam [String] line in the backtrace @yieldreturn [Boolean] true if the line should be excluded
# File lib/dogcatcher/config.rb, line 75 def add_silencer backtrace_cleaner.add_silencer { |line| yield line } end
Whether to send events to the Datadog API.
If {#use_dogapi} is nil
(the default), then this will return true
if a Datadog API key is set.
@return [Boolean] true if events should be sent to the Datadog API
# File lib/dogcatcher/config.rb, line 85 def use_dogapi? return !@api_key.nil? if @use_dogapi.nil? @use_dogapi end
Whether to send events to a statsd collector.
If {#use_dogapi} is nil
(the default), then this will return false
if a Datadog API key is set.
@return [Boolean] true if events should be sent to a statsd collector
# File lib/dogcatcher/config.rb, line 97 def use_statsd? return @api_key.nil? if @use_statsd.nil? @use_statsd end