logging and debugging

This commit is contained in:
Chris Lu
2026-02-04 12:44:52 -08:00
parent bd4e7ff14e
commit 000e2bd4a9
8 changed files with 37 additions and 17 deletions

View File

@@ -524,7 +524,7 @@ func handleIncoming(
// Route message to general handler.
select {
case incoming <- msg:
glog.V(3).Infof("[session %s] Message routed to incoming channel", sessionID)
glog.V(4).Infof("[session %s] Message routed to incoming channel", sessionID)
case <-time.After(time.Second):
glog.Warningf("[session %s] Incoming message buffer full, dropping message: %T", sessionID, msg.Message)
}
@@ -825,21 +825,21 @@ func (c *GrpcAdminClient) RequestTask(workerID string, capabilities []types.Task
select {
case c.outgoing <- msg:
glog.V(3).Infof("TASK REQUEST SENT: Worker %s successfully sent task request to admin server", workerID)
glog.V(4).Infof("TASK REQUEST SENT: Worker %s successfully sent task request to admin server", workerID)
case <-time.After(time.Second):
glog.Errorf("TASK REQUEST TIMEOUT: Worker %s failed to send task request: timeout", workerID)
return nil, fmt.Errorf("failed to send task request: timeout")
}
// Wait for task assignment
glog.V(3).Infof("WAITING FOR RESPONSE: Worker %s waiting for task assignment response (30s timeout)", workerID)
glog.V(4).Infof("WAITING FOR RESPONSE: Worker %s waiting for task assignment response (30s timeout)", workerID)
timeout := time.NewTimer(30 * time.Second)
defer timeout.Stop()
for {
select {
case response := <-c.incoming:
glog.V(3).Infof("RESPONSE RECEIVED: Worker %s received response from admin server: %T", workerID, response.Message)
glog.V(4).Infof("RESPONSE RECEIVED: Worker %s received response from admin server: %T", workerID, response.Message)
if taskAssign := response.GetTaskAssignment(); taskAssign != nil {
// Validate TaskId is not empty before processing
if taskAssign.TaskId == "" {
@@ -865,10 +865,10 @@ func (c *GrpcAdminClient) RequestTask(workerID string, capabilities []types.Task
}
return task, nil
} else {
glog.V(3).Infof("NON-TASK RESPONSE: Worker %s received non-task response: %T", workerID, response.Message)
glog.V(4).Infof("NON-TASK RESPONSE: Worker %s received non-task response: %T", workerID, response.Message)
}
case <-timeout.C:
glog.V(3).Infof("TASK REQUEST TIMEOUT: Worker %s - no task assignment received within 30 seconds", workerID)
glog.V(4).Infof("TASK REQUEST TIMEOUT: Worker %s - no task assignment received within 30 seconds", workerID)
return nil, nil // No task available
}
}

View File

@@ -799,7 +799,7 @@ func (w *Worker) requestTasks() {
}
if w.getAdmin() != nil {
glog.V(3).Infof("REQUESTING TASK: Worker %s requesting task from admin server (current load: %d/%d, capabilities: %v)",
glog.V(4).Infof("REQUESTING TASK: Worker %s requesting task from admin server (current load: %d/%d, capabilities: %v)",
w.id, currentLoad, w.config.MaxConcurrent, w.config.Capabilities)
task, err := w.getAdmin().RequestTask(w.id, w.config.Capabilities)
@@ -815,7 +815,7 @@ func (w *Worker) requestTasks() {
glog.Errorf("TASK HANDLING FAILED: Worker %s failed to handle task %s: %v", w.id, task.ID, err)
}
} else {
glog.V(3).Infof("NO TASK AVAILABLE: Worker %s - admin server has no tasks available", w.id)
glog.V(4).Infof("NO TASK AVAILABLE: Worker %s - admin server has no tasks available", w.id)
}
}
}
@@ -868,7 +868,7 @@ func (w *Worker) connectionMonitorLoop() {
lastConnectionStatus = currentConnectionStatus
} else {
if currentConnectionStatus {
glog.V(3).Infof("CONNECTION OK: Worker %s connection status: connected", w.id)
glog.V(4).Infof("CONNECTION OK: Worker %s connection status: connected", w.id)
} else {
glog.V(1).Infof("CONNECTION DOWN: Worker %s connection status: disconnected, reconnection in progress", w.id)
}
@@ -926,10 +926,10 @@ func (w *Worker) messageProcessingLoop() {
return
case message := <-incomingChan:
if message != nil {
glog.V(3).Infof("MESSAGE PROCESSING: Worker %s processing incoming message", w.id)
glog.V(4).Infof("MESSAGE PROCESSING: Worker %s processing incoming message", w.id)
w.processAdminMessage(message)
} else {
glog.V(3).Infof("NULL MESSAGE: Worker %s received nil message", w.id)
glog.V(4).Infof("NULL MESSAGE: Worker %s received nil message", w.id)
}
}
}
@@ -952,7 +952,7 @@ func (w *Worker) processAdminMessage(message *worker_pb.AdminMessage) {
case *worker_pb.AdminMessage_TaskAssignment:
taskAssign := msg.TaskAssignment
if taskAssign.TaskId == "" {
glog.V(1).Infof("Worker %s received empty task assignment, going to sleep", w.id)
glog.V(4).Infof("Worker %s received empty task assignment, going to sleep", w.id)
return
}
glog.V(1).Infof("Worker %s received direct task assignment %s (type: %s, volume: %d)",