collective.sentry
Sentry integration with Zope.
Quick start (zero config)
Install collective.sentry alongside your Zope/Plone instance and set:
SENTRY_DSN=https://<key>@<host>/<project-id>
Optional environment variables:
SENTRY_ENVIRONMENT — the environment tag (e.g. production).
SENTRY_PROJECT — set as tag project on every event.
SENTRY_DISABLE — set to disable Sentry entirely.
SENTRY_INTEGRATIONS — comma-separated dotted names of extra sentry-sdk integration classes (instantiated without arguments).
SENTRY_MAX_LENGTH — maps to sentry-sdk’s max_value_length; unset keeps the SDK default.
SENTRY_OPTIONAL — deprecated, ignored (a missing DSN just disables reporting).
In Plone the package is picked up automatically (z3c.autoinclude). On plain Zope, import the package once at startup, e.g. from the WSGI module:
import collective.sentry # noqa: F401
Own initialization (filtering etc.)
The env-var bootstrap steps aside when the SDK is already initialized, so you can call sentry_sdk.init() yourself — for example to filter scanner noise with before_send, which since 2.0 belongs to you:
import sentry_sdk
from collective.sentry import ZopeIntegration
def drop_scanner_noise(event, hint):
# your filtering logic
return event
sentry_sdk.init(
dsn="...",
integrations=[ZopeIntegration()],
before_send=drop_scanner_noise,
ignore_errors=[KeyboardInterrupt],
)
Run this before Zope loads the package ZCML (policy package module level, or a paste filter in wsgi.ini).
What gets reported
Unhandled publisher exceptions (via IPubFailure) and logging errors, enriched per request with form data, cookies, lazy items, request info and the authenticated user (email included when the user has PAS properties, i.e. always in Plone). Passwords are filtered. Exception types listed as ignored in the site’s error_log are not reported.
Migrating from 1.x
before_send is no longer occupied by this package; wrappers around collective.sentry.error_handler.before_send can be replaced by a plain before_send passed to your own sentry_sdk.init().
collective.sentry.error_handler is deprecated (works, warns).
SENTRY_INTEGRATIONS works again (it was silently broken since 1.x/2022).
SENTRY_MAX_LENGTH now only applies when explicitly set.
plone.api is no longer a dependency; plain Zope 5 is supported.
Transaction names are now the request path — review Sentry alert rules that filter on transaction.
The deprecated error_handler.before_send shim only enriches — the error_log ignore check moved to the capture path (relevant only if you call the shim directly).
extra["request"]["headers"] now contains proper header names (HTTP_* transformed, non-header environ keys dropped, sensitive headers filtered) instead of the raw WSGI environ.
2.0.0 (2026-09-23)
Breaking changes:
Rewrite as a proper sentry_sdk ZopeIntegration: per-request isolation scope with lazy enrichment, before_send freed for deployers, plone.api dependency dropped (plain Zope 5 supported), error_handler deprecated as BBB shim. SENTRY_MAX_LENGTH now only applies when explicitly set; SENTRY_OPTIONAL is deprecated and ignored. [jensens] (#40)
New features:
Env-var bootstrap yields to a deployer’s own sentry_sdk.init(); SENTRY_INTEGRATIONS works again (silently broken since 2022, #40). [jensens] (#40)
Tests:
Add unit and Plone functional test suites, plus a Zope-only tox env and CI job proving the package runs without Plone. [jensens] (#40)
Changelog
1.0.0 (2026-06-17)
Breaking changes:
Drop support for Plone 5.2 and Python 3.8. (#28)
Replace pkg_resources namespace with PEP 420 native namespace. Support only Plone 6.2 and Python 3.10+. (#3928)
Bug fixes:
Handle non exceptions that caused a traceback @gforcada (#29)
Internal:
Update configuration files. Move to src-layout. [plone devs]
0.3.3 (unreleased)
Nothing changed yet.
0.3.2 (2023-11-07)
Fix SENTRY_MAX_LENGTH default value again. [Lunga001]
0.3.1 (2023-10-11)
Fix SENTRY_MAX_LENGTH default value. [folix-01]
0.3.0 (2022-10-06)
Add environment var to disable sentry integration. [krissik]
0.2.6 (2022-07-28)
Fix a problem on errorRaisedSubscriber function that was missing the exc_info variable. [thomasmassmann]
0.2.5 (2022/07/26)
Add optional environment parameter for Sentry integrations (“SENTRY_INTEGRATIONS”, comma separated list) [2silver]
Ensure all exceptions which should be ignored are actually ignored before sending them. [thomasmassmann]
0.2.4 (2020/09/07)
Ignore exceptions that are ignored in the root Zope error_log. [maurits]
0.2.3 (2020/08/05)
Fix error handling on zope site root [krissik]
0.2.2 (2020/07/13)
Add check with error_log ignored_exceptions before send exceptions to sentry [eikichi18]
0.2.1 (2020/07/08)
Add SENTRY_ENVIRONMENT option. [fulv]
0.2.0 (2019/11/28)
Add optional environment parameter to set max length of stacktrace (“SENTRY_MAX_LENGTH”, default is 512) [Thokas]
0.1.7 (2019/10/21)
Make collective.sentry configuration optional (do not load if no SENTRY_DSN) [kiorky]
0.1 (2019/08/15)
initial release
Contributors
Andreas Jung <info@zopyx.com>
Thomas Kastenholz <github@kronix.eu>
Release files for collective.sentry 2.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| collective_sentry-2.0.0.tar.gz | 20.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| collective_sentry-2.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 41.8 kB
Release files / collective_sentry-2.0.0.tar.gz
| Download URL | collective_sentry-2.0.0.tar.gz |
|---|---|
| Size | 20.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
49334d6aaf35e8337d7e7dac0e4e5e024c87b274694bf574e9bb1e8f28a34768
|
|
BLAKE2b-256 checksum How to use checksums |
d27f490a8f7adcde49ed47d547de2d39f73a7798a75d68440ca867d6e6f2ae96
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|
Release files / collective_sentry-2.0.0-py3-none-any.whl
| Download URL | collective_sentry-2.0.0-py3-none-any.whl |
|---|---|
| Size | 21.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e70dbf78adeacae095517556c3aa9182d4fa4fb37ff9855a046f4acf499c231b
|
|
BLAKE2b-256 checksum How to use checksums |
1df22cf8fb446ea3027a9dc52697fc3ad8922f27c38abff4de852f4829da2955
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|