32 Commits

Author SHA1 Message Date
Christophe Bliard be23b6e89b Fix error when users table does not exist (#21482)
* Fix error when users table does not exist

In multitenant context, when schema is switched to and the tables are
not created yet, getting `User.current` will fail with

    ActiveRecord::StatementInvalid:"PG::UndefinedTable: ERROR:  relation \"users\" does not exist" [...]

To prevent it, check if the table exists first and return `nil` if not.

* Avoid logging "slow sql" for database creation

* Better performance for handling unexisting users table

Checking multiple times the users table existence when something is
logged is probably a bad idea. Better rescue errors.

Also cache the return value of `#current_user` to call the method only
once.
2025-12-18 15:12:26 +01:00
ulferts 3b2121f733 Revert "Merge remote-tracking branch 'origin/release/13.4' into dev"
This reverts commit 40b2bbeb09, reversing
changes made to b4c6cb17cc.
2024-03-21 11:31:17 +01:00
Ivan Kuchin 7787e457a3 Revert "Merge branch 'dev' into release/13.4"
This reverts commit a901541269, reversing
changes made to e573ca00b7.
2024-03-20 20:19:08 +01:00
Ivan Kuchin 9e4934cd0a change quotes using rubocop --only Style/StringLiterals,Style/QuotedSymbols -a 2024-03-20 18:05:22 +01:00
Oliver Günther 51730215b2 Remove sentry 2022-12-12 14:12:36 +01:00
ulferts 4a94e03b04 bump rubocop and apply autofixes for new cops 2022-10-21 22:29:12 +02:00
Christophe Bliard 48a4f1b6ad lint with rubocop --autocorrect (safe cops only) 2022-06-02 10:40:10 +02:00
ulferts 74904dfb0d Merge remote-tracking branch 'origin/release/11.4' into dev 2021-10-05 15:10:52 +02:00
Oliver Günther 42c5252d49 Use captureException for sentry
We already get an exception and backtrace, but there's no
well-documented way to add this to an event, so I suggest to use
captureException instead.

https://community.openproject.org/wp/39012
2021-10-04 18:59:59 +02:00
Wieland Lindenthal 5d782626a9 Merge remote-tracking branch 'origin/release/11.4' into dev 2021-09-17 16:29:42 +02:00
Oliver Günther 5cc73e2a80 Set a code_origin tag to all sentry usages to filter origin 2021-09-17 14:37:43 +02:00
Oliver Günther d748b967dd Fix using log extenders from sentry and core logger 2021-09-17 14:06:28 +02:00
Oliver Günther 3f0cf60d06 Allow logging with json formatter 2021-09-17 12:48:36 +02:00
ulferts 8ef6c1110c Merge branch 'release/11.3' into dev 2021-09-13 09:44:34 +02:00
Markus Kahl c000527b36 make sure to use plain hash to avoid argument error
which is likely in sentry_scope.set_context
2021-08-20 13:20:25 +01:00
Markus Kahl 300312ab6b add indifferent access for good measure 2021-08-20 12:39:12 +01:00
Markus Kahl 456522d23d make sure context is a hash 2021-08-20 12:32:08 +01:00
Markus Kahl 9ae5044f98 output swallowed logs failed to delegate; try fix (.to_h) 2021-08-20 12:24:29 +01:00
Oliver Günther a2244ca70a Render backtrace for debug log level through LogDelegator (#9475) 2021-07-19 11:37:48 +02:00
Oliver Günther dcfa0533ef Merge release/11.3 into dev 2021-06-09 08:58:46 +02:00
Markus Kahl eaf839df8a make sure log context is hash
rather than, say ActionController::Parameters
2021-06-08 14:50:22 +01:00
Oliver Günther 693d01f8c7 Bump Sentry and implement log handling in core (#9133)
* Bump Sentry and implement log handling in core

* Manually insert the sentry middlewares

* Also add user locale as tags

* Add performance tracing

* Update sentry host to sentry2

* Update frontend sentry-reporter to the new sdk

* Silence delayed_job's own logger since activejob logs already

Delayed::Job will otherwise always log all arguments, which we disable by design

* Remove default sentry host
2021-04-06 13:37:35 +02:00
Oliver Günther de0f155c94 Use ActiveSupport::Logger to support .silenced 2021-03-23 20:24:32 +01:00
ulferts 1bdd2ab9ae safe automatic fixes by rubocop (#8994) 2021-02-11 16:02:18 +01:00
Oliver Günther 8a8193fa15 Add info on thread and connection pool for timeouts errors
- Added to Rails controller request handling
- Added to API root to catch all api requests as well

Tested on sentry with both as https://sentry.openproject.com/sentry/localhost/issues/909/?query=is:unresolved
2019-08-28 14:52:16 +02:00
Oliver Günther 76cfef7df0 Add full exception backtrace to LogDelegator
[ci skip]
2019-07-04 13:47:01 +02:00
Oliver Günther f487fcacca [30092] Use delegated logger (sentry) for logged API errors 2019-04-29 08:27:51 +02:00
Oliver Günther 0d5f50395e [29253] Render error message in production on pending migrations
Creates a new warning bar (previously top-shelf item) that renders a
warning when migrations are pending. These did raise exceptions before
in production and would result in users running in internal errors due
to pending migration on some actions on the instance.

https://community.openproject.com/wp/29253
2019-04-24 07:45:09 +02:00
Oliver Günther fb8a600579 Add reporting for CSRF validation error 2019-01-22 15:50:07 +01:00
Oliver Günther 1ba8422a36 Add lograge and log delegator 2019-01-22 14:29:40 +01:00
Oliver Günther 14c6e82882 Create error handler and helper for streaming to multiple receivers 2019-01-22 13:33:58 +01:00
Oliver Günther 7152ce459b Use progress-bar and logging to stdout and file in textile conversion
[ci skip]
2018-08-28 11:37:19 +02:00