zeromicro / go-zero

A cloud-native Go microservices framework with cli tool for productivity.
https://go-zero.dev
MIT License
29.38k stars 3.97k forks source link

The built-in interceptor is unable to identify the user-defined error (business interruption error), which causes the error log to be polluted and triggers the false alarm of the monitoring alarm. #2757

Closed heyehang closed 7 months ago

heyehang commented 1 year ago

In the GRPC interceptor DurationInterceptor, there is an error log output. Our current ERR processing scenarios are: expected errors in business are not logged (business interruption, current role does not have permission, order has expired, and the other party is not your friend), and unexpected errors are logged (customized interceptors have been implemented). However, there is a problem that the default interceptor will perform a unified ERR output, triggering our monitoring alarm. Therefore, the overall performance is that the error handling of the DurationInterceptor interceptor will pollute the error log in the customized error scenario, causing the monitoring to trigger the false alarm of the error log. DurationInterceptor is built into GoZero. If DurationInterceptor is customized, other middleware that is also identified by default will have to be rewritten, and the development cost is a little high.

WechatIMG1652

Scheme:

  1. Open definition interface. External ERRs that do not require output only need to implement their IgnoreFlag methods. Then, the internal interceptor attempts to check whether IgnoreFlag is implemented, and then decides how to handle it

    WechatIMG1655
  2. Open customized middleware configuration to let users decide whether to implement corresponding middleware by themselves

github-actions[bot] commented 10 months ago

This issue is stale because it has been open for 30 days with no activity.

github-actions[bot] commented 7 months ago

This issue was closed because it has been inactive for 14 days since being marked as stale.