comparison 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
comparison
equal deleted inserted replaced
5325:9c00e832985f 5326:fbe857e942cd
296 296
297 297
298 void ServerContext::PublishDicomCacheMetrics() 298 void ServerContext::PublishDicomCacheMetrics()
299 { 299 {
300 metricsRegistry_->SetValue("orthanc_dicom_cache_size", 300 metricsRegistry_->SetValue("orthanc_dicom_cache_size",
301 static_cast<float>(dicomCache_.GetCurrentSize()) / static_cast<float>(1024 * 1024)); 301 boost::math::llround(static_cast<float>(dicomCache_.GetCurrentSize()) / static_cast<float>(1024 * 1024)));
302 metricsRegistry_->SetValue("orthanc_dicom_cache_count", 302 metricsRegistry_->SetValue("orthanc_dicom_cache_count", dicomCache_.GetNumberOfItems());
303 static_cast<float>(dicomCache_.GetNumberOfItems()));
304 } 303 }
305 304
306 305
307 ServerContext::ServerContext(IDatabaseWrapper& database, 306 ServerContext::ServerContext(IDatabaseWrapper& database,
308 IStorageArea& area, 307 IStorageArea& area,