PACS System 0.1.0
PACS DICOM system library
Loading...
Searching...
No Matches
kcenon::pacs::integration::monitoring_adapter::span Class Reference

Represents a unit of work in distributed tracing. More...

#include <monitoring_adapter.h>

Collaboration diagram for kcenon::pacs::integration::monitoring_adapter::span:
Collaboration graph

Classes

class  impl
 

Public Member Functions

 span (std::string_view operation_name)
 Construct a new span.
 
 ~span ()
 Destructor - automatically finishes the span.
 
 span (const span &)=delete
 
spanoperator= (const span &)=delete
 
 span (span &&other) noexcept
 
spanoperator= (span &&other) noexcept
 
void set_tag (std::string_view key, std::string_view value)
 Set a tag on the span.
 
void add_event (std::string_view name)
 Add an event to the span.
 
void set_error (const std::exception &e)
 Mark the span as an error.
 
auto trace_id () const -> std::string
 Get the trace ID.
 
auto span_id () const -> std::string
 Get the span ID.
 
auto is_valid () const noexcept -> bool
 Check if span is valid (properly initialized)
 

Private Attributes

std::unique_ptr< implimpl_
 

Detailed Description

Represents a unit of work in distributed tracing.

A span tracks the execution of a single operation, recording timing, tags, and events. Spans are automatically finished when they go out of scope (RAII pattern).

Definition at line 274 of file monitoring_adapter.h.

Constructor & Destructor Documentation

◆ span() [1/3]

kcenon::pacs::integration::monitoring_adapter::span::span ( std::string_view operation_name)
explicit

Construct a new span.

Parameters
operation_nameName of the operation being traced
Examples
/home/runner/work/pacs_system/pacs_system/include/kcenon/pacs/integration/monitoring_adapter.h.

Definition at line 117 of file monitoring_adapter.cpp.

118 : impl_(std::make_unique<impl>(operation_name)) {}

◆ ~span()

kcenon::pacs::integration::monitoring_adapter::span::~span ( )
default

◆ span() [2/3]

kcenon::pacs::integration::monitoring_adapter::span::span ( const span & )
delete

◆ span() [3/3]

kcenon::pacs::integration::monitoring_adapter::span::span ( span && other)
defaultnoexcept

Member Function Documentation

◆ add_event()

void kcenon::pacs::integration::monitoring_adapter::span::add_event ( std::string_view name)

Add an event to the span.

Parameters
nameEvent name
Examples
/home/runner/work/pacs_system/pacs_system/include/kcenon/pacs/integration/monitoring_adapter.h.

Definition at line 132 of file monitoring_adapter.cpp.

132 {
133 if (impl_) {
135 }
136}
std::string_view name

References name.

◆ is_valid()

auto kcenon::pacs::integration::monitoring_adapter::span::is_valid ( ) const -> bool
nodiscardnoexcept

Check if span is valid (properly initialized)

Returns
true if span is valid
Examples
/home/runner/work/pacs_system/pacs_system/include/kcenon/pacs/integration/monitoring_adapter.h.

Definition at line 158 of file monitoring_adapter.cpp.

158 {
159 return impl_ && impl_->is_valid();
160}

References is_valid().

Referenced by is_valid().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator=() [1/2]

span & kcenon::pacs::integration::monitoring_adapter::span::operator= ( const span & )
delete

◆ operator=() [2/2]

monitoring_adapter::span & kcenon::pacs::integration::monitoring_adapter::span::operator= ( span && other)
defaultnoexcept

◆ set_error()

void kcenon::pacs::integration::monitoring_adapter::span::set_error ( const std::exception & e)

Mark the span as an error.

Parameters
eThe exception that occurred
Examples
/home/runner/work/pacs_system/pacs_system/include/kcenon/pacs/integration/monitoring_adapter.h.

Definition at line 138 of file monitoring_adapter.cpp.

138 {
139 if (impl_) {
140 impl_->set_error(e);
141 }
142}

◆ set_tag()

void kcenon::pacs::integration::monitoring_adapter::span::set_tag ( std::string_view key,
std::string_view value )

Set a tag on the span.

Parameters
keyTag name
valueTag value
Examples
/home/runner/work/pacs_system/pacs_system/include/kcenon/pacs/integration/monitoring_adapter.h.

Definition at line 126 of file monitoring_adapter.cpp.

126 {
127 if (impl_) {
128 impl_->set_tag(key, value);
129 }
130}
void set_tag(std::string_view key, std::string_view value)

◆ span_id()

auto kcenon::pacs::integration::monitoring_adapter::span::span_id ( ) const -> std::string
nodiscard

Get the span ID.

Returns
The span identifier
Examples
/home/runner/work/pacs_system/pacs_system/include/kcenon/pacs/integration/monitoring_adapter.h.

Definition at line 151 of file monitoring_adapter.cpp.

151 {
152 if (impl_) {
153 return impl_->span_id();
154 }
155 return "";
156}

◆ trace_id()

auto kcenon::pacs::integration::monitoring_adapter::span::trace_id ( ) const -> std::string
nodiscard

Get the trace ID.

Returns
The trace identifier
Examples
/home/runner/work/pacs_system/pacs_system/include/kcenon/pacs/integration/monitoring_adapter.h.

Definition at line 144 of file monitoring_adapter.cpp.

144 {
145 if (impl_) {
146 return impl_->trace_id();
147 }
148 return "";
149}

Member Data Documentation

◆ impl_

std::unique_ptr<impl> kcenon::pacs::integration::monitoring_adapter::span::impl_
private

The documentation for this class was generated from the following files: