Skip to content

Commit

Permalink
fix(hatchery): service name in metrics (#6724)
Browse files Browse the repository at this point in the history
Signed-off-by: Yvonnick Esnault <yvonnick.esnault@corp.ovh.com>
  • Loading branch information
yesnault authored Dec 7, 2023
1 parent 5e3bb1f commit cd9c0d6
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions sdk/hatchery/hatchery.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,10 @@ func Create(ctx context.Context, h Interface) error {
continue
}
currentCtx, currentCancel := context.WithTimeout(context.Background(), 10*time.Minute)
currentCtx = telemetry.ContextWithTag(currentCtx,
telemetry.TagServiceName, h.Name(),
telemetry.TagServiceType, h.Type(),
)
fields := log.FieldValues(ctx)
for k, v := range fields {
currentCtx = context.WithValue(currentCtx, k, v)
Expand Down Expand Up @@ -347,6 +351,10 @@ func Create(ctx context.Context, h Interface) error {

func handleJobV2(_ context.Context, h Interface, j sdk.V2WorkflowRunJob, cacheAttempts *CacheNbAttemptsJobIDs, workersStartChan chan<- workerStarterRequest) error {
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Minute)
ctx = telemetry.ContextWithTag(ctx,
telemetry.TagServiceName, h.Name(),
telemetry.TagServiceType, h.Type(),
)
ctx = telemetry.New(ctx, h, "hatchery.V2JobReceive", trace.AlwaysSample(), trace.SpanKindServer)
ctx, end := telemetry.Span(ctx, "hatchery.V2JobReceive", telemetry.Tag(telemetry.TagWorkflow, j.WorkflowName),
telemetry.Tag(telemetry.TagWorkflowRunNumber, j.RunNumber),
Expand Down

0 comments on commit cd9c0d6

Please sign in to comment.