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

Function get_trace_attributes

agentops/sdk/attributes.py:87–107  ·  view source on GitHub ↗

Get attributes for trace spans. Args: tags: Optional tags to include (dict or list) Returns: dictionary containing trace attributes

(tags: Optional[Union[dict[str, Any], list[str]]] = None)

Source from the content-addressed store, hash-verified

85
86
87def get_trace_attributes(tags: Optional[Union[dict[str, Any], list[str]]] = None) -> dict[str, Any]:
88 """
89 Get attributes for trace spans.
90
91 Args:
92 tags: Optional tags to include (dict or list)
93
94 Returns:
95 dictionary containing trace attributes
96 """
97 attributes: dict[str, Any] = {}
98
99 if tags:
100 if isinstance(tags, list):
101 attributes[CoreAttributes.TAGS] = tags
102 elif isinstance(tags, dict):
103 attributes.update(tags) # Add dict tags directly
104 else:
105 logger.warning(f"Invalid tags format: {tags}. Must be list or dict.")
106
107 return attributes
108
109
110def get_span_attributes(

Callers 9

start_traceMethod · 0.90
test_no_tagsMethod · 0.90
test_list_tagsMethod · 0.90
test_dict_tagsMethod · 0.90
test_mixed_dict_tagsMethod · 0.90
test_none_tagsMethod · 0.90

Calls

no outgoing calls

Tested by 8

test_no_tagsMethod · 0.72
test_list_tagsMethod · 0.72
test_dict_tagsMethod · 0.72
test_mixed_dict_tagsMethod · 0.72
test_none_tagsMethod · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…