class Dogcatcher::Config

Configuration for Dogcatcher

Constants

DEFAULT_METRIC_NAME

Attributes

api_key[RW]

Datadog API key.

This must be configured in order to sent events to the Datadog API.

backtrace_cleaner[RW]

Used to clean the backtrace.

By default it does no cleaning.

custom_tags[RW]

Custom tags to send with exception events

gem_tags[RW]

When enabled it will add tags for each gem_name:version found in the backtrace.

Enabled by default.

metric_name[RW]

Name of the metric that will be sent

program[RW]

Optional program name that will be included in the event information.

send_event[RW]

When true, an event will be sent via the enabled method.

send_metric[RW]

When true, a metric will be sent via the enabled method.

statsd_host[RW]

The host and port where statsd events will be sent.

By default the host is 127.0.0.1 and the port is 8125.

statsd_port[RW]
use_dogapi[RW]

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.

use_statsd[RW]

Public Class Methods

new() click to toggle source
# 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

add_filter() { |line| ... } click to toggle source

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
add_silencer() { |line| ... } click to toggle source

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
use_dogapi?() click to toggle source

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
use_statsd?() click to toggle source

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