Files
gitea/routers/web/admin/stacktrace.go
T
silverwind 055105d42f fix(web): match settings page titles to the UI (#40336)
Many settings pages had a generic or missing title, so browser tabs and
history named the wrong page. Titles now use the active sidebar label,
or the page header on sub-pages, and are set once where several handlers
render the same page. The user and org webhook list headers print the
title, so they now read "Webhooks" instead of "Settings".

| Page | Before | After |
| --- | --- | --- |
| Runners, secrets, Actions general, admin job queue | Actions |
Runners, Secrets, General, Job queue |
| User and org webhooks, org options, 2FA enroll, account and keys after
a form error | Settings | Webhooks, Organization, Enroll in Two-Factor
Authentication, Account, SSH / GPG Keys |
| Admin self check, OAuth2 app edit, repo public access, repo LFS
pointer files | (none), owner/repo | Self Check, Edit OAuth2
Application, Public Access, Find pointer files |
| Admin trace, new branch protection rule, package cleanup rules |
Monitoring, Branch Protection -, Packages | Trace, Add New Rule,
Add/Edit Cleanup Rule, Cleanup Rule Preview |
| Admin webhook add and edit | Add/Update Webhook | Add/Update System
Webhook, Add/Update Default Webhook |
| Sidebar on admin queue, admin webhook edit, user OAuth2 app edit | no
highlight | Queues, Webhooks, Applications |

Assisted-by: Claude Code:claude-opus-5-5
2026-11-17 02:41:49 +00:00

54 lines
1.6 KiB
Go

// Copyright 2023 The Gitea Authors. All rights reserved.
// SPDX-License-Identifier: MIT
package admin
import (
"net/http"
"runtime"
"gitea.dev/modules/process"
"gitea.dev/modules/setting"
"gitea.dev/services/context"
)
func monitorTraceCommon(ctx *context.Context) {
ctx.Data["Title"] = ctx.Tr("admin.monitor.trace")
ctx.Data["PageIsAdminMonitorTrace"] = true
// Hide the performance trace tab in production, because it shows a lot of SQLs and is not that useful for end users.
// To avoid confusing end users, do not let them know this tab. End users should "download diagnosis report" instead.
ctx.Data["ShowAdminPerformanceTraceTab"] = !setting.IsProd
}
// Stacktrace show admin monitor goroutines page
func Stacktrace(ctx *context.Context) {
monitorTraceCommon(ctx)
ctx.Data["GoroutineCount"] = runtime.NumGoroutine()
show := ctx.FormString("show")
ctx.Data["ShowGoroutineList"] = show
// by default, do not do anything which might cause server errors, to avoid unnecessary 500 pages.
// this page is the entrance of the chance to collect diagnosis report.
if show != "" {
showNoSystem := show == "process"
processStacks, processCount, _, err := process.GetManager().ProcessStacktraces(false, showNoSystem)
if err != nil {
ctx.ServerErrorAuto(err)
return
}
ctx.Data["ProcessStacks"] = processStacks
ctx.Data["ProcessCount"] = processCount
}
ctx.HTML(http.StatusOK, tplStacktrace)
}
// StacktraceCancel cancels a process
func StacktraceCancel(ctx *context.Context) {
pid := ctx.PathParam("pid")
process.GetManager().Cancel(process.IDType(pid))
ctx.JSONRedirect(setting.AppSubURL + "/-/admin/monitor/stacktrace")
}