@@ -958,51 +958,6 @@ func createNexusOperationFailure(operation Operation, scheduledEventID int64, ca
958958 }
959959}
960960
961- // invocationTraceContext captures per-call contextual information used for HTTP tracing and failure logging.
962- type invocationTraceContext struct {
963- operationTag string // "StartOperation" or "CancelOperation"
964- namespaceName string // source (caller) namespace
965- targetNamespaceID string
966- requestID string
967- operation string
968- endpointName string
969- workflowID string
970- runID string
971- attemptStart time.Time
972- attempt int32
973- }
974-
975- // tags returns the structured log tags describing the call.
976- func (c invocationTraceContext ) tags () []tag.Tag {
977- return []tag.Tag {
978- tag .Operation (c .operationTag ),
979- tag .WorkflowNamespace (c .namespaceName ),
980- tag .NexusEndpointTargetNamespaceID (c .targetNamespaceID ),
981- tag .RequestID (c .requestID ),
982- tag .NexusOperation (c .operation ),
983- tag .Endpoint (c .endpointName ),
984- tag .WorkflowID (c .workflowID ),
985- tag .WorkflowRunID (c .runID ),
986- tag .AttemptStart (c .attemptStart ),
987- tag .Attempt (c .attempt ),
988- }
989- }
990-
991- // logCallFailure logs a failed outbound Nexus call.
992- func (e taskExecutor ) logCallFailure (traceCtx invocationTraceContext , callErr error , failureSource string ) {
993- if callErr == nil {
994- return
995- }
996- tags := append (traceCtx .tags (), tag .Error (callErr ))
997- msg := fmt .Sprintf ("Nexus %s request failed" , traceCtx .operationTag )
998- _ , isTimeoutBelowMin := errors.AsType [* operationTimeoutBelowMinError ](callErr )
999- if failureSource == commonnexus .FailureSourceWorker || isTimeoutBelowMin {
1000- e .Logger .Debug (msg , tags ... )
1001- } else {
1002- e .Logger .Error (msg , tags ... )
1003- }
1004- }
1005-
1006961func startCallOutcomeTag (callCtx context.Context , result * nexusrpc.ClientStartOperationResponse [* commonpb.Payload ], callErr error ) string {
1007962
1008963 if callErr != nil {
@@ -1064,6 +1019,51 @@ func cancelCallOutcomeTag(callCtx context.Context, callErr error) string {
10641019 return "successful"
10651020}
10661021
1022+ // invocationTraceContext captures per-call contextual information used for HTTP tracing and failure logging.
1023+ type invocationTraceContext struct {
1024+ operationTag string // "StartOperation" or "CancelOperation"
1025+ namespaceName string // source (caller) namespace
1026+ targetNamespaceID string
1027+ requestID string
1028+ operation string
1029+ endpointName string
1030+ workflowID string
1031+ runID string
1032+ attemptStart time.Time
1033+ attempt int32
1034+ }
1035+
1036+ // tags returns the structured log tags describing the call.
1037+ func (c invocationTraceContext ) tags () []tag.Tag {
1038+ return []tag.Tag {
1039+ tag .Operation (c .operationTag ),
1040+ tag .WorkflowNamespace (c .namespaceName ),
1041+ tag .NexusEndpointTargetNamespaceID (c .targetNamespaceID ),
1042+ tag .RequestID (c .requestID ),
1043+ tag .NexusOperation (c .operation ),
1044+ tag .Endpoint (c .endpointName ),
1045+ tag .WorkflowID (c .workflowID ),
1046+ tag .WorkflowRunID (c .runID ),
1047+ tag .AttemptStart (c .attemptStart ),
1048+ tag .Attempt (c .attempt ),
1049+ }
1050+ }
1051+
1052+ // logCallFailure logs a failed outbound Nexus call.
1053+ func (e taskExecutor ) logCallFailure (traceCtx invocationTraceContext , callErr error , failureSource string ) {
1054+ if callErr == nil {
1055+ return
1056+ }
1057+ tags := append (traceCtx .tags (), tag .Error (callErr ))
1058+ msg := fmt .Sprintf ("Nexus %s request failed" , traceCtx .operationTag )
1059+ _ , isTimeoutBelowMin := errors.AsType [* operationTimeoutBelowMinError ](callErr )
1060+ if failureSource == commonnexus .FailureSourceWorker || isTimeoutBelowMin {
1061+ e .Logger .Debug (msg , tags ... )
1062+ } else {
1063+ e .Logger .Error (msg , tags ... )
1064+ }
1065+ }
1066+
10671067func isDestinationDown (err error ) bool {
10681068 var serviceErr serviceerror.ServiceError
10691069 // For the system endpoint, we don't even consider the destination down since it's internal.
0 commit comments