3374
historyResponse *historyservice.RecordActivityTaskStartedResponse,
3375
metricsHandler metrics.Handler,
3377
>
scheduledEvent := historyResponse.ScheduledEvent
3378
>
if scheduledEvent.GetActivityTaskScheduledEventAttributes() == nil {
3379
panic("GetActivityTaskScheduledEventAttributes is not set")
3380
}
3381
>
attributes := scheduledEvent.GetActivityTaskScheduledEventAttributes()
matching_engine.go
3382
>
if attributes.ActivityId == "" {
3383
panic("ActivityTaskScheduledEventAttributes.ActivityID is not set")
3384
}
3386
ct := timestamp.TimeValue(task.event.Data.CreateTime)
3387
metrics.AsyncMatchLatencyPerTaskQueue.With(metricsHandler).Record(time.Since(ct))
3388
}
3389
3391
>
activityAttemptStamp := int32(0)
3392
>
if len(componentRef) > 0 {
3393
activityAttemptStamp = task.event.Data.GetStamp()
3394
}
3395
3397
>
task.event.Data.GetNamespaceId(),
3398
>
task.event.Data.GetWorkflowId(),
3399
>
task.event.Data.GetRunId(),
3400
>
task.event.Data.GetScheduledEventId(),
3401
>
attributes.GetActivityId(),
3402
>
attributes.GetActivityType().GetName(),
3403
>
historyResponse.GetAttempt(),
3404
>
historyResponse.GetClock(),
3405
>
historyResponse.GetVersion(),
3406
>
historyResponse.GetStartVersion(),
3407
>
componentRef,
3408
>
activityAttemptStamp,
3409
>
)
3410
>
serializedToken, _ := e.tokenSerializer.Serialize(taskToken)
3411
>
3412
>
// This is here to ensure that this field is never nil as expected by the TS SDK.
3413
>
// This may happen if ScheduleActivityExecution was recorded in version 1.23.
3414
>
scheduleToCloseTimeout := attributes.ScheduleToCloseTimeout
3415
>
if scheduleToCloseTimeout == nil {
3416
scheduleToCloseTimeout = timestamp.DurationPtr(0)
3417
}
3418
3420
>
ActivityId: attributes.ActivityId,
3421
>
ActivityType: attributes.ActivityType,
3422
>
ActivityRunId: historyResponse.GetActivityRunId(),
3423
>
Header: attributes.Header,
3424
>
Input: attributes.Input,
3425
>
WorkflowExecution: task.workflowExecution(),
3426
>
CurrentAttemptScheduledTime: historyResponse.CurrentAttemptScheduledTime,
3427
>
ScheduledTime: scheduledEvent.EventTime,
3428
>
ScheduleToCloseTimeout: scheduleToCloseTimeout,
3429
>
StartedTime: historyResponse.StartedTime,
3430
>
StartToCloseTimeout: attributes.StartToCloseTimeout,
3431
>
HeartbeatTimeout: attributes.HeartbeatTimeout,
3432
>
TaskToken: serializedToken,
3433
>
Attempt: taskToken.Attempt,
3434
>
HeartbeatDetails: historyResponse.HeartbeatDetails,
3435
>
WorkflowType: historyResponse.WorkflowType,
3436
>
WorkflowNamespace: historyResponse.WorkflowNamespace,
3437
>
PollerScalingDecision: task.pollerScalingDecision,
3438
>
Priority: historyResponse.Priority,
3439
>
RetryPolicy: historyResponse.RetryPolicy,
3440
>
}
3441
}
3442