|
PACS System 0.1.0
PACS DICOM system library
|
Central metrics collection for PACS DICOM operations. More...
#include <pacs_metrics.h>

Public Member Functions | |
| pacs_metrics ()=default | |
| Default constructor. | |
| pacs_metrics (const pacs_metrics &)=delete | |
| Non-copyable. | |
| pacs_metrics & | operator= (const pacs_metrics &)=delete |
| pacs_metrics (pacs_metrics &&)=delete | |
| Non-movable (singleton) | |
| pacs_metrics & | operator= (pacs_metrics &&)=delete |
| void | record_store (bool success, std::chrono::microseconds duration, std::uint64_t bytes_stored=0) noexcept |
| Record a C-STORE operation. | |
| void | record_query (bool success, std::chrono::microseconds duration, std::uint32_t matches=0) noexcept |
| Record a C-FIND (query) operation. | |
| void | record_echo (bool success, std::chrono::microseconds duration) noexcept |
| Record a C-ECHO (verification) operation. | |
| void | record_move (bool success, std::chrono::microseconds duration, std::uint32_t images_moved=0) noexcept |
| Record a C-MOVE operation. | |
| void | record_get (bool success, std::chrono::microseconds duration, std::uint32_t images_retrieved=0, std::uint64_t bytes_retrieved=0) noexcept |
| Record a C-GET operation. | |
| void | record_operation (dimse_operation op, bool success, std::chrono::microseconds duration) noexcept |
| Record a generic DIMSE operation. | |
| void | record_bytes_sent (std::uint64_t bytes) noexcept |
| Record bytes sent over the network. | |
| void | record_bytes_received (std::uint64_t bytes) noexcept |
| Record bytes received from the network. | |
| void | record_association_established () noexcept |
| Record an association being established. | |
| void | record_association_released () noexcept |
| Record an association being released. | |
| void | record_association_rejected () noexcept |
| Record an association being rejected. | |
| void | record_association_aborted () noexcept |
| Record an association being aborted. | |
| const operation_counter & | get_counter (dimse_operation op) const noexcept |
| Get operation counter for a specific DIMSE operation. | |
| operation_counter & | get_counter (dimse_operation op) noexcept |
| Get mutable operation counter for a specific DIMSE operation. | |
| const data_transfer_metrics & | transfer () const noexcept |
| Get data transfer metrics. | |
| const association_counters & | associations () const noexcept |
| Get association counters. | |
| const pool_counters & | element_pool () const noexcept |
| Get element pool counters. | |
| pool_counters & | element_pool () noexcept |
| Get mutable element pool counters. | |
| const pool_counters & | dataset_pool () const noexcept |
| Get dataset pool counters. | |
| pool_counters & | dataset_pool () noexcept |
| Get mutable dataset pool counters. | |
| const pool_counters & | pdu_buffer_pool () const noexcept |
| Get PDU buffer pool counters. | |
| pool_counters & | pdu_buffer_pool () noexcept |
| Get mutable PDU buffer pool counters. | |
| std::string | to_json () const |
| Export metrics as JSON string. | |
| std::string | to_prometheus (std::string_view prefix="pacs") const |
| Export metrics in Prometheus text format. | |
| void | reset () noexcept |
| Reset all metrics to zero. | |
Static Public Member Functions | |
| static pacs_metrics & | global_metrics () noexcept |
| Get the global singleton instance. | |
Central metrics collection for PACS DICOM operations.
The pacs_metrics class provides a thread-safe, low-overhead mechanism for tracking DICOM operation metrics including:
Thread Safety: All public methods are thread-safe using atomic operations.
Definition at line 354 of file pacs_metrics.h.
|
default |
Default constructor.
|
delete |
Non-copyable.
|
delete |
Non-movable (singleton)
|
inlinenodiscardnoexcept |
Get association counters.
Definition at line 609 of file pacs_metrics.h.
References associations_.
Referenced by kcenon::pacs::monitoring::dicom_association_collector::collect(), and kcenon::pacs::monitoring::dicom_metrics_collector::collect_association_metrics().

