class Raven::Configuration

Defined in:

raven/configuration.cr

Constant Summary

DEFAULT_PROCESSORS = [Processor::RemoveCircularReferences, Processor::Cookies, Processor::RequestMethodData, Processor::HTTPHeaders, Processor::UTF8Conversion, Processor::SanitizeData, Processor::Compact] of Processor.class

Note the order - we have to remove circular references and bad characters before passing to other processors.

DEFAULT_REQUEST_METHODS_FOR_DATA_SANITIZATION = ["POST", "PUT", "PATCH"] of ::String

Array of default request methods for which data should be removed.

IGNORE_DEFAULT = [] of Exception.class | String

Array of exception classes that should never be sent.

REQUIRED_OPTIONS = [:host, :public_key, :project_id] of ::Symbol

Array of required properties needed to be set, before Configuration is considered valid.

Constructors

Instance Method Summary

Constructor Detail

def self.new #

[View source]

Instance Method Detail

def app_dirs_pattern(*args, **options) #

[View source]
def app_dirs_pattern(*args, **options, &) #

[View source]
def app_dirs_pattern=(arg) #

[View source]
def async : Proc(Event, Nil) | Nil #

Provide a Proc object that responds to call to send events asynchronously, or pass true to to use standard spawn.

->(event : Raven::Event) { spawn { Raven.send_event(event) } }

[View source]
def async=(async : Proc(Event, Nil) | Nil) #

Provide a Proc object that responds to call to send events asynchronously, or pass true to to use standard spawn.

->(event : Raven::Event) { spawn { Raven.send_event(event) } }

[View source]
def async=(switch : Bool) #

Sets #async callback to either Fiber-based implementation (see below), or nil, depending on the given switch value.

->(event : Event) { spawn { Raven.send_event(event) } }

[View source]
def backtracer : Backtracer::Configuration #

[View source]
def backtracer=(backtracer : Backtracer::Configuration) #

[View source]
def before_send(&block : Event, Event::Hint | Nil -> _) #

Optional Proc, called before sending an event to the server:

->(event : Raven::Event, hint : Raven::Event::Hint?) {
  if hint.try(&.exception).try(&.message) =~ /database unavailable/i
    event.fingerprint << "database-unavailable"
  end
  event
}

[View source]
def before_send : Proc(Event, Event::Hint | Nil, Event | Nil) | Nil #

Optional Proc, called before sending an event to the server:

->(event : Raven::Event, hint : Raven::Event::Hint?) {
  if hint.try(&.exception).try(&.message) =~ /database unavailable/i
    event.fingerprint << "database-unavailable"
  end
  event
}

[View source]
def before_send=(block : Event, Event::Hint | Nil -> _) #

Optional Proc, called before sending an event to the server:

->(event : Raven::Event, hint : Raven::Event::Hint?) {
  if hint.try(&.exception).try(&.message) =~ /database unavailable/i
    event.fingerprint << "database-unavailable"
  end
  event
}

[View source]
def before_send=(before_send : Proc(Event, Event::Hint | Nil, Event | Nil) | Nil) #

Optional Proc, called before sending an event to the server:

->(event : Raven::Event, hint : Raven::Event::Hint?) {
  if hint.try(&.exception).try(&.message) =~ /database unavailable/i
    event.fingerprint << "database-unavailable"
  end
  event
}

[View source]
def capture_allowed!(message_or_ex) : ValidationError | Nil #

[View source]
def capture_allowed! : ValidationError | Nil #

[View source]
def capture_allowed?(message_or_ex) : Bool #

[View source]
def capture_allowed? : Bool #

[View source]
def connect_timeout : Time::Span #

Timeout waiting for the Sentry server connection to open in seconds.


[View source]
def connect_timeout=(connect_timeout : Time::Span) #

Timeout waiting for the Sentry server connection to open in seconds.


[View source]
def context_lines(*args, **options) #

[View source]
def context_lines(*args, **options, &) #

[View source]
def context_lines=(arg) #

[View source]
def current_environment : String | Nil #

Defaults to SENTRY_ENVIRONMENT variable if set, "default" otherwise.


[View source]
def current_environment=(current_environment : String | Nil) #

Defaults to SENTRY_ENVIRONMENT variable if set, "default" otherwise.


[View source]
def dsn : String | Nil #

Simple server string - set this to the DSN found on your Sentry settings.


[View source]
def dsn=(uri : URI) #

[View source]
def dsn=(value : String) #

[View source]
def encoding : Encoding #

Encoding type for event bodies.


