diff options
author | wxiaoguang <wxiaoguang@gmail.com> | 2023-05-11 15:45:47 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-11 07:45:47 +0000 |
commit | 58dfaf3a75a097088376a9c221784b3675ac9c48 (patch) | |
tree | 62779d06087d0707b15f13e503c73a82300ef217 /templates/admin/stacktrace.tmpl | |
parent | b3af7484bc821d71cb20f6289f767119494bc81e (diff) | |
download | gitea-58dfaf3a75a097088376a9c221784b3675ac9c48.tar.gz gitea-58dfaf3a75a097088376a9c221784b3675ac9c48.zip |
Improve queue & process & stacktrace (#24636)
Although some features are mixed together in this PR, this PR is not
that large, and these features are all related.
Actually there are more than 70 lines are for a toy "test queue", so
this PR is quite simple.
Major features:
1. Allow site admin to clear a queue (remove all items in a queue)
* Because there is no transaction, the "unique queue" could be corrupted
in rare cases, that's unfixable.
* eg: the item is in the "set" but not in the "list", so the item would
never be able to be pushed into the queue.
* Now site admin could simply clear the queue, then everything becomes
correct, the lost items could be re-pushed into queue by future
operations.
3. Split the "admin/monitor" to separate pages
4. Allow to download diagnosis report
* In history, there were many users reporting that Gitea queue gets
stuck, or Gitea's CPU is 100%
* With diagnosis report, maintainers could know what happens clearly
The diagnosis report sample:
[gitea-diagnosis-20230510-192913.zip](https://github.com/go-gitea/gitea/files/11441346/gitea-diagnosis-20230510-192913.zip)
, use "go tool pprof profile.dat" to view the report.
Screenshots:



---------
Co-authored-by: Jason Song <i@wolfogre.com>
Co-authored-by: Giteabot <teabot@gitea.io>
Diffstat (limited to 'templates/admin/stacktrace.tmpl')
-rw-r--r-- | templates/admin/stacktrace.tmpl | 41 |
1 files changed, 30 insertions, 11 deletions
diff --git a/templates/admin/stacktrace.tmpl b/templates/admin/stacktrace.tmpl index 2ffb9982f2..46ad421587 100644 --- a/templates/admin/stacktrace.tmpl +++ b/templates/admin/stacktrace.tmpl @@ -1,19 +1,38 @@ {{template "admin/layout_head" (dict "ctxData" . "pageClass" "admin monitor")}} - <div class="admin-setting-content"> - <h4 class="ui top attached header"> - {{.locale.Tr "admin.monitor.stacktrace"}}: {{.locale.Tr "admin.monitor.goroutines" .GoroutineCount}} - <div class="ui right"> - <a class="ui primary tiny button" href="{{AppSubUrl}}/admin/monitor">{{.locale.Tr "admin.monitor"}}</a> +<div class="admin-setting-content"> + + <div class="gt-df gt-ac"> + <div class="gt-f1"> + <div class="ui compact small menu"> + <a class="{{if eq .ShowGoroutineList "process"}}active {{end}}item" href="{{.Link}}?show=process">{{.locale.Tr "admin.monitor.process"}}</a> + <a class="{{if eq .ShowGoroutineList "stacktrace"}}active {{end}}item" href="{{.Link}}?show=stacktrace">{{.locale.Tr "admin.monitor.stacktrace"}}</a> </div> - </h4> - <div class="ui attached segment"> - <div class="ui relaxed divided list"> - {{range .ProcessStacks}} - {{template "admin/stacktrace-row" dict "Process" . "root" $}} - {{end}} + </div> + <form target="_blank" action="{{AppSubUrl}}/admin/monitor/diagnosis" class="ui form"> + <div class="ui inline field"> + <button class="ui primary small button">{{.locale.Tr "admin.monitor.download_diagnosis_report"}}</button> + <input name="seconds" size="3" maxlength="3" value="10"> {{.locale.Tr "tool.raw_seconds"}} </div> + </form> + </div> + + <div class="ui divider"></div> + + <h4 class="ui top attached header"> + {{printf "%d Goroutines" .GoroutineCount}}{{/* Goroutine is non-translatable*/}} + {{- if .ProcessCount -}}, {{.locale.Tr "admin.monitor.processes_count" .ProcessCount}}{{- end -}} + </h4> + + {{if .ProcessStacks}} + <div class="ui attached segment"> + <div class="ui relaxed divided list"> + {{range .ProcessStacks}} + {{template "admin/stacktrace-row" dict "Process" . "root" $}} + {{end}} </div> </div> + {{end}} +</div> <div class="ui g-modal-confirm delete modal"> <div class="header"> |