[18.0][ADD] sentry_client: browser-side Sentry SDK for the web client - #3627
[18.0][ADD] sentry_client: browser-side Sentry SDK for the web client#3627dnplkndll wants to merge 1 commit into
Conversation
91d7713 to
0d828a8
Compare
|
I think you guys had some contributions on sentry. how does this look? I was actually going to look into if there might be some way to use the data on an instances use to build roles and skills for agents or just keeping process documentation up to date. I created a drop in seer app that runs the lower cost 3.5-flash to keep costs down on error fixes as well. need more use to verify. |
0d828a8 to
3a41da8
Compare
ChristophAbenthungCibex
left a comment
There was a problem hiding this comment.
@dnplkndll Thx for this feature. This is really useful. Overall it looks pretty good.
Minor remarks:
- The fallback to the config file won't work like this in v18. According to the readme of the sentry module it is configured in the options sections (https://github.com/OCA/server-tools/tree/18.0/sentry#example-odoo-configuration). As far as I am aware the sentry section got added at v19.
- The "Report a bug" systray icon is display incorrect/weird. Furthermore, I'm not sure that the bug is the best icon choice because the debug mode systray icon is exactly the same. Maybe there is a better option? If not fine by me because most user won't be affected.
good points. I noticed the same odd positioning on the icon and will try to find a better one to differentiate. I will check the 19.0 issue. I did start it there then thought the ADD on 18. would be better at the time. |
3a41da8 to
bbf5f10
Compare
ChristophAbenthungCibex
left a comment
There was a problem hiding this comment.
Thx for the changes. LGTM 👍
|
@dnplkndll Wow, I was building the same thing on my side to contribute to OCA and didn't check the open PRs first. Nice module, very complete as a separate addon, I hope it gets merged soon. Two questions on the design, to understand it better, not to argue. You best practice to keep the projects seperate is good and I missed that on my part to read up:
Differences in my implementation that might be useful for yours:
I installed the branch next to the server-side sentry module (Python mode, shared project) and triggered errors:
Returning early in sentryHandler for RPCError / ConnectionLostError / SessionExpiredError (those are the server's job, maybe leave a breadcrumb), and marking the error for the onerror path as well, would fix both while keeping the OWL context capture. Two smaller things from the same test:
I'll keep testing against my project and drop my browser code from the fork if it holds up. Looking forward to your feedback. |
1f89cd7 to
f750ec6
Compare
if you want to record a review I think we need 2. |
f750ec6 to
7c5d4f9
Compare
…nfig Backport of the 19.0 module (OCA#3622) to 18.0. Identical feature set; only the API surfaces that changed between series are adapted: - `user.all_group_ids` (19.0) → `user.groups_id` (18.0). 19.0 split the groups field into a stored direct collection plus a computed transitive closure; on 18.0 `groups_id` already returns the full set. - `group.privilege_id.category_id` (19.0) → `group.category_id` (18.0). 19.0 introduced the privilege layer between groups and categories; on 18.0 groups carry the category directly. - Config-file fallback reads the top-level `sentry_*` options from odoo.conf's `[options]` section — the layout the server-side `sentry` module actually uses on 18.0 (the dedicated `[sentry]` section only exists from 19.0). - Manifest version `18.0.1.0.0`. Everything else — Connection UI block (Browser DSN / Environment / Release) with odoo.conf fallback, four tier toggles with sample-rate knobs, vendored Sentry SDK under `static/lib`, the `error_handlers` registry entry as the single backend capture path, per-tab UUID + `workflow_id` + `surface` tags, per-user replay opt-out, and the public `/sentry_client/config.json` endpoint — ports verbatim. The OWL `error_handlers` registry, settings `<block>`/`<setting>` pattern, and asset bundle keys are identical between 18.0 and 19.0. The systray feedback launcher is an `o_nav_entry` button with `fa-bullhorn` (Sentry's own feedback iconography) — deliberately not `fa-bug`, which is the debug-mode systray icon beside it. Assisted-by: Claude Fable 5 Assisted-by: Claude Opus 5
7c5d4f9 to
bebad7d
Compare
New module: a browser-side companion to the OCA
sentryPython module.Loads the Sentry browser SDK into the Odoo web client and reports
uncaught JS errors, optional performance traces, session replays on
error, and a user-feedback widget — all toggleable per tier under
Settings → General Settings → Sentry Browser Monitoring.
Browser DSN, environment, and release are settable via the UI
(
ir.config_parametersentry_client.{browser_dsn,environment,release}).Empty UI values fall back to the
sentry_*options inodoo.conf(thekeys the server-side module reads on 18.0) so a
single-project deployment shared with the server-side
sentrymodulekeeps working without UI clicks. Matches Sentry's recommended
one-project-per-platform setup when the values are split.
Lead PR for the module; 19.0 port at
#3622 (DRAFT,
[19.0][MIG]— cherry-pick of this commit plus three API adaptations).Non-mechanical adaptations worth flagging
every window error and unhandled rejection through the
@web/core/error_handlersregistry, so the module registers one entrythere and leaves the SDK's own capture integrations (
GlobalHandlers,BrowserApiErrors,TryCatch) out of the defaults whenever thatservice is in the bundle. One event per crash, capturing the wrapping
error so
LinkedErrorsexpands.causein place; OWL crashes carrythe component tree in
extra.component_tree. Server-side errors(
RPCErrorincl. session expiry, connection lost/aborted, request toolarge) are the server-side
sentrymodule's job: they leave anodoo.rpcbreadcrumb and flush the buffered session replay instead ofproducing a browser event. Returns
falseso Odoo's own Oops! dialogstill renders alongside. Portal/website pages have no error service and
keep the SDK defaults.
/sentry_client/config.jsonendpoint isauth="public"onpurpose — the loader runs on portal/login pages before auth. Only
behaviour flags and the numeric uid leave the server; email and name
are read client-side from
window.odoo.session_info(already gated bythe session cookie). The DSN is served without any legacy
:<secret>component, whichever source it comes from.
Even with Tier 2 enabled DB-wide, an opted-out user's Replay
integration never registers, so no DOM observer runs for them.
tab_id(sessionStorage-persistedUUID),
workflow_id(<action_id>|<model>|<view_type>), and thesurfacetag ship on every event so downstream harvesting can split auser's parallel windows into distinct streams.
surfacetag classifies the source of every browser event:backend(/odoo,/web),portal(/my), orfrontend(publicwebsite). Lets Sentry queries filter cleanly when both browser and
Python ship to the same project —
environmentdistinguishesPython vs JS,
surfacedistinguishes browser sub-streams.bundle.tracing.feedback.min.js; the controller's_bundle_namehelper falls back to
bundle.tracing.replay.feedback.min.jsfor thatcombination — extra replay code is inert without the integration
registered.
static/lib/sentry/<version>/with a refreshscript that SRI-verifies each bundle against Sentry's published
hashes. Browser loads from the same origin as Odoo — air-gap safe.
Verified on the runboat preview with all four tiers + a test DSN — browser events land tagged by
environment(Python vs JS) andsurface(backend / portal / frontend) for clean query separation.AI-assisted (Claude Code); every change reviewed, tested, and owned by the author.