@@ -25,6 +25,7 @@ package internal
2525
2626import (
2727 "context"
28+ "errors"
2829 "fmt"
2930 "sync"
3031 "time"
@@ -47,6 +48,7 @@ const (
4748 stickyDecisionScheduleToStartTimeoutSeconds = 5
4849
4950 ratioToForceCompleteDecisionTaskComplete = 0.8
51+ serviceBusy = "serviceBusy"
5052)
5153
5254type (
@@ -770,8 +772,13 @@ func (wtp *workflowTaskPoller) poll(ctx context.Context) (interface{}, error) {
770772 response , err := wtp .service .PollForDecisionTask (ctx , request , getYarpcCallOptions (wtp .featureFlags )... )
771773 if err != nil {
772774 retryable := isServiceTransientError (err )
775+
773776 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+ }
775782 } else {
776783 wtp .metricsScope .Counter (metrics .DecisionPollFailedCounter ).Inc (1 )
777784 }
@@ -1011,7 +1018,12 @@ func (atp *activityTaskPoller) poll(ctx context.Context) (*s.PollForActivityTask
10111018 if err != nil {
10121019 retryable := isServiceTransientError (err )
10131020 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+ }
10151027 } else {
10161028 atp .metricsScope .Counter (metrics .ActivityPollFailedCounter ).Inc (1 )
10171029 }
0 commit comments