-
Notifications
You must be signed in to change notification settings - Fork 8.1k
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
[Feature]Add metric extension to Sentinel internal statistics #730
Conversation
…ternal statistics. Signed-off-by: Carpenter Lee <hooleeucas@163.com>
Signed-off-by: Carpenter Lee <hooleeucas@163.com>
Signed-off-by: Carpenter Lee <hooleeucas@163.com>
sentinel-core/src/main/java/com/alibaba/csp/sentinel/metric/extension/MetricExtensionInit.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Carpenter Lee <hooleeucas@163.com>
Codecov Report
@@ Coverage Diff @@
## master #730 +/- ##
============================================
+ Coverage 40.4% 41.06% +0.66%
- Complexity 1312 1338 +26
============================================
Files 297 301 +4
Lines 8591 8630 +39
Branches 1156 1159 +3
============================================
+ Hits 3471 3544 +73
+ Misses 4695 4661 -34
Partials 425 425
Continue to review full report at Codecov.
|
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
Describe what this PR does / why we need it
Sentient has various flow control strategies, all these strategies are based on Sentinel internal statistics. The real-time statistics are also useful for system monitoring. Unfortunately, Sentinel does not provide an extension to obtain these data directly.
This PR provides an extension to Sentinel internal statistics.
As discussed in #211, standardizing Sentinel metrics and monitoring is necessary, but we can't expect sentinel to do this. Sentinel should not care about the metric implementation, that is in which format the data is stored or in which way the metric is exposed. That is why
MetricExtension
is relevant.In the latter version, it may be necessary to refactor
MetricWriter
to obey theMetricExtension
pattern.Does this pull request fix one issue?
NONE
Describe how you did it
Add
MetricExtension
interface and related SPI classes as an extension to Sentinel internal statistics. This extension provides callbacks when a request passes rule checking, blocked by flow control, successfully end or exception occurred. Accompanied by these events, response time and current thread number will be recorded too.Describe how to verify it
Run test cases.
Special notes for reviews