Repository navigation
Rewrite as a proper sentry_sdk ZopeIntegration (2.0) - #42
Merged
Merged
Conversation
jensens
marked this pull request as ready for review
September 21, 2026 13:18
gforcada
force-pushed
the
zope-integration
branch
from
September 22, 2026 10:07
f941e76 to
1bc1aee
Compare
gforcada
force-pushed
the
zope-integration
branch
from
September 22, 2026 12:26
1bc1aee to
91fdae6
Compare
gforcada
approved these changes
Sep 22, 2026
gforcada
left a comment
Member
There was a problem hiding this comment.
Quite a lenghty work!
I refactored the commits a bit to merge fix commits with their original commit but code is 100% the same 😄
Member
|
I did release it as |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Rewrite of collective.sentry as a proper
sentry_sdkintegration, as proposed in the RFC.Addresses #40
What changed
ZopeIntegration(integration.py):setup_once()wrapsZPublisher.WSGIPublisher.publish_modulewith a per-request isolation scope, attaches a lazy request-data event processor, sets the transaction name from the request path, and registers theIPubFailurecapture handler programmatically — no ZCML required, so plainsentry_sdk.init(..., integrations=[ZopeIntegration()])works on plain Zope.before_sendbelongs to the deployer again. Request enrichment moved from the client-globalbefore_sendhook to scope event processors, so user-side filtering is a plainsentry_sdk.initoption now.bootstrap.py): env-var bootstrap (SENTRY_DSN,SENTRY_ENVIRONMENT,SENTRY_PROJECT,SENTRY_DISABLE,SENTRY_INTEGRATIONS,SENTRY_MAX_LENGTH) that steps aside when the SDK is already initialized by the deployer.plone.apidependency dropped — plain Zope 5 is supported; Plone specifics (PAS user email, portalerror_log) are detected at runtime. Theerror_logignored-exceptions check is preserved for both the Zope root and Plone portals (resolved by acquisition).error_handler.pyis a deprecated BBB shim:before_sendanderrorRaisedSubscriberstay importable (withDeprecationWarning); the ZCML is intentionally empty.sentry_sdk.init()block from the 2022 merge is gone;SENTRY_INTEGRATIONSworks again;SENTRY_MAX_LENGTHmaps tomax_value_length(only when explicitly set — sdk-2.x'sutils.MAX_STRING_LENGTHno longer exists);SENTRY_OPTIONALis deprecated (a missing DSN just disables reporting, codifying the de-facto behavior since 2022); a broken extraction can no longer drop an event (each section is isolated, failures leave an{"error": ...}marker).Authorization,Cookie, …) are masked as[Filtered]unlesssend_default_piiis enabled — 1.x shipped the entire WSGI environ into every event.Compatibility notes (2.0.0)
extra["request"]["headers"]now carries proper header names instead of the raw environ.collective.sentry.error_handlerkeeps working for one major cycle (deprecated).Tests
Previously the package had no tests; the init path being untested is how the 2022 merge duplication went unnoticed.
tox -e zopeenv + CI workflow proving the package installs, imports and initializes without Plone.integration.py,extraction.py,capture.py,error_handler.pyat 100%,bootstrap.pyat 98%.tox -e lint(plone/meta pre-commit) green; towncrier news snippets included.Draft for now — happy to split, squash or adjust to maintainer preference.
🤖 Generated with Claude Code