This document describes configuration options available to Sentry.
Some integrations allow specifying these in a standard configuration, otherwise they are generally passed upon instantiation of the Sentry client.
Settings are specified as part of the intialization of the client.
As of Raven 1.2.0, you can now configure all clients through a standard DSN string. This can be specified as a default using the SENTRY_DSN environment variable, as well as passed to all clients by using the dsn argument.
from raven import Client # Read configuration from the environment client = Client() # Manually specify a DSN client = Client('http://public:email@example.com/1')
The DSN can be found in Sentry by navigation to Account -> Projects -> [Project Name] -> [Member Name]. Its template resembles the following:
It is composed of six important pieces:
Protocol may also contain transporter type: gevent+http, gevent+https, twisted+http, tornado+http, eventlet+http, eventlet+https
The following are valid arguments which may be passed to the Raven client:
A sentry compatible DSN.
dsn = 'http://public:firstname.lastname@example.org/1'
Set this to your Sentry project ID. The default value for installations is 1.
project = 1
Set this to the public key of the project member which will authenticate as the client. You can find this information on the member details page of your project within Sentry.
public_key = 'fb9f9e31ea4f40d48855c603f15a2aa4'
Set this to the secret key of the project member which will authenticate as the client. You can find this information on the member details page of your project within Sentry.
secret_key = '6e968b3d8ba240fcb50072ad9cba0810'
An optional, arbitrary string to identify this client installation.
site = 'my site name'
This will override the server_name value for this installation. Defaults to socket.gethostname().
name = 'sentry_rocks_' + socket.gethostname()
Extending this allow you to ignore module prefixes when we attempt to discover which function an error comes from (typically a view)
exclude_paths = [ 'django', 'sentry', 'raven', 'lxml.objectify', ]
For example, in Django this defaults to your list of INSTALLED_APPS, and is used for drilling down where an exception is located
include_paths = [ 'django', 'sentry', 'raven', 'lxml.objectify', ]
The maximum number of items a list-like container should store.
If an iterable is longer than the specified length, the left-most elements up to length will be kept.
This affects sets as well, which are unordered.
list_max_length = 50
The maximum characters of a string that should be stored.
If a string is longer than the given length, it will be truncated down to the specified size.
string_max_length = 200
Should Raven automatically log frame stacks (including locals) all calls as it would for exceptions.
auto_log_stacks = True
If supported, the timeout value for sending messages to remote.
timeout = 1
A list of processors to apply to events before sending them to the Sentry server. Useful for sending additional global state data or sanitizing data that you want to keep off of the server.
processors = ( 'raven.processors.SanitizePasswordsProcessor', )
Several processors are included with Raven to assist in data sanitiziation. These are configured with the processors value.
Removes all keys which resemble password or secret within stacktrace contexts, and HTTP bits (such as cookies, POST data, the querystring, and environment).
Removes all stacktrace context variables. This will cripple the functionality of Sentry, as you’ll only get raw tracebacks, but it will ensure no local scoped information is available to the server.
Removes the body of all HTTP data.
Once you’ve got your server configured, you can test the Raven client by using it’s CLI:
raven test <DSN value>
If you’ve configured your environment to have SENTRY_DSN available, you can simply drop the optional DSN argument:
You should get something like the following, assuming you’re configured everything correctly:
$ raven test http://dd2c825ff9b1417d88a99573903ebf80:91631495b10b45f8a1cdbc492088da6a@localhost:9000/1 Using DSN configuration: http://dd2c825ff9b1417d88a99573903ebf80:91631495b10b45f8a1cdbc492088da6a@localhost:9000/1 Client configuration: servers : ['http://localhost:9000/api/store/'] project : 1 public_key : dd2c825ff9b1417d88a99573903ebf80 secret_key : 91631495b10b45f8a1cdbc492088da6a Sending a test message... success! The test message can be viewed at the following URL: http://localhost:9000/1/search/?q=c988bf5cb7db4653825c92f6864e7206$b8a6fbd29cc9113a149ad62cf7e0ddd5