forgejo/modules
Gusted 93b19e3568
[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 89b1315338)
(cherry picked from commit edd8e66ce9)

[GITEA] Add slow SQL query warning (squash) document the setting

(cherry picked from commit ce38599c51)
(cherry picked from commit 794aa67c68)
(cherry picked from commit a4c2c6b004)
(cherry picked from commit 97912752bc)
(cherry picked from commit 00b5327c97)
(cherry picked from commit 1069c860e7)
(cherry picked from commit 84241f42c8)
(cherry picked from commit e4bda0e845)
(cherry picked from commit 7357fb91bf)
(cherry picked from commit a8dd7f6da2)
(cherry picked from commit e636e9f4be)
(cherry picked from commit bf04ae8603)
2024-01-08 16:52:44 +01:00
..
actions [CI] Search .forgejo/workflows first 2024-01-08 13:37:01 +01:00
activitypub
analyze
assetfs
auth [SECURITY] default to pbkdf2 with 320,000 iterations 2024-01-08 14:01:17 +01:00
avatar
base Refactor some legacy code and remove unused code (#28622) 2023-12-28 09:38:59 +00:00
cache
charset
container
context [SECURITY] Rework long-term authentication 2024-01-08 14:01:19 +01:00
contexttest
csv
doctor
emoji
eventsource
generate
git
gitgraph
graceful Suggest to use Type=simple for systemd service (#28717) 2024-01-07 15:18:04 +00:00
hcaptcha
highlight
hostmatcher
html
httpcache
httplib
indexer [CI] disable meilisearch/elasticsearch test, no server yet in CI 2024-01-08 13:37:01 +01:00
issue/template
json
label
lfs Do not set Accept header twice (#28598) 2023-12-28 03:59:00 +00:00
log
markup Make cross-reference issue links work in markdown documents again (#28682) 2024-01-03 14:01:12 +08:00
mcaptcha
metrics
migration
nosql
options
packages
paginator
pprof
private [CLI] implement forgejo-cli 2024-01-08 13:37:00 +01:00
process
proxy
proxyprotocol
public Refactor CORS handler (#28587) 2023-12-25 20:13:18 +08:00
queue [CI] disable redis test, no redis server yet in CI 2024-01-08 13:37:01 +01:00
recaptcha
references Make cross-reference issue links work in markdown documents again (#28682) 2024-01-03 14:01:12 +08:00
regexplru
repository
secret
session
setting [GITEA] Add slow SQL query warning 2024-01-08 16:52:44 +01:00
sitemap
ssh
storage [CI] Forgejo Actions based CI for PR & branches 2024-01-08 13:37:01 +01:00
structs [FEAT] allow setting the update date on issues and comments 2024-01-08 14:01:18 +01:00
svg
sync
system
templates
test
testlogger
timeutil Make template DateTime show proper tooltip (#28677) 2024-01-02 20:09:18 +01:00
translation
turnstile
typesniffer
updatechecker
upload
uri
user
util [DEADCODE] Add deadcode linter 2024-01-08 14:01:18 +01:00
validation [GITEA] add option for banning dots in usernames 2024-01-08 16:52:44 +01:00
web [GITEA] add option for banning dots in usernames 2024-01-08 16:52:44 +01:00
webhook