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

Fix/list metric files #331

Merged
merged 3 commits into from
Dec 25, 2018
Merged

Fix/list metric files #331

merged 3 commits into from
Dec 25, 2018

Conversation

CarpenterLee
Copy link
Contributor

Describe what this PR does / why we need it

MetricWriter#listMetricFiles() method is used for listing all metric files of the specific app. It uses String.contains() to search the metric file name instead of whole matching, this will lead wrong file reading when appName contains some other one, for example one appName is simple-Sentinel-SDK-Demo, the other is Sentinel-SDK-Demo, the former app's metric file will appearing in the latter metric files list.

MetricWriter#listMetricFiles() should return right metric files name list.

Does this pull request fix one issue?

Fixes #330

Describe how you did it

Use whole string matching instead of String.contains() to filter app metric file name.

Describe how to verify it

Run test cases.

Special notes for reviews

Signed-off-by: Carpenter Lee <hooleeucas@163.com>
Signed-off-by: Carpenter Lee <hooleeucas@163.com>
Signed-off-by: Carpenter Lee <hooleeucas@163.com>
@codecov-io
Copy link

codecov-io commented Dec 25, 2018

Codecov Report

Merging #331 into master will increase coverage by 0.08%.
The diff coverage is 38.09%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #331      +/-   ##
============================================
+ Coverage     38.33%   38.42%   +0.08%     
- Complexity      934      937       +3     
============================================
  Files           218      218              
  Lines          6925     6935      +10     
  Branches        941      942       +1     
============================================
+ Hits           2655     2665      +10     
- Misses         3932     3933       +1     
+ Partials        338      337       -1
Impacted Files Coverage Δ Complexity Δ
...ibaba/csp/sentinel/node/metric/MetricSearcher.java 0% <0%> (ø) 0 <0> (ø) ⬇️
...libaba/csp/sentinel/node/metric/MetricsReader.java 0% <0%> (ø) 0 <0> (ø) ⬇️
...alibaba/csp/sentinel/node/metric/MetricWriter.java 58.57% <53.33%> (+1.78%) 21 <2> (+2) ⬆️
...s/block/flow/controller/RateLimiterController.java 91.66% <0%> (+12.5%) 6% <0%> (+1%) ⬆️

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 d3bbe29...425bfa6. Read the comment docs.

Copy link
Member

@sczyh30 sczyh30 left a comment

Choose a reason for hiding this comment

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

LGTM

@CarpenterLee CarpenterLee merged commit c047457 into master Dec 25, 2018
sczyh30 pushed a commit that referenced this pull request Dec 25, 2018
* Fix #330 : fix listMetricFiles() returns wrong file name list.

Signed-off-by: Carpenter Lee <hooleeucas@163.com>

* Add timestamp check when read metrics.

Signed-off-by: Carpenter Lee <hooleeucas@163.com>

* Refine test case

Signed-off-by: Carpenter Lee <hooleeucas@163.com>
@sczyh30 sczyh30 deleted the fix/list_metric_files branch December 27, 2018 07:59
@sczyh30 sczyh30 added this to the 1.4.1 milestone Dec 29, 2018
Arlmls pushed a commit to Arlmls/Sentinel that referenced this pull request Jan 8, 2019
* Fix alibaba#330 : fix listMetricFiles() returns wrong file name list.

Signed-off-by: Carpenter Lee <hooleeucas@163.com>

* Add timestamp check when read metrics.

Signed-off-by: Carpenter Lee <hooleeucas@163.com>

* Refine test case

Signed-off-by: Carpenter Lee <hooleeucas@163.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.

MetricWriter#listMetricFiles() will read wrong files when one appName contains some other one
3 participants