Skip to content

Commit 5f54404

Browse files
committed
Add more debug logging
1 parent cd41a35 commit 5f54404

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

internal/resource/nginx_instance_process_operator.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ func (p *NginxInstanceProcessOperator) FindParentProcessID(ctx context.Context,
7474
}
7575
processInstanceID := id.Generate("%s_%s_%s", info.ExePath, info.ConfPath, info.Prefix)
7676
if instanceID == processInstanceID {
77-
slog.DebugContext(ctx, "Found NGINX process ID", "process_id", processInstanceID)
77+
slog.DebugContext(ctx, "Found NGINX process ID", "instance_id", processInstanceID)
7878
return proc.PID, nil
7979
}
8080
}

internal/watcher/instance/nginx_process_parser.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,24 @@ func NewNginxProcessParser() *NginxProcessParser {
4848
//
4949
//nolint:revive // cognitive complexity of 20 because of the if statements in the for loop
5050
func (npp *NginxProcessParser) Parse(ctx context.Context, processes []*nginxprocess.Process) map[string]*mpi.Instance {
51+
slog.DebugContext(ctx, "Parsing NGINX processes", "number_of_processes", len(processes))
52+
5153
instanceMap := make(map[string]*mpi.Instance) // key is instanceID
5254
workers := make(map[int32][]*mpi.InstanceChild) // key is ppid of process
5355

5456
processesByPID := convertToMap(processes)
5557

5658
for _, proc := range processesByPID {
59+
slog.DebugContext(ctx, "NGINX process details",
60+
"ppid", proc.PPID,
61+
"pid", proc.PID,
62+
"name", proc.Name,
63+
"created", proc.Created,
64+
"status", proc.Status,
65+
"cmd", proc.Cmd,
66+
"exe", proc.Exe,
67+
)
68+
5769
if proc.IsWorker() {
5870
// Here we are determining if the worker process has a master
5971
if masterProcess, ok := processesByPID[proc.PPID]; ok {

0 commit comments

Comments
 (0)