mirror of
1
Fork 0
forgejo/modules
Gusted 3eda6890e6
[GITEA] Add slow SQL query warning
- Databases are one of the most important parts of Forgejo, every
interaction with Forgejo uses the database in one way or another.
Therefore, it is important to maintain the database and recognize when
Forgejo is not doing well with the database. Forgejo already has the
option to log *every* SQL query along with its execution time, but
monitoring becomes impractical for larger instances and takes up
unnecessary storage in the logs.
- Add a QoL enhancement that allows instance administrators to specify a
threshold value beyond which query execution time is logged as a warning
in the xorm logger. The default value is a conservative five seconds to
avoid this becoming a source of spam in the logs.
- The use case for this patch is that with an instance the size of Codeberg, monitoring SQL logs is not very fruitful and most of them are uninteresting. Recently, in the context of persistent deadlock issues (https://codeberg.org/forgejo/forgejo/issues/220), I have noticed that certain queries hold locks on tables like comment and issue for several seconds. This patch helps to identify which queries these are and when they happen.
- Added unit test.

(cherry picked from commit 24bbe7886f)
(cherry picked from commit 6e29145b3c)
(cherry picked from commit 63731e3071)
(cherry picked from commit 3ce1a09736)
(cherry picked from commit a64426907d)
(cherry picked from commit 4b19215691)
(cherry picked from commit e635674435)
(cherry picked from commit 9cf501f1af)
(cherry picked from commit 0d6b934eba)
(cherry picked from commit 4b6c273879)
(cherry picked from commit b50517139c)
(cherry picked from commit 6546dd1fc9)
2023-10-30 14:44:20 +01:00
..
actions [CI] Search .forgejo/workflows first 2023-10-30 13:04:01 +01:00
activitypub
analyze
assetfs
auth [SECURITY] default to pbkdf2 with 320,000 iterations 2023-10-30 13:54:47 +01:00
avatar
base
cache
charset
container
context Add support for HEAD ref in /src/branch and /src/commit routes (#27384) (#27407) 2023-10-03 08:13:49 +00:00
contexttest
csv
doctor Add doctor dbconsistency fix to delete repos with no owner (#27290) (#27693) 2023-10-22 02:21:41 +02:00
emoji
eventsource More `db.DefaultContext` refactor (#27265) (#27347) 2023-09-29 13:35:01 +00:00
generate
git Fix git 2.11 error when checking IsEmpty (#27393) (#27397) 2023-10-02 22:36:18 +02:00
gitgraph More `db.DefaultContext` refactor (#27265) (#27347) 2023-09-29 13:35:01 +00:00
graceful
hcaptcha
highlight
hostmatcher Support allowed hosts for webhook to work with proxy (#27655) (#27675) 2023-10-18 15:07:52 +02:00
html
httpcache
httplib
indexer [CI] disable meilisearch/elasticsearch test, no server yet in CI 2023-10-30 13:04:01 +01:00
issue/template
json
label
lfs
log
markup
mcaptcha
metrics
migration
nosql
options
packages Close all hashed buffers (#27787) (#27790) 2023-10-25 22:24:25 +02:00
paginator
pprof
private [CLI] implement forgejo-cli 2023-10-30 13:04:01 +01:00
process
proxy
proxyprotocol
public
queue [CI] disable redis test, no redis server yet in CI 2023-10-30 13:04:01 +01:00
recaptcha
references
regexplru
repository Refactor system setting (#27000) (#27452) 2023-10-05 10:37:59 +00:00
secret
session
setting [GITEA] Add slow SQL query warning 2023-10-30 14:44:20 +01:00
sitemap
ssh
storage [CI] Forgejo Actions based CI for PR & branches 2023-10-30 13:04:01 +01:00
structs [v1.21] [FEAT] allow setting the update date on issues and comments 2023-10-30 13:54:48 +01:00
svg
sync
system
templates Fix label render containing invalid HTML (#27752) (#27762) 2023-10-24 09:39:13 +08:00
test
testlogger
timeutil
translation
turnstile
typesniffer
updatechecker
upload
uri
user
util
validation [GITEA] add option for banning dots in usernames 2023-10-30 14:44:20 +01:00
web [GITEA] add option for banning dots in usernames 2023-10-30 14:44:20 +01:00
webhook