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

Add MetricsRepository interface and reuse original in-memory implementation #126

Merged
merged 1 commit into from
Sep 6, 2018

Conversation

sczyh30
Copy link
Member

@sczyh30 sczyh30 commented Sep 5, 2018

Describe what this PR does / why we need it

Add MetricsRepository interface and reuse original in-memory implementation.

Does this pull request fix one issue?

Closes #69

Describe how you did it

  • Abstract a universal MetricsRepository interface so that users can implement their own metrics persistence.
  • Reuse original in-memory implementation (InMemoryMetricsRepository) as the default repository.

…tation

Signed-off-by: Eric Zhao <sczyh16@gmail.com>
@sczyh30 sczyh30 added the to-review To review label Sep 5, 2018
@sczyh30 sczyh30 added this to the 0.2.0 milestone Sep 5, 2018
@codecov-io
Copy link

Codecov Report

Merging #126 into master will increase coverage by 1.1%.
The diff coverage is n/a.

Impacted file tree graph

@@             Coverage Diff             @@
##             master     #126     +/-   ##
===========================================
+ Coverage     45.67%   46.77%   +1.1%     
- Complexity      554      562      +8     
===========================================
  Files           114      114             
  Lines          3814     3814             
  Branches        531      531             
===========================================
+ Hits           1742     1784     +42     
+ Misses         1859     1808     -51     
- Partials        213      222      +9
Impacted Files Coverage Δ Complexity Δ
...a/csp/sentinel/slots/statistic/base/LeapArray.java 76.92% <0%> (+5.12%) 15% <0%> (+1%) ⬆️
...ibaba/csp/sentinel/eagleeye/EagleEyeLogDaemon.java 30.3% <0%> (+6.06%) 6% <0%> (+1%) ⬆️
...a/csp/sentinel/slots/statistic/base/LongAdder.java 31.91% <0%> (+14.89%) 10% <0%> (+6%) ⬆️
...ba/csp/sentinel/slots/statistic/base/Stripe64.java 56.25% <0%> (+30.2%) 0% <0%> (ø) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9a27f39...b96a463. Read the comment docs.

@yfh0918
Copy link
Contributor

yfh0918 commented Sep 5, 2018

目前InMemoryMetricsRepository是默认实现,后期如果自己增加实现的话,需要实现MetricsRepository接口,但是会存在两种实现,MetricController.java里面是否可以把MetricsRepository metricStore -> List<MetricsRepository metricStore> metricStoreList,后面的部分判断下metricStoreList的size如果=1 就用InMemoryMetricsRepository,如果 > 1就用另外一个

@sczyh30
Copy link
Member Author

sczyh30 commented Sep 5, 2018

Hi, I think just a single MetricsRepository is enough. If users want to use their own implementation, just register as a bean, and then add a @Qualifier annotation on the MetricsRepository field indicating their own implementation.

Copy link
Contributor

@CarpenterLee CarpenterLee left a comment

Choose a reason for hiding this comment

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

LGTM

@sczyh30 sczyh30 merged commit 02cf5e5 into alibaba:master Sep 6, 2018
@sczyh30 sczyh30 removed the to-review To review label Sep 6, 2018
Arlmls pushed a commit to Arlmls/Sentinel that referenced this pull request Jan 8, 2019
…tation (alibaba#126)

- Abstract a universal `MetricsRepository` interface so that users can implement their own metrics persistence.
- Reuse original in-memory implementation (`InMemoryMetricsRepository`) as the default repository.

Signed-off-by: Eric Zhao <sczyh16@gmail.com>
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.

sentinel-dashboard拉取信息的持久化(Pull the persistence of information)
4 participants