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

Improve error type extraction for logs #5400

Merged
merged 1 commit into from
Feb 14, 2024
Merged

Conversation

tdeebswihart
Copy link
Contributor

What changed?

  1. Port the type unwrapping code from our metrics to our util package and use it
  2. Rename tag.ErrorType to tag.ServiceErrorType and create a new tag.ErrorType
  3. Report the type for all task errors we log

Why?

So that we know what type of unexpected errors we're encountering during task processing

How did you test it?

Potential risks

Is hotfix candidate?

1. Port the type unwrapping code from our metrics to our util package
   and use it
2. Rename tag.ErrorType to tag.ServiceErrorType and create a new
   tag.ErrorType
3. Report the type for all task errors we log
@@ -61,7 +62,7 @@ func errorType(err error) string {
q = q[:len(q)-1]
errType := fmt.Sprintf("%T", err)
if !wrapperErrorTypes[errType] {
return errType
return strings.TrimPrefix(errType, "*")
Copy link
Contributor

Choose a reason for hiding this comment

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

I see that this code existed already, but it's not clear to me why an error would start with one or multiple *? If this is sth we introduced, could this be a constant in a single place?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

*fmt.wrapError is the type of an error. So is *serviceerror.Foo.

We don't care that they're pointers, so we remove the prefix

@tdeebswihart tdeebswihart merged commit 5ccd09e into main Feb 14, 2024
58 checks passed
@tdeebswihart tdeebswihart deleted the tds/log-better-error-types branch February 14, 2024 18:01
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.

2 participants