MCPcopy Create free account
hub / github.com/AgentOps-AI/agentops / get_span_attributes

Function get_span_attributes

agentops/sdk/attributes.py:110–136  ·  view source on GitHub ↗

Get attributes for operation spans. Args: operation_name: Name of the operation being traced span_kind: Type of operation (from SpanKind) version: Optional version identifier for the operation **kwargs: Additional attributes to include Returns:

(
    operation_name: str, span_kind: str, version: Optional[int] = None, **kwargs: Any
)

Source from the content-addressed store, hash-verified

108
109
110def get_span_attributes(
111 operation_name: str, span_kind: str, version: Optional[int] = None, **kwargs: Any
112) -> dict[str, Any]:
113 """
114 Get attributes for operation spans.
115
116 Args:
117 operation_name: Name of the operation being traced
118 span_kind: Type of operation (from SpanKind)
119 version: Optional version identifier for the operation
120 **kwargs: Additional attributes to include
121
122 Returns:
123 dictionary containing span attributes
124 """
125 attributes: dict[str, Any] = {
126 SpanAttributes.AGENTOPS_SPAN_KIND: span_kind,
127 SpanAttributes.OPERATION_NAME: operation_name,
128 }
129
130 if version is not None:
131 attributes[SpanAttributes.OPERATION_VERSION] = version
132
133 # Add any additional attributes passed as kwargs
134 attributes.update(kwargs)
135
136 return attributes
137
138
139def get_session_end_attributes(end_state: str) -> dict[str, Any]:

Calls

no outgoing calls

Used in the wild real call sites across dependent graphs

searching dependent graphs…