Improve agent job assignment logging (#3090)

* Improve agent job assignment logging

* add more agent logging

---------

Co-authored-by: Paul Wells <paulwe@gmail.com>
This commit is contained in:
David Zhao
2024-10-13 00:56:51 -07:00
committed by GitHub
co-authored by Paul Wells
parent 9147120915
commit 2d6aa049c9
2 changed files with 46 additions and 23 deletions
+12 -4
View File
@@ -360,7 +360,15 @@ func (w *Worker) AssignJob(ctx context.Context, job *livekit.Job) (*livekit.JobS
job.State.ParticipantIdentity = res.ParticipantIdentity
token, err := pagent.BuildAgentToken(w.apiKey, w.apiSecret, job.Room.Name, res.ParticipantIdentity, res.ParticipantName, res.ParticipantMetadata, w.Permissions)
token, err := pagent.BuildAgentToken(
w.apiKey,
w.apiSecret,
job.Room.Name,
res.ParticipantIdentity,
res.ParticipantName,
res.ParticipantMetadata,
w.Permissions,
)
if err != nil {
w.logger.Errorw("failed to build agent token", err)
return nil, err
@@ -438,7 +446,7 @@ func (w *Worker) Close() {
return
}
w.logger.Infow("closing worker")
w.logger.Infow("closing worker", "workerID", w.ID, "jobType", w.JobType, "agentName", w.AgentName)
close(w.closed)
w.cancel()
@@ -453,7 +461,7 @@ func (w *Worker) HandleAvailability(res *livekit.AvailabilityResponse) error {
jobID := livekit.JobID(res.JobId)
availCh, ok := w.availability[jobID]
if !ok {
w.logger.Warnw("received availability response for unknown job", nil, "jobId", jobID)
w.logger.Warnw("received availability response for unknown job", nil, "jobID", jobID)
return nil
}
@@ -519,7 +527,7 @@ func (w *Worker) HandleSimulateJob(simulate *livekit.SimulateJobRequest) error {
go func() {
_, err := w.AssignJob(w.ctx, job)
if err != nil {
w.logger.Errorw("unable to simulate job", err, "jobId", job.Id)
w.logger.Errorw("unable to simulate job", err, "jobID", job.Id)
}
}()