|
inlinenodiscardnoexcept |
Get dataset pool counters.
Definition at line 637 of file pacs_metrics.h.
References dataset_pool_.
|
inlinenodiscardnoexcept |
Get mutable dataset pool counters.
Definition at line 645 of file pacs_metrics.h.
References dataset_pool_.
|
inlinenodiscardnoexcept |
Get element pool counters.
Definition at line 621 of file pacs_metrics.h.
References element_pool_.
|
inlinenodiscardnoexcept |
Get mutable element pool counters.
Definition at line 629 of file pacs_metrics.h.
References element_pool_.
|
inlinenodiscardnoexcept |
Get operation counter for a specific DIMSE operation.
| op | The DIMSE operation type |
Definition at line 558 of file pacs_metrics.h.
References kcenon::pacs::monitoring::c_echo, c_echo_, kcenon::pacs::monitoring::c_find, c_find_, kcenon::pacs::monitoring::c_get, c_get_, kcenon::pacs::monitoring::c_move, c_move_, kcenon::pacs::monitoring::c_store, c_store_, kcenon::pacs::monitoring::n_action, n_action_, kcenon::pacs::monitoring::n_create, n_create_, kcenon::pacs::monitoring::n_delete, n_delete_, kcenon::pacs::monitoring::n_event, n_event_, kcenon::pacs::monitoring::n_get, n_get_, kcenon::pacs::monitoring::n_set, and n_set_.
Referenced by get_counter(), and record_operation().

|
inlinenodiscardnoexcept |
Get mutable operation counter for a specific DIMSE operation.
| op | The DIMSE operation type |
Definition at line 592 of file pacs_metrics.h.
References get_counter().

|
inlinestaticnodiscardnoexcept |
Get the global singleton instance.
Thread-safe lazy initialization using Meyer's singleton pattern.
Definition at line 371 of file pacs_metrics.h.
Referenced by kcenon::pacs::monitoring::dicom_association_collector::collect(), kcenon::pacs::monitoring::dicom_service_collector::collect(), kcenon::pacs::monitoring::dicom_metrics_collector::collect_association_metrics(), kcenon::pacs::monitoring::dicom_metrics_collector::collect_pool_metrics(), kcenon::pacs::monitoring::dicom_storage_collector::collect_pool_metrics(), kcenon::pacs::monitoring::dicom_metrics_collector::collect_query_metrics(), kcenon::pacs::monitoring::dicom_metrics_collector::collect_storage_metrics(), kcenon::pacs::monitoring::dicom_metrics_collector::collect_transfer_metrics(), kcenon::pacs::monitoring::dicom_storage_collector::collect_transfer_metrics(), kcenon::pacs::monitoring::dicom_metrics_collector::get_snapshot(), kcenon::pacs::monitoring::pacs_monitor::reset(), kcenon::pacs::monitoring::pacs_monitor::to_json(), and kcenon::pacs::monitoring::pacs_monitor::to_prometheus().

|
delete |
|
delete |
|
inlinenodiscardnoexcept |
Get PDU buffer pool counters.
Definition at line 653 of file pacs_metrics.h.
References pdu_buffer_pool_.
|
inlinenodiscardnoexcept |
Get mutable PDU buffer pool counters.
Definition at line 661 of file pacs_metrics.h.
References pdu_buffer_pool_.
|
inlinenoexcept |
Record an association being aborted.
Definition at line 545 of file pacs_metrics.h.
References associations_, and kcenon::pacs::monitoring::association_counters::record_aborted().

|
inlinenoexcept |
Record an association being established.
Definition at line 524 of file pacs_metrics.h.
References associations_, and kcenon::pacs::monitoring::association_counters::record_established().

|
inlinenoexcept |
Record an association being rejected.
Definition at line 538 of file pacs_metrics.h.
References associations_, and kcenon::pacs::monitoring::association_counters::record_rejected().

|
inlinenoexcept |
Record an association being released.
Definition at line 531 of file pacs_metrics.h.
References associations_, and kcenon::pacs::monitoring::association_counters::record_released().

|
inlinenoexcept |
Record bytes received from the network.
| bytes | Number of bytes received |
Definition at line 513 of file pacs_metrics.h.
References kcenon::pacs::monitoring::data_transfer_metrics::add_bytes_received(), and transfer_.

