# HG changeset patch # User Alain Mazy # Date 1782741646 -7200 # Node ID c60dae105872b05b2f5582ac4c82a1795c62ff5d # Parent 3948b93ed91805bf327397f183b2bfce409b391a replaced orthanc_jobs_completed by orthanc_jobs_total_completed + siblings diff -r 3948b93ed918 -r c60dae105872 NEWS --- a/NEWS Fri Jun 26 15:02:11 2026 +0200 +++ b/NEWS Mon Jun 29 16:00:46 2026 +0200 @@ -36,6 +36,13 @@ * Updated the naming structure of the zip downloaded from "/../../archive" routes. Notably added SeriesNumber at the series level and now using " - " instead of " " to separate DICOM tags used in folder names. +* In "/tools/metrics-prometheus": + - Removed "orthanc_jobs_completed", "orthanc_jobs_success" and "orthanc_jobs_failed" that were + only considering the jobs currently stored in the JobsHistory and that were not suitable for + monitoring. These metrics have been replaced by "orthanc_jobs_total_completed", + "orthanc_jobs_total_success" and "orthanc_jobs_total_failed" that are now considering all the + jobs that have run since Orthanc started. + Plugin SDK ---------- diff -r 3948b93ed918 -r c60dae105872 OrthancFramework/Sources/JobsEngine/JobsRegistry.cpp --- a/OrthancFramework/Sources/JobsEngine/JobsRegistry.cpp Fri Jun 26 15:02:11 2026 +0200 +++ b/OrthancFramework/Sources/JobsEngine/JobsRegistry.cpp Mon Jun 29 16:00:46 2026 +0200 @@ -1639,17 +1639,13 @@ void JobsRegistry::GetStatistics(unsigned int& pending, - unsigned int& running, - unsigned int& success, - unsigned int& failed) + unsigned int& running) { boost::mutex::scoped_lock lock(mutex_); CheckInvariants(); pending = 0; running = 0; - success = 0; - failed = 0; for (JobsIndex::const_iterator it = jobsIndex_.begin(); it != jobsIndex_.end(); ++it) @@ -1669,11 +1665,8 @@ break; case JobState_Success: - success ++; - break; - case JobState_Failure: - failed ++; + // not counted since 1.12.11+ break; default: diff -r 3948b93ed918 -r c60dae105872 OrthancFramework/Sources/JobsEngine/JobsRegistry.h --- a/OrthancFramework/Sources/JobsEngine/JobsRegistry.h Fri Jun 26 15:02:11 2026 +0200 +++ b/OrthancFramework/Sources/JobsEngine/JobsRegistry.h Mon Jun 29 16:00:46 2026 +0200 @@ -196,9 +196,7 @@ void ResetObserver(); void GetStatistics(unsigned int& pending, - unsigned int& running, - unsigned int& success, - unsigned int& errors); + unsigned int& running); void GetLastModificationTime(boost::posix_time::ptime& modificationTime) const; diff -r 3948b93ed918 -r c60dae105872 OrthancServer/Sources/OrthancRestApi/OrthancRestSystem.cpp --- a/OrthancServer/Sources/OrthancRestApi/OrthancRestSystem.cpp Fri Jun 26 15:02:11 2026 +0200 +++ b/OrthancServer/Sources/OrthancRestApi/OrthancRestSystem.cpp Mon Jun 29 16:00:46 2026 +0200 @@ -983,8 +983,8 @@ context.GetIndex().GetGlobalStatistics(diskSize, uncompressedSize, countPatients, countStudies, countSeries, countInstances); - unsigned int jobsPending, jobsRunning, jobsSuccess, jobsFailed; - context.GetJobsEngine().GetRegistry().GetStatistics(jobsPending, jobsRunning, jobsSuccess, jobsFailed); + unsigned int jobsPending, jobsRunning; + context.GetJobsEngine().GetRegistry().GetStatistics(jobsPending, jobsRunning); int64_t serverUpTime = context.GetServerUpTime(); Json::Value lastChange; @@ -999,9 +999,6 @@ registry.SetIntegerValue("orthanc_count_instances", static_cast(countInstances)); registry.SetIntegerValue("orthanc_jobs_pending", jobsPending); registry.SetIntegerValue("orthanc_jobs_running", jobsRunning); - registry.SetIntegerValue("orthanc_jobs_completed", jobsSuccess + jobsFailed); - registry.SetIntegerValue("orthanc_jobs_success", jobsSuccess); - registry.SetIntegerValue("orthanc_jobs_failed", jobsFailed); registry.SetIntegerValue("orthanc_up_time_s", serverUpTime); registry.SetIntegerValue("orthanc_last_change", lastChange["Last"].asInt64()); diff -r 3948b93ed918 -r c60dae105872 OrthancServer/Sources/ServerContext.cpp --- a/OrthancServer/Sources/ServerContext.cpp Fri Jun 26 15:02:11 2026 +0200 +++ b/OrthancServer/Sources/ServerContext.cpp Mon Jun 29 16:00:46 2026 +0200 @@ -266,6 +266,8 @@ void ServerContext::SignalJobSuccess(const std::string& jobId) { + metricsRegistry_->IncrementIntegerValue("orthanc_jobs_total_completed", 1); + metricsRegistry_->IncrementIntegerValue("orthanc_jobs_total_success", 1); haveJobsChanged_ = true; pendingJobEvents_.Enqueue(new JobEvent(JobEventType_Success, jobId)); } @@ -273,6 +275,8 @@ void ServerContext::SignalJobFailure(const std::string& jobId) { + metricsRegistry_->IncrementIntegerValue("orthanc_jobs_total_completed", 1); + metricsRegistry_->IncrementIntegerValue("orthanc_jobs_total_failed", 1); haveJobsChanged_ = true; pendingJobEvents_.Enqueue(new JobEvent(JobEventType_Failure, jobId)); }