gitea/modules
Earl Warren b748d62b46
Add slow SQL query warning (#27545)
- Databases are one of the most important parts of Forgejo, every
interaction uses the database in one way or another. Therefore, it is
important to maintain the database and recognize when the server is not
doing well with the database. There already is 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 9cf501f1af4cd870221cef6af489618785b71186)

---------

Co-authored-by: Gusted <postmaster@gusted.xyz>
Co-authored-by: Giteabot <teabot@gitea.io>
Co-authored-by: 6543 <6543@obermui.de>
2024-02-23 00:57:24 +00:00
..
actions Improve the `issue_comment` workflow trigger event (#29277) 2024-02-22 22:47:35 +08:00
activitypub Upgrade to golangci-lint@v1.55.0 (#27756) 2023-10-24 02:54:59 +00:00
analyze
assetfs Use `Set[Type]` instead of `map[Type]bool/struct{}`. (#26804) 2023-08-30 06:55:25 +00:00
auth Refactor locale&string&template related code (#29165) 2024-02-14 21:48:45 +00:00
avatar
base Use general token signing secret (#29205) 2024-02-18 17:39:04 +00:00
cache Always enable caches (#28527) 2023-12-19 09:29:05 +00:00
charset Refactor locale&string&template related code (#29165) 2024-02-14 21:48:45 +00:00
container
context Unify organizations header (#29248) 2024-02-23 01:24:57 +01:00
contexttest Improve user experience for outdated comments (#29050) 2024-02-08 01:50:48 +00:00
csv Refactor locale&string&template related code (#29165) 2024-02-14 21:48:45 +00:00
emoji
eventsource Final round of `db.DefaultContext` refactor (#27587) 2023-10-14 08:37:24 +00:00
generate Refactor JWT secret generating & decoding code (#29172) 2024-02-16 15:18:30 +00:00
git Discard unread data of `git cat-file` (#29297) 2024-02-22 03:48:19 +00:00
gitgraph More `db.DefaultContext` refactor (#27265) 2023-09-29 12:12:54 +00:00
gitrepo Simplify how git repositories are opened (#28937) 2024-01-27 21:09:51 +01:00
graceful Suggest to use Type=simple for systemd service (#28717) 2024-01-07 15:18:04 +00:00
hcaptcha
highlight Add option to disable ambiguous unicode characters detection (#28454) 2023-12-17 14:38:54 +00:00
hostmatcher Support allowed hosts for webhook to work with proxy (#27655) 2023-10-18 09:44:36 +00:00
html
httpcache Also match weakly validated ETags (#28957) 2024-01-29 16:18:40 +00:00
httplib
indexer fix: Elasticsearch: Request Entity Too Large #28117 (#29062) 2024-02-07 08:57:16 +00:00
issue/template
json
label
lfs Update tool dependencies (#29030) 2024-02-02 19:11:39 -05:00
log Reduce some allocations in type conversion (#26772) 2023-08-29 00:43:16 +08:00
markup Refactor markup rendering to accept general "protocol:" prefix (#29276) 2024-02-21 10:08:08 +00:00
mcaptcha
metrics Reduce usage of `db.DefaultContext` (#27073) 2023-09-14 17:09:32 +00:00
migration Refactor locale&string&template related code (#29165) 2024-02-14 21:48:45 +00:00
nosql
optional Unify user update methods (#28733) 2024-02-04 13:29:09 +00:00
options
packages Propagate install_if and provider_priority to APKINDEX (#28899) 2024-02-05 05:52:56 +00:00
paginator
pprof
private Return `responseText` instead of string in some functions (#28836) 2024-01-19 10:45:23 +08:00
process Replace assert.Fail with assert.FailNow (#27578) 2023-10-11 11:02:24 +00:00
proxy
proxyprotocol
public Refactor CORS handler (#28587) 2023-12-25 20:13:18 +08:00
queue Increase queue length (#27555) 2023-10-10 18:47:49 +08:00
recaptcha
references Add support for sha256 repositories (#23894) 2024-01-19 17:05:02 +01:00
regexplru
repository Ignore the linux anchor point to avoid linux migrate failure (#29295) 2024-02-22 17:40:53 +00:00
secret
session Next round of `db.DefaultContext` refactor (#27089) 2023-09-16 14:39:12 +00:00
setting Add slow SQL query warning (#27545) 2024-02-23 00:57:24 +00:00
sitemap
ssh Remove SSH workaround (#27893) 2023-11-03 15:21:05 +00:00
storage Fix object storage path handling (#27024) 2023-09-13 01:18:52 +00:00
structs Add merge style `fast-forward-only` (#28954) 2024-02-12 23:37:23 +01:00
svg
sync
system Replace more db.DefaultContext (#27628) 2023-10-15 17:46:06 +02:00
templates Refactor more code in templates (#29236) 2024-02-18 10:52:02 +01:00
test Move web/api context related testing function into a separate package (#26859) 2023-09-01 11:26:07 +00:00
testlogger
timeutil Refactor locale&string&template related code (#29165) 2024-02-14 21:48:45 +00:00
translation Improve TrHTML and add more tests (#29228) 2024-02-18 12:15:24 +00:00
turnstile
typesniffer
updatechecker Replace more db.DefaultContext (#27628) 2023-10-15 17:46:06 +02:00
upload
uri
user
util Refactor JWT secret generating & decoding code (#29172) 2024-02-16 15:18:30 +00:00
validation Check blocklist for emails when adding them to account (#26812) 2023-08-30 10:46:49 -05:00
web Refactor locale&string&template related code (#29165) 2024-02-14 21:48:45 +00:00
webhook Fix schedule tasks bugs (#28691) 2024-01-12 21:50:38 +00:00