Interfaces

Sentry implements data interfaces for storing structured data. At its core, an interface describes what it’s storing, and optionally how its data should be rendered.

Within the client, interfaces are referenced by their full Python module path. For example, if you were sending data for the sentry.interfaces.Message class, it would look like this in your JSON packet:

{
    // etc.
    "message": "Hello world"
    "sentry.interfaces.Message": {
        "message": "Hello world"
    }
}

Aliases

As of protocol version 4, most built-in interface types are aliases for easier reference. For example, instead of using the key ‘sentry.interfaces.Exception’, you can send the key ‘exception’.

The mapping is as follows:

* 'exception' => 'sentry.interfaces.Exception'
* 'request' => 'sentry.interfaces.Http'
* 'user' => 'sentry.interfaces.User'
* 'stacktrace' => 'sentry.interfaces.Stacktrace'
* 'template' => 'sentry.interfaces.Template'

For the canonical names, please see the get_path method on each individual Interface.

Provided Interfaces

class sentry.interfaces.message.Message(**data)[source]

A standard message consisting of a message arg, and an optional params arg for formatting.

If your message cannot be parameterized, then the message interface will serve no benefit.

  • message must be no more than 1000 characters in length.
>>> {
>>>     "message": "My raw message with interpreted strings like %s",
>>>     "params": ["this"]
>>> }
class sentry.interfaces.query.Query(**data)[source]

A SQL query with an optional string describing the SQL driver, engine.

>>> {
>>>     "query": "SELECT 1"
>>>     "engine": "psycopg2"
>>> }

Table Of Contents

Related Topics

This Page