Add job started attrs

This commit is contained in:
Yusuke Kuoka 2024-04-22 06:15:08 +00:00
parent 7bcc5c3448
commit fa819abbb5
1 changed files with 8 additions and 0 deletions

View File

@ -12,6 +12,7 @@ import (
jsonpatch "github.com/evanphx/json-patch"
"github.com/go-logr/logr"
"go.opentelemetry.io/otel"
"go.opentelemetry.io/otel/attribute"
kerrors "k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/types"
"k8s.io/client-go/kubernetes"
@ -100,6 +101,13 @@ func (w *Worker) HandleJobStarted(ctx context.Context, jobInfo *actions.JobStart
ctx, span := otel.Tracer("arc").Start(ctx, "Worker.HandleJobStarted")
defer span.End()
span.SetAttributes(
attribute.String("runner.name", jobInfo.RunnerName),
attribute.String("runner.repo.name", jobInfo.RepositoryName),
attribute.String("workflow.ref", jobInfo.JobWorkflowRef),
attribute.Int64("workflow.run.id", jobInfo.WorkflowRunId),
)
w.logger.Info("Updating job info for the runner",
"runnerName", jobInfo.RunnerName,
"ownerName", jobInfo.OwnerName,