mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-10-31 21:28:11 +09:00 
			
		
		
		
	Refactor pprof labels and process desc (#32909)
* Deprecate "gopid" in log, it is not useful and requires very hacky approach * Remove "git.Command.SetDescription" because it is not useful and only makes the logs too flexible
This commit is contained in:
		| @@ -11,6 +11,8 @@ import ( | ||||
| 	"sync" | ||||
| 	"sync/atomic" | ||||
| 	"time" | ||||
|  | ||||
| 	"code.gitea.io/gitea/modules/gtprof" | ||||
| ) | ||||
|  | ||||
| // TODO: This packages still uses a singleton for the Manager. | ||||
| @@ -25,18 +27,6 @@ var ( | ||||
| 	DefaultContext = context.Background() | ||||
| ) | ||||
|  | ||||
| // DescriptionPProfLabel is a label set on goroutines that have a process attached | ||||
| const DescriptionPProfLabel = "process_description" | ||||
|  | ||||
| // PIDPProfLabel is a label set on goroutines that have a process attached | ||||
| const PIDPProfLabel = "pid" | ||||
|  | ||||
| // PPIDPProfLabel is a label set on goroutines that have a process attached | ||||
| const PPIDPProfLabel = "ppid" | ||||
|  | ||||
| // ProcessTypePProfLabel is a label set on goroutines that have a process attached | ||||
| const ProcessTypePProfLabel = "process_type" | ||||
|  | ||||
| // IDType is a pid type | ||||
| type IDType string | ||||
|  | ||||
| @@ -187,7 +177,12 @@ func (pm *Manager) Add(ctx context.Context, description string, cancel context.C | ||||
|  | ||||
| 	Trace(true, pid, description, parentPID, processType) | ||||
|  | ||||
| 	pprofCtx := pprof.WithLabels(ctx, pprof.Labels(DescriptionPProfLabel, description, PPIDPProfLabel, string(parentPID), PIDPProfLabel, string(pid), ProcessTypePProfLabel, processType)) | ||||
| 	pprofCtx := pprof.WithLabels(ctx, pprof.Labels( | ||||
| 		gtprof.LabelProcessDescription, description, | ||||
| 		gtprof.LabelPpid, string(parentPID), | ||||
| 		gtprof.LabelPid, string(pid), | ||||
| 		gtprof.LabelProcessType, processType, | ||||
| 	)) | ||||
| 	if currentlyRunning { | ||||
| 		pprof.SetGoroutineLabels(pprofCtx) | ||||
| 	} | ||||
|   | ||||
		Reference in New Issue
	
	Block a user