diff --git a/sdk/hatchery/hatchery.go b/sdk/hatchery/hatchery.go index 1cc6d2fdcf..9ca8263c13 100644 --- a/sdk/hatchery/hatchery.go +++ b/sdk/hatchery/hatchery.go @@ -595,8 +595,8 @@ func SendSpawnInfo(ctx context.Context, h Interface, jobID int64, spawnMsg sdk.S func logStepInfo(ctx context.Context, step string, queued time.Time) { if id := ctx.Value(LogFieldJobID); id != nil { - ctx = context.WithValue(ctx, LogFieldJobStep, step) - ctx = context.WithValue(ctx, LogFieldJobStepDelay, time.Since(queued).Milliseconds()) + ctx = context.WithValue(ctx, LogFieldStep, step) + ctx = context.WithValue(ctx, LogFieldStepDelay, time.Since(queued).Nanoseconds()) log.Info(ctx, "step: %s job: %s", step, id) } } diff --git a/sdk/hatchery/starter.go b/sdk/hatchery/starter.go index bf22b86a79..03a25e61af 100644 --- a/sdk/hatchery/starter.go +++ b/sdk/hatchery/starter.go @@ -187,6 +187,14 @@ func spawnWorkerForJob(ctx context.Context, h Interface, j workerStarterRequest) ctx = context.WithValue(ctx, LogFieldWorkflow, arg.WorkflowName) ctx = context.WithValue(ctx, LogFieldNodeRun, arg.NodeRunName) + var serviceCount int + for i := range arg.Requirements { + if arg.Requirements[i].Type == sdk.ServiceRequirement { + serviceCount++ + } + } + ctx = context.WithValue(ctx, LogFieldServiceCount, serviceCount) + // Get a JWT to authentified the worker jwt, err := NewWorkerToken(h.Service().Name, h.GetPrivateKey(), time.Now().Add(1*time.Hour), arg) if err != nil { diff --git a/sdk/hatchery/types.go b/sdk/hatchery/types.go index b973e00b58..f90c13b8cd 100644 --- a/sdk/hatchery/types.go +++ b/sdk/hatchery/types.go @@ -28,21 +28,21 @@ const ( var ( LogFieldJobID = log.Field("action_metadata_job_id") - LogFieldJobStep = log.Field("hatchery_job_step") - LogFieldJobStepDelay = log.Field("hatchery_job_step_delay") + LogFieldStep = log.Field("hatchery_step") + LogFieldStepDelay = log.Field("hatchery_step_delay_num") LogFieldProjectID = log.Field("worker_project_id") LogFieldProject = log.Field("worker_project") LogFieldWorkflow = log.Field("worker_workflow") LogFieldNodeRunID = log.Field("worker_node_run_id") LogFieldNodeRun = log.Field("worker_node_run") LogFieldModel = log.Field("worker_model") - LogFieldServiceCount = log.Field("worker_service_count") + LogFieldServiceCount = log.Field("worker_service_count_num") ) func init() { log.RegisterField(LogFieldJobID) - log.RegisterField(LogFieldJobStep) - log.RegisterField(LogFieldJobStepDelay) + log.RegisterField(LogFieldStep) + log.RegisterField(LogFieldStepDelay) log.RegisterField(LogFieldProjectID) log.RegisterField(LogFieldProject) log.RegisterField(LogFieldWorkflow)