37#ifndef PACS_INTEGRATION_QUERY_LEVEL_DEFINED
38#define PACS_INTEGRATION_QUERY_LEVEL_DEFINED
189 std::chrono::nanoseconds duration);
260 std::size_t total_bytes);
280 explicit span(std::string_view operation_name);
300 void set_tag(std::string_view key, std::string_view value);
318 [[nodiscard]]
auto trace_id() const -> std::
string;
324 [[nodiscard]] auto
span_id() const -> std::
string;
330 [[nodiscard]] auto
is_valid() const noexcept ->
bool;
342 [[nodiscard]] static auto
start_span(std::string_view operation) ->
span;
357 std::string status{
"healthy"};
379 std::function<
bool()> check);
Represents a unit of work in distributed tracing.
span & operator=(const span &)=delete
~span()
Destructor - automatically finishes the span.
span(const span &)=delete
void set_error(const std::exception &e)
Mark the span as an error.
span & operator=(span &&other) noexcept
void set_tag(std::string_view key, std::string_view value)
Set a tag on the span.
auto span_id() const -> std::string
Get the span ID.
void add_event(std::string_view name)
Add an event to the span.
std::unique_ptr< impl > impl_
span(span &&other) noexcept
auto is_valid() const noexcept -> bool
Check if span is valid (properly initialized)
auto trace_id() const -> std::string
Get the trace ID.
span(std::string_view operation_name)
Construct a new span.
Adapter for PACS performance metrics and distributed tracing.
static void update_storage_stats(std::size_t total_instances, std::size_t total_bytes)
Update storage statistics.
static void record_c_find(std::chrono::nanoseconds duration, std::size_t matches, query_level level)
Record C-FIND operation metrics.
static auto get_health() -> health_status
Get current health status.
static auto get_config() -> const monitoring_config &
Get the current configuration.
static void unregister_health_check(std::string_view component)
Unregister a health check.
static void record_timing(std::string_view name, std::chrono::nanoseconds duration)
Record a timing measurement.
static void record_c_store(std::chrono::nanoseconds duration, std::size_t bytes, bool success)
Record C-STORE operation metrics.
static void record_association(const std::string &calling_ae, bool established)
Record DICOM association metrics.
static auto start_span(std::string_view operation) -> span
Start a new trace span.
static std::unique_ptr< impl > pimpl_
static void record_histogram(std::string_view name, double value)
Record a histogram sample.
static void register_health_check(std::string_view component, std::function< bool()> check)
Register a health check for a component.
static void initialize(const monitoring_config &config)
Initialize the monitoring adapter with configuration.
static void increment_counter(std::string_view name, std::int64_t value=1)
Increment a counter metric.
static void set_gauge(std::string_view name, double value)
Set a gauge metric value.
static auto query_level_to_string(query_level level) -> std::string
static void shutdown()
Shutdown the monitoring adapter.
static auto is_initialized() noexcept -> bool
Check if the monitoring adapter is initialized.
query_level
DICOM query retrieve level.
Health check result containing component status.
std::map< std::string, std::string > components
Per-component health status.
Configuration options for the monitoring adapter.
bool enable_tracing
Enable distributed tracing.
std::optional< std::uint16_t > metrics_port
Prometheus-style metrics endpoint port (nullopt = disabled)
std::string service_name
Service name for tracing.
std::chrono::seconds export_interval
Interval for exporting metrics.
bool enable_metrics
Enable metrics collection.
std::optional< std::string > tracing_endpoint
Jaeger/Zipkin-style tracing endpoint (nullopt = disabled)
std::size_t max_samples_per_operation
Maximum samples to keep per operation.