|
inlinenoexcept |
Record bytes sent over the network.
| bytes | Number of bytes sent |
Definition at line 505 of file pacs_metrics.h.
References kcenon::pacs::monitoring::data_transfer_metrics::add_bytes_sent(), and transfer_.

|
inlinenoexcept |
Record a C-ECHO (verification) operation.
| success | Whether the operation succeeded |
| duration | Operation duration |
Definition at line 429 of file pacs_metrics.h.
References c_echo_, kcenon::pacs::monitoring::operation_counter::record_failure(), and kcenon::pacs::monitoring::operation_counter::record_success().

|
inlinenoexcept |
Record a C-GET operation.
| success | Whether the operation succeeded |
| duration | Operation duration |
| images_retrieved | Number of images retrieved |
| bytes_retrieved | Number of bytes retrieved |
Definition at line 463 of file pacs_metrics.h.
References kcenon::pacs::monitoring::data_transfer_metrics::add_bytes_sent(), c_get_, kcenon::pacs::monitoring::data_transfer_metrics::increment_images_retrieved(), kcenon::pacs::monitoring::operation_counter::record_failure(), kcenon::pacs::monitoring::operation_counter::record_success(), and transfer_.

|
inlinenoexcept |
Record a C-MOVE operation.
| success | Whether the operation succeeded |
| duration | Operation duration |
| images_moved | Number of images moved |
Definition at line 443 of file pacs_metrics.h.
References c_move_, kcenon::pacs::monitoring::data_transfer_metrics::increment_images_retrieved(), kcenon::pacs::monitoring::operation_counter::record_failure(), kcenon::pacs::monitoring::operation_counter::record_success(), and transfer_.

|
inlinenoexcept |
Record a generic DIMSE operation.
| op | Operation type |
| success | Whether the operation succeeded |
| duration | Operation duration |
Definition at line 486 of file pacs_metrics.h.
References kcenon::pacs::monitoring::counter, and get_counter().

|
inlinenoexcept |
Record a C-FIND (query) operation.
| success | Whether the operation succeeded |
| duration | Operation duration |
| matches | Number of matching results |
Definition at line 414 of file pacs_metrics.h.
References c_find_, kcenon::pacs::monitoring::operation_counter::record_failure(), and kcenon::pacs::monitoring::operation_counter::record_success().

|
inlinenoexcept |
Record a C-STORE operation.
| success | Whether the operation succeeded |
| duration | Operation duration |
| bytes_stored | Number of bytes stored (0 if failed) |
Definition at line 394 of file pacs_metrics.h.
References kcenon::pacs::monitoring::data_transfer_metrics::add_bytes_received(), c_store_, kcenon::pacs::monitoring::data_transfer_metrics::increment_images_stored(), kcenon::pacs::monitoring::operation_counter::record_failure(), kcenon::pacs::monitoring::operation_counter::record_success(), and transfer_.

|
inlinenoexcept |
Reset all metrics to zero.
Thread-safe reset of all counters. Useful for testing or periodic metric collection windows.
Definition at line 698 of file pacs_metrics.h.
References associations_, c_echo_, c_find_, c_get_, c_move_, c_store_, dataset_pool_, element_pool_, n_action_, n_create_, n_delete_, n_event_, n_get_, n_set_, pdu_buffer_pool_, kcenon::pacs::monitoring::association_counters::reset(), kcenon::pacs::monitoring::data_transfer_metrics::reset(), kcenon::pacs::monitoring::operation_counter::reset(), kcenon::pacs::monitoring::pool_counters::reset(), and transfer_.
Referenced by kcenon::pacs::monitoring::pacs_monitor::reset().


|
nodiscard |
Export metrics as JSON string.
The JSON format is suitable for REST API responses and integration with monitoring systems like Grafana.
Definition at line 110 of file pacs_metrics.cpp.
References associations_, kcenon::pacs::monitoring::data_transfer_metrics::bytes_received, kcenon::pacs::monitoring::data_transfer_metrics::bytes_sent, c_echo_, c_find_, c_get_, c_move_, c_store_, kcenon::pacs::monitoring::association_counters::current_active, kcenon::pacs::monitoring::data_transfer_metrics::images_retrieved, kcenon::pacs::monitoring::data_transfer_metrics::images_stored, n_action_, n_create_, n_delete_, n_event_, n_get_, n_set_, kcenon::pacs::monitoring::association_counters::peak_active, kcenon::pacs::monitoring::association_counters::total_aborted, kcenon::pacs::monitoring::association_counters::total_established, kcenon::pacs::monitoring::association_counters::total_rejected, and transfer_.
Referenced by kcenon::pacs::monitoring::pacs_monitor::to_json().

