alibaba / sentinel-golang

Sentinel Go enables reliability and resiliency for Go microservices
https://sentinelguard.io/
Apache License 2.0
2.77k stars 437 forks source link

MetricBucket reset #521

Closed Alipebt closed 1 year ago

Alipebt commented 1 year ago

Describe what this PR does / why we need it

the existing reset() function is not being used and a new MetricBucket is recreated in the ResetBucketTo() function. Therefore, we want to optimize our code to call reset() to avoid this unnecessary operation

Does this pull request fix one issue?

Fixes #403

Describe how you did it

add reset() to ResetBucketTo() The addRT() mentioned in the issue is not thread-safe, I think we can lose some precision to ensure the efficient execution of the program, so I did not modify the function

CLAassistant commented 1 year ago

CLA assistant check
All committers have signed the CLA.

sczyh30 commented 1 year ago

Could you please reformat your code with gofmt?

Alipebt commented 1 year ago

@binbin0325 Is there something else wrong with my code now? Could you give me some suggestions for improvement or approve the review?

binbin0325 commented 1 year ago

@Alipebt Please merge submission records into one

Alipebt commented 1 year ago

@binbin0325 I have completed the merge of commit

sczyh30 commented 1 year ago

Thanks for contributing!