Skip to content

Commit

Permalink
Fix matching client error logging (#2471)
Browse files Browse the repository at this point in the history
  • Loading branch information
yiminc authored Feb 5, 2022
1 parent 6e7489a commit 8f88254
Showing 1 changed file with 27 additions and 9 deletions.
36 changes: 27 additions & 9 deletions client/matching/metricClient.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@ func (c *metricClient) AddActivityTask(
) (_ *matchingservice.AddActivityTaskResponse, retError error) {

scope, stopwatch := c.startMetricsRecording(metrics.MatchingClientAddActivityTaskScope)
defer c.finishMetricsRecording(scope, stopwatch, retError)
defer func() {
c.finishMetricsRecording(scope, stopwatch, retError)
}()

c.emitForwardedSourceStats(
scope,
Expand All @@ -83,7 +85,9 @@ func (c *metricClient) AddWorkflowTask(
) (_ *matchingservice.AddWorkflowTaskResponse, retError error) {

scope, stopwatch := c.startMetricsRecording(metrics.MatchingClientAddWorkflowTaskScope)
defer c.finishMetricsRecording(scope, stopwatch, retError)
defer func() {
c.finishMetricsRecording(scope, stopwatch, retError)
}()

c.emitForwardedSourceStats(
scope,
Expand All @@ -101,7 +105,9 @@ func (c *metricClient) PollActivityTaskQueue(
) (_ *matchingservice.PollActivityTaskQueueResponse, retError error) {

scope, stopwatch := c.startMetricsRecording(metrics.MatchingClientPollActivityTaskQueueScope)
defer c.finishMetricsRecording(scope, stopwatch, retError)
defer func() {
c.finishMetricsRecording(scope, stopwatch, retError)
}()

if request.PollRequest != nil {
c.emitForwardedSourceStats(
Expand All @@ -121,7 +127,9 @@ func (c *metricClient) PollWorkflowTaskQueue(
) (_ *matchingservice.PollWorkflowTaskQueueResponse, retError error) {

scope, stopwatch := c.startMetricsRecording(metrics.MatchingClientPollWorkflowTaskQueueScope)
defer c.finishMetricsRecording(scope, stopwatch, retError)
defer func() {
c.finishMetricsRecording(scope, stopwatch, retError)
}()

if request.PollRequest != nil {
c.emitForwardedSourceStats(
Expand All @@ -141,7 +149,9 @@ func (c *metricClient) QueryWorkflow(
) (_ *matchingservice.QueryWorkflowResponse, retError error) {

scope, stopwatch := c.startMetricsRecording(metrics.MatchingClientQueryWorkflowScope)
defer c.finishMetricsRecording(scope, stopwatch, retError)
defer func() {
c.finishMetricsRecording(scope, stopwatch, retError)
}()

c.emitForwardedSourceStats(
scope,
Expand All @@ -159,7 +169,9 @@ func (c *metricClient) RespondQueryTaskCompleted(
) (_ *matchingservice.RespondQueryTaskCompletedResponse, retError error) {

scope, stopwatch := c.startMetricsRecording(metrics.MatchingClientRespondQueryTaskCompletedScope)
defer c.finishMetricsRecording(scope, stopwatch, retError)
defer func() {
c.finishMetricsRecording(scope, stopwatch, retError)
}()

return c.client.RespondQueryTaskCompleted(ctx, request, opts...)
}
Expand All @@ -171,7 +183,9 @@ func (c *metricClient) CancelOutstandingPoll(
) (_ *matchingservice.CancelOutstandingPollResponse, retError error) {

scope, stopwatch := c.startMetricsRecording(metrics.MatchingClientCancelOutstandingPollScope)
defer c.finishMetricsRecording(scope, stopwatch, retError)
defer func() {
c.finishMetricsRecording(scope, stopwatch, retError)
}()

return c.client.CancelOutstandingPoll(ctx, request, opts...)
}
Expand All @@ -183,7 +197,9 @@ func (c *metricClient) DescribeTaskQueue(
) (_ *matchingservice.DescribeTaskQueueResponse, retError error) {

scope, stopwatch := c.startMetricsRecording(metrics.MatchingClientDescribeTaskQueueScope)
defer c.finishMetricsRecording(scope, stopwatch, retError)
defer func() {
c.finishMetricsRecording(scope, stopwatch, retError)
}()

return c.client.DescribeTaskQueue(ctx, request, opts...)
}
Expand All @@ -195,7 +211,9 @@ func (c *metricClient) ListTaskQueuePartitions(
) (_ *matchingservice.ListTaskQueuePartitionsResponse, retError error) {

scope, stopwatch := c.startMetricsRecording(metrics.MatchingClientListTaskQueuePartitionsScope)
defer c.finishMetricsRecording(scope, stopwatch, retError)
defer func() {
c.finishMetricsRecording(scope, stopwatch, retError)
}()

return c.client.ListTaskQueuePartitions(ctx, request, opts...)
}
Expand Down

0 comments on commit 8f88254

Please sign in to comment.