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

线上使用fastcompass 统计cache命中率时出现很多统计错误 #62

Open
bjo2008cnx opened this issue Apr 30, 2020 · 3 comments

Comments

@bjo2008cnx
Copy link

线上使用fastcompass 统计cache命中率时出现很多统计错误,相应的测试代码如下:
public void execute() {
long startTime = System.currentTimeMillis();
boolean isSuccess = false;
try {
TimeUnit.MICROSECONDS.sleep(1000);
//do business staff......
//isSuccess = true;
} catch (Exception e) {
//.......
} finally {
long endTime = System.currentTimeMillis();
//模拟成功率
isSuccess = startTime % 10 == 0 ? false : true;
metric.record(endTime - startTime, isSuccess);
}
}
这里用的是模拟数据,成功率应在90%。
在单线程下,这段代码输出正确。
在多线程下,线程池数量为100时,抓到的很多数据bucket_count,success_bucket_count,fail_bucket_count,success_rate都为0.0

@ralf0131
Copy link
Collaborator

麻烦提供一下完整的测试用例?

@bjo2008cnx
Copy link
Author

代码行数比较多,整理后上传到这里了,https://github.com/bjo2008cnx/metrics-examples.git

@bjo2008cnx
Copy link
Author

麻烦大牛看下,是不是我使用的姿势不对。

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

No branches or pull requests

2 participants