comparison OrthancServer/Sources/OrthancRestApi/OrthancRestSystem.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 b5c502bcaf99
children 808319c1e22b
comparison
equal deleted inserted replaced
5325:9c00e832985f 5326:fbe857e942cd
911 int64_t serverUpTime = context.GetServerUpTime(); 911 int64_t serverUpTime = context.GetServerUpTime();
912 Json::Value lastChange; 912 Json::Value lastChange;
913 context.GetIndex().GetLastChange(lastChange); 913 context.GetIndex().GetLastChange(lastChange);
914 914
915 MetricsRegistry& registry = context.GetMetricsRegistry(); 915 MetricsRegistry& registry = context.GetMetricsRegistry();
916 registry.SetValue("orthanc_disk_size_mb", static_cast<float>(diskSize) / MEGA_BYTES); 916 registry.SetValue("orthanc_disk_size_mb", boost::math::llround(static_cast<float>(diskSize) / MEGA_BYTES));
917 registry.SetValue("orthanc_uncompressed_size_mb", static_cast<float>(diskSize) / MEGA_BYTES); 917 registry.SetValue("orthanc_uncompressed_size_mb", boost::math::llround(static_cast<float>(diskSize) / MEGA_BYTES));
918 registry.SetValue("orthanc_count_patients", static_cast<unsigned int>(countPatients)); 918 registry.SetValue("orthanc_count_patients", static_cast<int64_t>(countPatients));
919 registry.SetValue("orthanc_count_studies", static_cast<unsigned int>(countStudies)); 919 registry.SetValue("orthanc_count_studies", static_cast<int64_t>(countStudies));
920 registry.SetValue("orthanc_count_series", static_cast<unsigned int>(countSeries)); 920 registry.SetValue("orthanc_count_series", static_cast<int64_t>(countSeries));
921 registry.SetValue("orthanc_count_instances", static_cast<unsigned int>(countInstances)); 921 registry.SetValue("orthanc_count_instances", static_cast<int64_t>(countInstances));
922 registry.SetValue("orthanc_jobs_pending", jobsPending); 922 registry.SetValue("orthanc_jobs_pending", jobsPending);
923 registry.SetValue("orthanc_jobs_running", jobsRunning); 923 registry.SetValue("orthanc_jobs_running", jobsRunning);
924 registry.SetValue("orthanc_jobs_completed", jobsSuccess + jobsFailed); 924 registry.SetValue("orthanc_jobs_completed", jobsSuccess + jobsFailed);
925 registry.SetValue("orthanc_jobs_success", jobsSuccess); 925 registry.SetValue("orthanc_jobs_success", jobsSuccess);
926 registry.SetValue("orthanc_jobs_failed", jobsFailed); 926 registry.SetValue("orthanc_jobs_failed", jobsFailed);