Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use throttled logger and use error type in metrics client #2477

Merged
merged 2 commits into from
Feb 8, 2022

Conversation

yux0
Copy link
Contributor

@yux0 yux0 commented Feb 8, 2022

What changed?
Use throttled logger and use error type in metrics client

Why?
The logger and metrics may be noisy to identify issues.

How did you test it?
Added unit tests

Potential risks

Is hotfix candidate?

@yux0 yux0 requested a review from wxing1292 February 8, 2022 18:29
@yux0 yux0 requested a review from a team as a code owner February 8, 2022 18:30
@yux0 yux0 merged commit cdb4fa0 into temporalio:master Feb 8, 2022
@yux0 yux0 deleted the client_error branch February 8, 2022 21:25
case *serviceerror.ResourceExhausted:
return ErrorTypeResourceExhausted
default:
return ErrorTypeUnknown
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How are we going to be able to use this? The idea of this error type tag with throttled logger is we can filter on the error type in logging to see what is happening.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should return fmt.Sprintf("%T", err)

Comment on lines +620 to +621
c.throttledLogger.Error("history client encountered error", tag.Error(err))
scope.Tagged(metrics.ServiceErrorTypeTag(err)).IncCounter(metrics.ClientFailures)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should add field for error type to the log line that is the same as the tag on metrics so when we observer some error type from metrics, we can filter on log for that type.

client historyservice.HistoryServiceClient
metricsClient metrics.Client
logger log.Logger
throttledLogger log.Logger
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

might be worth moving resource.ThrottledLogger to log package and use this type instead

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants