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)
| 85 | |
| 86 | |
| 87 | def 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 | |
| 110 | def get_span_attributes( |
no outgoing calls
searching dependent graphs…