-
Notifications
You must be signed in to change notification settings - Fork 525
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
[Bug] HStore JRaft Histograms Metrics Value NaN Error #2627
Comments
To resolve the issue of histogram metrics values for JRaft returning NaN in the HStore backend of the Master (Apache Release Version) of your server, you should ensure that the Here is the relevant code snippet that shows how the private static class HistogramWrapper {
private final com.codahale.metrics.Histogram histogram;
private Snapshot snapshot;
private long ts = System.currentTimeMillis();
HistogramWrapper(com.codahale.metrics.Histogram histogram) {
this.histogram = histogram;
this.snapshot = this.histogram.getSnapshot();
}
Snapshot getSnapshot() {
if (System.currentTimeMillis() - this.ts > 30_000) {
this.snapshot = this.histogram.getSnapshot();
this.ts = System.currentTimeMillis();
}
return this.snapshot;
}
} To ensure that the histogram metrics are updated correctly, you might want to reduce the interval for updating the snapshot or ensure that the histogram is being updated frequently enough. You can adjust the interval by modifying the condition in the Snapshot getSnapshot() {
if (System.currentTimeMillis() - this.ts > 10_000) { // Update every 10 seconds
this.snapshot = this.histogram.getSnapshot();
this.ts = System.currentTimeMillis();
}
return this.snapshot;
} Additionally, ensure that the histogram is being updated with new data points frequently enough to avoid NaN values. If the histogram is not receiving new data points, it might result in NaN values when the snapshot is taken [1]. |
@dosu 此处不需要定时拉取,直接histogram.getSnapshot(), 对性能影响很大? |
Yes, directly calling |
Bug Type (问题类型)
None
Before submit
Environment (环境信息)
Expected & Actual behavior (期望与实际表现)
当前问题
Histograms 类型指标值获取出现异常 NaN
期望结果
通过Spring Actuator 接口获取正确的JRaft 监控指标
curl http://ip:8620/actuator/prometheus |grep jraft_append_logs_bytes
指标详情
具体指标
Vertex/Edge example (问题点 / 边数据举例)
No response
Schema [VertexLabel, EdgeLabel, IndexLabel] (元数据结构)
No response
The text was updated successfully, but these errors were encountered: