The Tryton integration adds support for the Tryton Framework Server.


To configure the SDK, initialize it with the integration in a custom script:
import sentry_sdk
from sentry_sdk.integrations.trytond import TrytondWSGIIntegration

    # Set traces_sample_rate to 1.0 to capture 100%
    # of transactions for performance monitoring.

from trytond.application import app as application

# ...

In Tryton>=5.4 an error handler can be registered to respond the client with a custom error message including the Sentry event id instead of a traceback.
# ...

from trytond.exceptions import TrytonException, UserError

def _(app, request, e):
    if isinstance(e, TrytonException):
        event_id = sentry_sdk.last_event_id()
        data = UserError('Custom message', f'{event_id}\n{e}')
        return app.make_response(request, data)


  • The Sentry Python SDK will install the Tryton integration. The integration hooks to the TrytonWSGI class' instance.

  • All uncaught exceptions not inherited from Tryton exceptions are reported.

  • Request data is attached to all events: HTTP method, URL, headers, form data, JSON payloads. Sentry excludes raw bodies and multipart file uploads. Sentry also excludes personally identifiable information (such as user ids, usernames, cookies, authorization headers, IP addresses) unless you set send_default_pii to True.

Each request has a separate scope. Changes to the scope within a view, for example setting a tag, will only apply to events sent as part of the request being handled.

Supported Versions

  • Tryton: 4.6+
  • Python: 3.5+ (Tryton 4.6+), 3.6+ (Tryton 5.4+)
Help improve this content
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) to suggesting an update ("yeah, this would be better").