metrics
metrics copied to clipboard
线上使用fastcompass 统计cache命中率时出现很多统计错误
线上使用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
麻烦提供一下完整的测试用例?
代码行数比较多,整理后上传到这里了,https://github.com/bjo2008cnx/metrics-examples.git
麻烦大牛看下,是不是我使用的姿势不对。