|
nodiscard |
Export metrics in Prometheus text format.
| prefix | Metric name prefix (default: "pacs") |
The output follows the Prometheus text-based format specification suitable for scraping by Prometheus servers.
Definition at line 150 of file pacs_metrics.cpp.
References associations_, kcenon::pacs::monitoring::data_transfer_metrics::bytes_received, kcenon::pacs::monitoring::data_transfer_metrics::bytes_sent, c_echo_, c_find_, c_get_, c_move_, c_store_, kcenon::pacs::monitoring::association_counters::current_active, kcenon::pacs::monitoring::data_transfer_metrics::images_retrieved, kcenon::pacs::monitoring::data_transfer_metrics::images_stored, n_action_, n_create_, n_delete_, n_event_, n_get_, n_set_, kcenon::pacs::monitoring::association_counters::peak_active, kcenon::pacs::monitoring::association_counters::total_aborted, kcenon::pacs::monitoring::association_counters::total_established, kcenon::pacs::monitoring::association_counters::total_rejected, and transfer_.
Referenced by kcenon::pacs::monitoring::pacs_monitor::to_prometheus().

|
inlinenodiscardnoexcept |
Get data transfer metrics.
Definition at line 601 of file pacs_metrics.h.
References transfer_.
Referenced by kcenon::pacs::monitoring::dicom_metrics_collector::collect_transfer_metrics(), and kcenon::pacs::monitoring::dicom_storage_collector::collect_transfer_metrics().

|
private |
Definition at line 735 of file pacs_metrics.h.
Referenced by associations(), record_association_aborted(), record_association_established(), record_association_rejected(), record_association_released(), reset(), to_json(), and to_prometheus().
|
private |
Definition at line 719 of file pacs_metrics.h.
Referenced by get_counter(), record_echo(), reset(), to_json(), and to_prometheus().
|
private |
Definition at line 721 of file pacs_metrics.h.
Referenced by get_counter(), record_query(), reset(), to_json(), and to_prometheus().
|
private |
Definition at line 723 of file pacs_metrics.h.
Referenced by get_counter(), record_get(), reset(), to_json(), and to_prometheus().
|
private |
Definition at line 722 of file pacs_metrics.h.
Referenced by get_counter(), record_move(), reset(), to_json(), and to_prometheus().
|
private |
Definition at line 720 of file pacs_metrics.h.
Referenced by get_counter(), record_store(), reset(), to_json(), and to_prometheus().
|
private |
Definition at line 739 of file pacs_metrics.h.
Referenced by dataset_pool(), dataset_pool(), and reset().
|
private |
Definition at line 738 of file pacs_metrics.h.
Referenced by element_pool(), element_pool(), and reset().
|
private |
Definition at line 727 of file pacs_metrics.h.
Referenced by get_counter(), reset(), to_json(), and to_prometheus().
|
private |
Definition at line 724 of file pacs_metrics.h.
Referenced by get_counter(), reset(), to_json(), and to_prometheus().
|
private |
Definition at line 729 of file pacs_metrics.h.
Referenced by get_counter(), reset(), to_json(), and to_prometheus().
|
private |
Definition at line 728 of file pacs_metrics.h.
Referenced by get_counter(), reset(), to_json(), and to_prometheus().
|
private |
Definition at line 726 of file pacs_metrics.h.
Referenced by get_counter(), reset(), to_json(), and to_prometheus().
|
private |
Definition at line 725 of file pacs_metrics.h.
Referenced by get_counter(), reset(), to_json(), and to_prometheus().
|
private |
Definition at line 740 of file pacs_metrics.h.
Referenced by pdu_buffer_pool(), pdu_buffer_pool(), and reset().
|
private |
Definition at line 732 of file pacs_metrics.h.
Referenced by record_bytes_received(), record_bytes_sent(), record_get(), record_move(), record_store(), reset(), to_json(), to_prometheus(), and transfer().