Sentinel icon indicating copy to clipboard operation
Sentinel copied to clipboard

More information (e.g. triggered rules, real-time QPS) is needed to carry in BlockException

Open yikangfeng opened this issue 7 years ago • 3 comments

Issue Description

Type: feature request

Describe what happened (or what feature you want)

在捕获到热点参数限流的异常 或者 其他限流形式的异常后 希望能够获取到一些信息,例如,当发生热点参数限流后,捕获到这个 ParamFlowException 后(其他异常也同样需要),希望能获取到 当前发生限流的方法信息,方法上打的RequestMapping 接口信息,当前触发限流的规则信息,当前的QPS值,配置的QPS值,资源名 等信息,方便在运行时拿到这些信息发送报警。

More information (e.g. triggered rules, real-time QPS) is needed to carry in BlockException so that we can leverage relevant info to send alarm messages.

Describe what you expected to happen

希望能获取到 当前发生限流的方法信息,方法上打的RequestMapping 接口信息,当前触发限流的规则信息,当前的QPS值,配置的QPS值,资源名 等信息,方便在运行时拿到这些信息发送报警。

强烈需要在 1.4.2 版本就要支持。

yikangfeng avatar Jan 16 '19 03:01 yikangfeng

Hi @yikangfeng, we detect non-English characters in the issue. This comment is an auto translation from @sentinel-bot to help other users to understand this issue. We encourage you to describe your issue in English which is more friendly to other users.

After capturing the exception of the hotspot parameter current limit or other abnormality of the current limiting form, I hope to enhance the function to obtain some information.

Issue Description

Type: bug report or feature request

Describe what happened (or what feature you want)

After capturing the exception of the hotspot parameter current limit or other abnormality of the current limiting form, I hope to obtain some information. For example, after the hotspot parameter is limited, after the ParamFlowException is captured (other exceptions are also required), I hope to obtain it. Method information to the current current limit, the RequestMapping interface information on the method, the current rule information that triggers the current limit, the current QPS value, the configured QPS value, the resource name, etc., so that it is convenient to get the information to send an alarm at runtime. .

Describe what you expected to happen

How to reproduce it (as minimally and precisely as possible)

  1. It is desirable to obtain the method information of the current current limiting method, the RequestMapping interface information on the method, the current rule information of the current limiting current limit, the current QPS value, the configured QPS value, the resource name, etc., which are convenient to be taken at runtime. Send an alarm to these messages.

Tell us your environment

Anything else we need to know?

sentinel-bot avatar Jan 16 '19 03:01 sentinel-bot

Hi, thanks for your suggestion. We can put the triggered rule and maybe current metrics to the subclasses of BlockException. This is expected to be released in 1.4.2.

sczyh30 avatar Jan 16 '19 14:01 sczyh30

Sentinel 1.4.2 has been released and now we can get the triggered rule via the BlockException#getRule method. If you're going to add alarm listener, you can leverage callbacks in StatisticSlot. See here for instructions: https://github.com/alibaba/Sentinel/pull/418#issuecomment-458024816

sczyh30 avatar Feb 22 '19 09:02 sczyh30