[View source]
def encoding=(encoding : Encoding) #

Encoding type for event bodies.


[View source]
def environments : Array(String) #

Whitelist of environments that will send notifications to Sentry.


[View source]
def environments=(environments : Array(String)) #

Whitelist of environments that will send notifications to Sentry.


[View source]
def exclude_loggers : Array(String) #

::Log#source patterns excluded from breadcrumb recording.

Defaults to raven.*.

NOTE You should probably append to this rather than overwrite it.


[View source]
def exclude_loggers=(exclude_loggers : Array(String)) #

::Log#source patterns excluded from breadcrumb recording.

Defaults to raven.*.

NOTE You should probably append to this rather than overwrite it.


[View source]
def excluded_exceptions : Array(Exception.class | String) #

Array of exception classes that should never be sent.

See IGNORE_DEFAULT.

NOTE You should probably append to this rather than overwrite it.


[View source]
def excluded_exceptions=(excluded_exceptions : Array(Exception.class | String)) #

Array of exception classes that should never be sent.

See IGNORE_DEFAULT.

NOTE You should probably append to this rather than overwrite it.


[View source]
def host : String | Nil #

NOTE DSN component - set automatically if DSN provided.


[View source]
def host=(host : String | Nil) #

NOTE DSN component - set automatically if DSN provided.


[View source]
def ignored_logger?(source) #

[View source]
def modules_path_pattern(*args, **options) #

[View source]
def modules_path_pattern(*args, **options, &) #

[View source]
def modules_path_pattern=(arg) #

[View source]
def path : String | Nil #

NOTE DSN component - set automatically if DSN provided.


[View source]
def path=(path : String | Nil) #

NOTE DSN component - set automatically if DSN provided.


[View source]
def port : Int32 | Nil #

NOTE DSN component - set automatically if DSN provided.


[View source]
def port=(port : Int32 | Nil) #

NOTE DSN component - set automatically if DSN provided.


[View source]
def processors : Array(Processor.class) #

Processors to run on data before sending upstream. See DEFAULT_PROCESSORS. You should probably append to this rather than overwrite it.


[View source]
def processors=(processors : Array(Processor.class)) #

Processors to run on data before sending upstream. See DEFAULT_PROCESSORS. You should probably append to this rather than overwrite it.


[View source]
def project_id : UInt64 | Nil #

Project ID number to send to the Sentry server

NOTE If you provide a DSN, this will be set automatically.


[View source]
def project_id=(project_id : UInt64 | Nil) #

Project ID number to send to the Sentry server

NOTE If you provide a DSN, this will be set automatically.


[View source]
def project_root : String #

Project directory root for revision detection. Could be Kemal root, etc.


[View source]
def project_root=(project_root : String) #

Project directory root for revision detection. Could be Kemal root, etc.


[View source]
def public_key : String | Nil #

Public key for authentication with the Sentry server.

NOTE If you provide a DSN, this will be set automatically.


[View source]
def public_key=(public_key : String | Nil) #

Public key for authentication with the Sentry server.

NOTE If you provide a DSN, this will be set automatically.


[View source]
def random : Random #

Random instance used when #sample_rate is set.


[View source]
def random=(random : Random) #

Random instance used when #sample_rate is set.


[View source]
def read_timeout : Time::Span #

Timeout when waiting for the server to return data.


[View source]
def read_timeout=(read_timeout : Time::Span) #

Timeout when waiting for the server to return data.


[View source]
def release : String | Nil #

Release tag to be passed with every event sent to Sentry. We automatically try to set this to a git SHA or Capistrano release.


[View source]
def release=(release : String | Nil) #

Release tag to be passed with every event sent to Sentry. We automatically try to set this to a git SHA or Capistrano release.


[View source]
def sample_rate : Float64 #

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.


[View source]
def sample_rate=(sample_rate : Float64) #

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.


[View source]
def sanitize_credit_cards=(sanitize_credit_cards : Bool) #

Should sanitize values that look like credit card numbers?

See Processor::SanitizeData::CREDIT_CARD_PATTERN.


[View source]
def sanitize_credit_cards? : Bool #

Should sanitize values that look like credit card numbers?

See Processor::SanitizeData::CREDIT_CARD_PATTERN.


[View source]
def sanitize_data_for_request_methods : Array(String) #

Request methods for which data should be removed.

See DEFAULT_REQUEST_METHODS_FOR_DATA_SANITIZATION.


[View source]
def sanitize_data_for_request_methods=(sanitize_data_for_request_methods : Array(String)) #

Request methods for which data should be removed.

