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

Optimize the way to initialize the start time of the AtomicBucketWrapArray #197

Merged
merged 1 commit into from
Aug 5, 2020

Conversation

louyuting
Copy link
Collaborator

Describe what this PR does / why we need it

Make the start time of AtomicBucketWrapArray align to standard time.
Fix the typo in NewLeapArray.

Does this pull request fix one issue?

Describe how you did it

Describe how to verify it

Special notes for reviews

@louyuting louyuting requested a review from sczyh30 July 31, 2020 13:13
@louyuting louyuting added kind/bug Something isn't working kind/enhancement Category issues or PRs related to enhancement labels Jul 31, 2020
@louyuting louyuting linked an issue Jul 31, 2020 that may be closed by this pull request
@codecov-commenter
Copy link

codecov-commenter commented Jul 31, 2020

Codecov Report

Merging #197 into master will increase coverage by 0.09%.
The diff coverage is 65.38%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #197      +/-   ##
==========================================
+ Coverage   44.70%   44.80%   +0.09%     
==========================================
  Files          80       80              
  Lines        4438     4464      +26     
==========================================
+ Hits         1984     2000      +16     
- Misses       2227     2235       +8     
- Partials      227      229       +2     
Impacted Files Coverage Δ
core/circuitbreaker/rule_manager.go 50.83% <50.00%> (+0.27%) ⬆️
core/circuitbreaker/circuit_breaker.go 23.56% <66.66%> (+0.25%) ⬆️
core/stat/base/leap_array.go 62.72% <75.00%> (+5.58%) ⬆️
ext/datasource/nacos/nacos.go 51.72% <0.00%> (-5.69%) ⬇️

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 c93bfd8...da12b0c. Read the comment docs.

startTime := calculateStartTime(util.CurrentTimeMillis(), bucketLengthInMs)
for i := len - 1; i >= 0; i-- {
interval := uint64(bucketLengthInMs * uint32(len))
arrayStartTime := now - (now % interval)
Copy link
Member

@sczyh30 sczyh30 Aug 3, 2020

Choose a reason for hiding this comment

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

The startTime for current idx should be now - now % bucketLengthInMs?

For example (in related test cases), sampleCount=10, bucketLength=200ms, now=1596199317921, then the oldest bucket of created data structure should be 1596199317800

@louyuting louyuting force-pushed the 20200801-enhance-stat branch 3 times, most recently from 843cda6 to 0489375 Compare August 4, 2020 15:05
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

@sczyh30 sczyh30 merged commit 07a5dba into alibaba:master Aug 5, 2020
@sczyh30
Copy link
Member

sczyh30 commented Aug 5, 2020

Thanks!

@louyuting louyuting added this to the 0.6.0 milestone Aug 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working kind/enhancement Category issues or PRs related to enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Confusion about LeapArray.calculateTimeIdx().
3 participants