add runner name in error message

This commit is contained in:
Michael Kuhnt 2024-11-22 10:32:13 +01:00
parent 237afdb25d
commit c5c74a8dfc

View file

@ -3,6 +3,7 @@ package sql
import (
"context"
"encoding/json"
"fmt"
"log/slog"
"github.com/google/uuid"
@ -84,7 +85,8 @@ func (s *sqlDatabase) paramsJobToWorkflowJob(ctx context.Context, job params.Job
if job.RunnerName != "" {
instance, err := s.getInstanceByName(s.ctx, job.RunnerName)
if err != nil {
slog.With(slog.Any("error", err)).ErrorContext(ctx, "failed to get instance by name")
// This usually is very normal as not all jobs run on our runners.
slog.DebugContext(ctx, fmt.Sprintf("failed to get instance by name: %s", job.RunnerName))
} else {
workflofJob.InstanceID = &instance.ID
}
@ -244,7 +246,8 @@ func (s *sqlDatabase) CreateOrUpdateJob(ctx context.Context, job params.Job) (pa
if err == nil {
workflowJob.InstanceID = &instance.ID
} else {
slog.With(slog.Any("error", err)).ErrorContext(ctx, "failed to get instance by name")
// This usually is very normal as not all jobs run on our runners.
slog.DebugContext(ctx, fmt.Sprintf("failed to get instance by name: %s", job.RunnerName))
}
}