See DEFAULT_REQUEST_METHODS_FOR_DATA_SANITIZATION.


[View source]
def sanitize_fields : Array(Regex | String) #

By default, Sentry censors Hash values when their keys match things like "secret", "password", etc. Provide an Array of Strings that, when matched in a hash key, will be censored and not sent to Sentry.

See Processor::SanitizeData::DEFAULT_FIELDS.


[View source]
def sanitize_fields=(sanitize_fields : Array(Regex | String)) #

By default, Sentry censors Hash values when their keys match things like "secret", "password", etc. Provide an Array of Strings that, when matched in a hash key, will be censored and not sent to Sentry.

See Processor::SanitizeData::DEFAULT_FIELDS.


[View source]
def sanitize_fields_excluded : Array(Regex | String) #

If you're sure you want to override the default sanitization values, you can add to them to an array of Strings here, e.g. %w(authorization password).


[View source]
def sanitize_fields_excluded=(sanitize_fields_excluded : Array(Regex | String)) #

If you're sure you want to override the default sanitization values, you can add to them to an array of Strings here, e.g. %w(authorization password).


[View source]
def sanitize_http_headers : Array(Regex | String) #

Sanitize additional HTTP headers - only Authorization is removed by default.

See Processor::HTTPHeaders::DEFAULT_FIELDS.


[View source]
def sanitize_http_headers=(sanitize_http_headers : Array(Regex | String)) #

Sanitize additional HTTP headers - only Authorization is removed by default.

See Processor::HTTPHeaders::DEFAULT_FIELDS.


[View source]
def scheme : String | Nil #

Can be one of "http", "https", or "dummy".

NOTE DSN component - set automatically if DSN provided.


[View source]
def scheme=(scheme : String | Nil) #

Can be one of "http", "https", or "dummy".

NOTE DSN component - set automatically if DSN provided.


[View source]
def secret_key : String | Nil #

Secret key for authentication with the Sentry server.

DEPRECATED This is deprecated and not necessary for newer Sentry installations any more.

NOTE If you provide a DSN, this will be set automatically.


[View source]
def secret_key=(secret_key : String | Nil) #

Secret key for authentication with the Sentry server.

DEPRECATED This is deprecated and not necessary for newer Sentry installations any more.

NOTE If you provide a DSN, this will be set automatically.


[View source]
def send_modules=(send_modules : Bool) #

Include module versions in reports.


[View source]
def send_modules? : Bool #

Include module versions in reports.


[View source]
def server_name : String | Nil #

Hostname as an FQDN.


[View source]
def server_name=(server_name : String | Nil) #

Hostname as an FQDN.


[View source]
def should_capture : Proc(Exception | String, Bool) | Nil #

Provide a configurable Proc callback to determine event capture.

NOTE Object passed into the block will be a String (messages) or an Exception.

->(obj : Exception | String) { obj.some_attr == false }

[View source]
def should_capture=(should_capture : Proc(Exception | String, Bool) | Nil) #

Provide a configurable Proc callback to determine event capture.

NOTE Object passed into the block will be a String (messages) or an Exception.

->(obj : Exception | String) { obj.some_attr == false }

[View source]
def silence_ready=(silence_ready : Bool) #

Silences ready message when true.


[View source]
def silence_ready? : Bool #

Silences ready message when true.


[View source]
def src_path(*args, **options) #

[View source]
def src_path(*args, **options, &) #

[View source]
def src_path=(arg) #

[View source]
def ssl : OpenSSL::SSL::Context::Client | Nil #

SSL context passed to Raven::Client.


def ssl=(ssl : OpenSSL::SSL::Context::Client | Nil) #

SSL context passed to Raven::Client.


def tags : AnyHash::JSON #

Default tags for events.


def tags=(tags : AnyHash::JSON) #

Default tags for events.


def tags=(hash : Hash | NamedTuple | Nil) #

Default tags for events.


[View source]
def transport_failure_callback : Proc(Event::HashType, Nil) | Nil #

Optional Proc, called when the Sentry server cannot be contacted for any reason.

->(event : Raven::Event::HashType) {
  spawn { MyJobProcessor.send_email(event) }
}

[View source]
def transport_failure_callback=(transport_failure_callback : Proc(Event::HashType, Nil) | Nil) #

Optional Proc, called when the Sentry server cannot be contacted for any reason.

->(event : Raven::Event::HashType) {
  spawn { MyJobProcessor.send_email(event) }
}

[View source]
def valid? : Bool #

[View source]
def validate! : ValidationError | Nil #

[View source]