Mercurial > hg > orthanc
diff OrthancServer/Sources/ServerContext.cpp @ 5431:4be5f117aa0d
metrics
author | Alain Mazy <am@osimis.io> |
---|---|
date | Tue, 21 Nov 2023 10:32:42 +0100 |
parents | 111e21b4f8bc |
children | 6f2b11bfee8d |
line wrap: on
line diff
--- a/OrthancServer/Sources/ServerContext.cpp Mon Nov 20 17:01:48 2023 +0100 +++ b/OrthancServer/Sources/ServerContext.cpp Tue Nov 21 10:32:42 2023 +0100 @@ -328,11 +328,15 @@ } - void ServerContext::PublishDicomCacheMetrics() + void ServerContext::PublishCacheMetrics() { - metricsRegistry_->SetFloatValue("orthanc_dicom_cache_size", + metricsRegistry_->SetFloatValue("orthanc_dicom_cache_size_mb", static_cast<float>(dicomCache_.GetCurrentSize()) / static_cast<float>(1024 * 1024)); metricsRegistry_->SetIntegerValue("orthanc_dicom_cache_count", dicomCache_.GetNumberOfItems()); + + metricsRegistry_->SetFloatValue("orthanc_storage_cache_size_mb", + static_cast<float>(storageCache_.GetCurrentSize()) / static_cast<float>(1024 * 1024)); + metricsRegistry_->SetIntegerValue("orthanc_storage_cache_count", storageCache_.GetNumberOfItems()); } @@ -668,7 +672,6 @@ // Remove the file from the DicomCache (useful if // "OverwriteInstances" is set to "true") dicomCache_.Invalidate(resultPublicId); - PublishDicomCacheMetrics(); // TODO Should we use "gzip" instead? CompressionType compression = (compressionEnabled_ ? CompressionType_ZlibWithSize : CompressionType_None); @@ -1328,7 +1331,6 @@ try { context_.dicomCache_.Acquire(instancePublicId_, dicom_.release(), dicomSize_); - context_.PublishDicomCacheMetrics(); } catch (OrthancException&) { @@ -1406,7 +1408,6 @@ { // remove the file from the DicomCache dicomCache_.Invalidate(uuid); - PublishDicomCacheMetrics(); } return index_.DeleteResource(remainingAncestor, uuid, expectedType); @@ -1419,7 +1420,6 @@ change.GetChangeType() == ChangeType_Deleted) { dicomCache_.Invalidate(change.GetPublicId()); - PublishDicomCacheMetrics(); } pendingChanges_.Enqueue(change.Clone());