summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTheFox0x7 <thefox0x7@gmail.com>2024-03-31 00:03:38 +0100
committerTheFox0x7 <thefox0x7@gmail.com>2024-03-31 17:07:14 +0200
commitc8f515dff7fcac72f543bea2d27e8089ba7ddf6f (patch)
tree6fb62019dcb55fae79cde211d684f8a66e684ff2
parentMerge pull request '[BUG] Render emojis in labels in issue info popup' (#2888... (diff)
downloadforgejo-c8f515dff7fcac72f543bea2d27e8089ba7ddf6f.tar.xz
forgejo-c8f515dff7fcac72f543bea2d27e8089ba7ddf6f.zip
[FIX] make pprof labels conformant with prometheus spec
-rw-r--r--modules/graceful/manager.go6
-rw-r--r--modules/graceful/manager_common.go8
-rw-r--r--modules/graceful/manager_unix.go2
-rw-r--r--modules/graceful/manager_windows.go2
-rw-r--r--modules/process/manager.go4
5 files changed, 11 insertions, 11 deletions
diff --git a/modules/graceful/manager.go b/modules/graceful/manager.go
index 3f1115066a..077eac64f3 100644
--- a/modules/graceful/manager.go
+++ b/modules/graceful/manager.go
@@ -136,7 +136,7 @@ func (g *Manager) doShutdown() {
}
g.lock.Lock()
g.shutdownCtxCancel()
- atShutdownCtx := pprof.WithLabels(g.hammerCtx, pprof.Labels("graceful-lifecycle", "post-shutdown"))
+ atShutdownCtx := pprof.WithLabels(g.hammerCtx, pprof.Labels("gracefulLifecycle", "post-shutdown"))
pprof.SetGoroutineLabels(atShutdownCtx)
for _, fn := range g.toRunAtShutdown {
go fn()
@@ -167,7 +167,7 @@ func (g *Manager) doHammerTime(d time.Duration) {
default:
log.Warn("Setting Hammer condition")
g.hammerCtxCancel()
- atHammerCtx := pprof.WithLabels(g.terminateCtx, pprof.Labels("graceful-lifecycle", "post-hammer"))
+ atHammerCtx := pprof.WithLabels(g.terminateCtx, pprof.Labels("gracefulLifecycle", "post-hammer"))
pprof.SetGoroutineLabels(atHammerCtx)
}
g.lock.Unlock()
@@ -183,7 +183,7 @@ func (g *Manager) doTerminate() {
default:
log.Warn("Terminating")
g.terminateCtxCancel()
- atTerminateCtx := pprof.WithLabels(g.managerCtx, pprof.Labels("graceful-lifecycle", "post-terminate"))
+ atTerminateCtx := pprof.WithLabels(g.managerCtx, pprof.Labels("gracefulLifecycle", "post-terminate"))
pprof.SetGoroutineLabels(atTerminateCtx)
for _, fn := range g.toRunAtTerminate {
diff --git a/modules/graceful/manager_common.go b/modules/graceful/manager_common.go
index f6dbcc748d..892957e93f 100644
--- a/modules/graceful/manager_common.go
+++ b/modules/graceful/manager_common.go
@@ -65,10 +65,10 @@ func (g *Manager) prepare(ctx context.Context) {
g.hammerCtx, g.hammerCtxCancel = context.WithCancel(ctx)
g.managerCtx, g.managerCtxCancel = context.WithCancel(ctx)
- g.terminateCtx = pprof.WithLabels(g.terminateCtx, pprof.Labels("graceful-lifecycle", "with-terminate"))
- g.shutdownCtx = pprof.WithLabels(g.shutdownCtx, pprof.Labels("graceful-lifecycle", "with-shutdown"))
- g.hammerCtx = pprof.WithLabels(g.hammerCtx, pprof.Labels("graceful-lifecycle", "with-hammer"))
- g.managerCtx = pprof.WithLabels(g.managerCtx, pprof.Labels("graceful-lifecycle", "with-manager"))
+ g.terminateCtx = pprof.WithLabels(g.terminateCtx, pprof.Labels("gracefulLifecycle", "with-terminate"))
+ g.shutdownCtx = pprof.WithLabels(g.shutdownCtx, pprof.Labels("gracefulLifecycle", "with-shutdown"))
+ g.hammerCtx = pprof.WithLabels(g.hammerCtx, pprof.Labels("gracefulLifecycle", "with-hammer"))
+ g.managerCtx = pprof.WithLabels(g.managerCtx, pprof.Labels("gracefulLifecycle", "with-manager"))
if !g.setStateTransition(stateInit, stateRunning) {
panic("invalid graceful manager state: transition from init to running failed")
diff --git a/modules/graceful/manager_unix.go b/modules/graceful/manager_unix.go
index d03fff9b5b..931b0f1b62 100644
--- a/modules/graceful/manager_unix.go
+++ b/modules/graceful/manager_unix.go
@@ -44,7 +44,7 @@ func (g *Manager) notify(msg systemdNotifyMsg) {
}
func (g *Manager) start() {
- // Now label this and all goroutines created by this goroutine with the graceful-lifecycle manager
+ // Now label this and all goroutines created by this goroutine with the gracefulLifecycle manager
pprof.SetGoroutineLabels(g.managerCtx)
defer pprof.SetGoroutineLabels(g.ctx)
diff --git a/modules/graceful/manager_windows.go b/modules/graceful/manager_windows.go
index d776e0e9f9..bee44381db 100644
--- a/modules/graceful/manager_windows.go
+++ b/modules/graceful/manager_windows.go
@@ -29,7 +29,7 @@ const (
)
func (g *Manager) start() {
- // Now label this and all goroutines created by this goroutine with the graceful-lifecycle manager
+ // Now label this and all goroutines created by this goroutine with the gracefulLifecycle manager
pprof.SetGoroutineLabels(g.managerCtx)
defer pprof.SetGoroutineLabels(g.ctx)
diff --git a/modules/process/manager.go b/modules/process/manager.go
index 9c21f62152..150179d89b 100644
--- a/modules/process/manager.go
+++ b/modules/process/manager.go
@@ -26,7 +26,7 @@ var (
)
// DescriptionPProfLabel is a label set on goroutines that have a process attached
-const DescriptionPProfLabel = "process-description"
+const DescriptionPProfLabel = "processDescription"
// PIDPProfLabel is a label set on goroutines that have a process attached
const PIDPProfLabel = "pid"
@@ -35,7 +35,7 @@ const PIDPProfLabel = "pid"
const PPIDPProfLabel = "ppid"
// ProcessTypePProfLabel is a label set on goroutines that have a process attached
-const ProcessTypePProfLabel = "process-type"
+const ProcessTypePProfLabel = "processType"
// IDType is a pid type
type IDType string