-
-
Notifications
You must be signed in to change notification settings - Fork 4k
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
feat: tracing add custom report err func #3370
base: main
Are you sure you want to change the base?
Conversation
middleware/tracing/tracing.go
Outdated
@@ -15,10 +15,14 @@ import ( | |||
// Option is tracing option. | |||
type Option func(*options) | |||
|
|||
// ReportErrHandle report err func handler | |||
type ReportErrHandle func(ctx context.Context, span trace.Span, err error) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ReportErrHandle -> ReportErrorHandle
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
已修改
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Pull request was converted to draft
Description (what this PR does / why we need it):
By default, when an error occurs, the following action is taken:
The exception.type in RecordError is the type of the error, which doesn't contain much information. To collect more details, we can customize the action and add new attributes.
Here is an example of how to customize error handling and collect more information:
By doing this, we can collect and record more detailed error information, which helps in better monitoring and debugging of the application.
Which issue(s) this PR fixes (resolves / be part of):
Other special notes for the reviewers:
the default grpc error code in opentelmetry library is
rpc.grpc.status_code
notrpc.status_code
, we can use the custom method to compatible that