Tryton
Learn aboutn using Sentry with Tryton.
The Tryton integration adds support for the Tryton Framework Server.
To configure the SDK, initialize it with the integration in a custom wsgi.py
script:
In addition to capturing errors, you can monitor interactions between multiple services or applications by enabling tracing. You can also collect and analyze performance profiles from real users with profiling.
Select which Sentry features you'd like to install in addition to Error Monitoring to get the corresponding installation and configuration instructions below.
wsgi.py
# wsgi.py
import sentry_sdk
from sentry_sdk.integrations.trytond import TrytondWSGIIntegration
sentry_sdk.init(
dsn="https://examplePublicKey@o0.ingest.sentry.io/0",
# Set traces_sample_rate to 1.0 to capture 100%
# of transactions for tracing.
traces_sample_rate=1.0,
# Set profiles_sample_rate to 1.0 to profile 100%
# of sampled transactions.
# We recommend adjusting this value in production.
profiles_sample_rate=1.0,
integrations=[
TrytondWSGIIntegration(),
],
)
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.
wsgi.py
# wsgi.py
# ...
from trytond.exceptions import TrytonException, UserError
@application.error_handler
def _(app, request, e):
if isinstance(e, TrytonException):
return
else:
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
toTrue
.
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.
- Tryton: 4.6+
- Python: 3.6+
The versions above apply for Sentry Python SDK version 2.0+
, which drops support for some legacy Python and framework versions. If you're looking to use Sentry with older Python or framework versions, consider using an SDK version from the 1.x
major line of releases.
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) or suggesting an update ("yeah, this would be better").