Skip to content

Commit

Permalink
[fix](fe) Fix calc cloud qps metric incorrect (apache#38874)
Browse files Browse the repository at this point in the history
* When calculating qps, we should use `HashMap.put` instead of
`HashMap.replace` to record last value
  • Loading branch information
SWJTU-ZhangLei authored Aug 9, 2024
1 parent 572643a commit 9b9deb3
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ private void updateCloudMetrics(long interval) {
rps = Double.max(rps, 0);
MetricRepo.updateClusterRequestPerSecond(clusterId, rps, metric.getLabels());
MetricRepo.DORIS_METRIC_REGISTER.addMetrics(metric);
clusterLastRequestCounter.replace(clusterId, metric.getValue());
clusterLastRequestCounter.put(clusterId, metric.getValue());
});
}

Expand All @@ -142,7 +142,7 @@ private void updateCloudMetrics(long interval) {
rps = Double.max(rps, 0);
MetricRepo.updateClusterQueryPerSecond(clusterId, rps, metric.getLabels());
MetricRepo.DORIS_METRIC_REGISTER.addMetrics(metric);
clusterLastQueryCounter.replace(clusterId, metric.getValue());
clusterLastQueryCounter.put(clusterId, metric.getValue());
});
}

Expand All @@ -154,7 +154,7 @@ private void updateCloudMetrics(long interval) {
rps = Double.max(rps, 0);
MetricRepo.updateClusterQueryErrRate(clusterId, rps, metric.getLabels());
MetricRepo.DORIS_METRIC_REGISTER.addMetrics(metric);
clusterLastQueryCounter.replace(clusterId, metric.getValue());
clusterLastQueryErrCounter.put(clusterId, metric.getValue());
});
}
}
Expand Down

0 comments on commit 9b9deb3

Please sign in to comment.