diff OrthancServer/Sources/ServerContext.cpp @ 5326:fbe857e942cd

store metrics as integers instead of floats to avoid precision loss in increments
author Sebastien Jodogne <s.jodogne@gmail.com>
date Sun, 25 Jun 2023 18:28:49 +0200
parents e95caa87fed8
children 808319c1e22b
line wrap: on
line diff
--- a/OrthancServer/Sources/ServerContext.cpp	Sun Jun 25 17:49:34 2023 +0200
+++ b/OrthancServer/Sources/ServerContext.cpp	Sun Jun 25 18:28:49 2023 +0200
@@ -298,9 +298,8 @@
   void ServerContext::PublishDicomCacheMetrics()
   {
     metricsRegistry_->SetValue("orthanc_dicom_cache_size",
-                               static_cast<float>(dicomCache_.GetCurrentSize()) / static_cast<float>(1024 * 1024));
-    metricsRegistry_->SetValue("orthanc_dicom_cache_count",
-                               static_cast<float>(dicomCache_.GetNumberOfItems()));
+                               boost::math::llround(static_cast<float>(dicomCache_.GetCurrentSize()) / static_cast<float>(1024 * 1024)));
+    metricsRegistry_->SetValue("orthanc_dicom_cache_count", dicomCache_.GetNumberOfItems());
   }