Skip to content

Class swarmauri_core.tracing.ITraceContext.ITraceContext

swarmauri_core.tracing.ITraceContext.ITraceContext

Bases: ABC

Interface for a trace context, representing a single trace instance. This context carries the state and metadata of the trace across different system components.

get_trace_id abstractmethod

get_trace_id()

Retrieves the unique identifier for this trace.

RETURNS DESCRIPTION
str

The unique trace identifier.

TYPE: str

Source code in swarmauri_core/tracing/ITraceContext.py
11
12
13
14
15
16
17
18
19
@abstractmethod
def get_trace_id(self) -> str:
    """
    Retrieves the unique identifier for this trace.

    Returns:
        str: The unique trace identifier.
    """
    pass

add_attribute abstractmethod

add_attribute(key, value)

Adds or updates an attribute associated with this trace.

PARAMETER DESCRIPTION
key

The attribute key or name.

TYPE: str

value

The value of the attribute.

TYPE: Any

Source code in swarmauri_core/tracing/ITraceContext.py
21
22
23
24
25
26
27
28
29
30
@abstractmethod
def add_attribute(self, key: str, value: Any):
    """
    Adds or updates an attribute associated with this trace.

    Args:
        key (str): The attribute key or name.
        value (Any): The value of the attribute.
    """
    pass