Skip to content

feat(logger): report errors to Sentry when SENTRY_DSN is set - #49

Draft
juliusknorr wants to merge 3 commits into
mainfrom
feat/sentry-error-reporter
Draft

juliusknorr wants to merge 3 commits into
mainfrom
feat/sentry-error-reporter

Conversation

@juliusknorr

@juliusknorr juliusknorr commented Oct 1, 2026 •

Copy link
Copy Markdown
Member

Part of Euro-Office/DocumentServer#392 (stage 2).

  • Common/sources/reporters/sentry.js: log4js appender for level error+, @sentry/node 10
  • logger.js adds the appender when SENTRY_DSN is set (in code rather than via entrypoints, so pkg bundles it); disabled otherwise
  • Common/sources/reporters/index.js is the only entry point: init(service) initializes all backends, appenders() returns their log4js appenders. Adding a backend = one file plus one line there
  • Initialized first in DocService, FileConverter, SpellChecker, AdminPanel; events carry a service tag (docservice, converter, spellchecker, adminpanel)
  • Config via SENTRY_DSN, SENTRY_ENVIRONMENT, SENTRY_RELEASE (default documentserver@<version>)
  • Groups by format template, passes Error objects through
  • Tags tenant and docId from the log context (placeholders skipped); userId and Nextcloud ids follow in stage 3
  • Flushes on logger.shutdown. Unhandled rejections already reach the existing uncaughtException handlers (Node's default throw mode), so the SDK's own crash handlers are disabled. AdminPanel gets the same handler.
  • Scrubs token=/doc= query params, Authorization headers and bearer tokens; sendDefaultPii: false

Tested: unit test in tests/unit/sentryReporter.tests.js, plus a smoke run of the real SDK against a local sink (scrubbing, grouping and flush before exit).

AI-assisted, see Assisted-by trailer.

Refs Euro-Office/DocumentServer#392

Assisted-by: ClaudeCode:claude-opus-5-5
Signed-off-by: Julius Knorr <jus@bitgrid.net>
Assisted-by: ClaudeCode:claude-opus-5-5
Signed-off-by: Julius Knorr <jus@bitgrid.net>
Assisted-by: ClaudeCode:claude-opus-5-5
Signed-off-by: Julius Knorr <jus@bitgrid.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant