@@ -25,6 +25,7 @@ package internal
25
25
26
26
import (
27
27
"context"
28
+ "errors"
28
29
"fmt"
29
30
"sync"
30
31
"time"
@@ -47,6 +48,7 @@ const (
47
48
stickyDecisionScheduleToStartTimeoutSeconds = 5
48
49
49
50
ratioToForceCompleteDecisionTaskComplete = 0.8
51
+ serviceBusy = "serviceBusy"
50
52
)
51
53
52
54
type (
@@ -770,8 +772,13 @@ func (wtp *workflowTaskPoller) poll(ctx context.Context) (interface{}, error) {
770
772
response , err := wtp .service .PollForDecisionTask (ctx , request , getYarpcCallOptions (wtp .featureFlags )... )
771
773
if err != nil {
772
774
retryable := isServiceTransientError (err )
775
+
773
776
if retryable {
774
- wtp .metricsScope .Counter (metrics .DecisionPollTransientFailedCounter ).Inc (1 )
777
+ if target := (* s .ServiceBusyError )(nil ); errors .As (err , & target ) {
778
+ wtp .metricsScope .Tagged (map [string ]string {causeTag : serviceBusy }).Counter (metrics .DecisionPollTransientFailedCounter ).Inc (1 )
779
+ } else {
780
+ wtp .metricsScope .Counter (metrics .DecisionPollTransientFailedCounter ).Inc (1 )
781
+ }
775
782
} else {
776
783
wtp .metricsScope .Counter (metrics .DecisionPollFailedCounter ).Inc (1 )
777
784
}
@@ -1011,7 +1018,12 @@ func (atp *activityTaskPoller) poll(ctx context.Context) (*s.PollForActivityTask
1011
1018
if err != nil {
1012
1019
retryable := isServiceTransientError (err )
1013
1020
if retryable {
1014
- atp .metricsScope .Counter (metrics .ActivityPollTransientFailedCounter ).Inc (1 )
1021
+
1022
+ if target := (* s .ServiceBusyError )(nil ); errors .As (err , & target ) {
1023
+ atp .metricsScope .Tagged (map [string ]string {causeTag : serviceBusy }).Counter (metrics .ActivityPollTransientFailedCounter ).Inc (1 )
1024
+ } else {
1025
+ atp .metricsScope .Counter (metrics .ActivityPollTransientFailedCounter ).Inc (1 )
1026
+ }
1015
1027
} else {
1016
1028
atp .metricsScope .Counter (metrics .ActivityPollFailedCounter ).Inc (1 )
1017
1029
}
0 commit comments