Span handlers
BaseSpanHandler #
Bases: BaseModel
, Generic[T]
Source code in llama-index-core/llama_index/core/instrumentation/span_handlers/base.py
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 |
|
class_name #
class_name() -> str
Class name.
Source code in llama-index-core/llama_index/core/instrumentation/span_handlers/base.py
43 44 45 |
|
span_enter #
span_enter(id_: str, bound_args: BoundArguments, instance: Optional[Any] = None, parent_id: Optional[str] = None, tags: Optional[Dict[str, Any]] = None, **kwargs: Any) -> None
Logic for entering a span.
Source code in llama-index-core/llama_index/core/instrumentation/span_handlers/base.py
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
|
span_exit #
span_exit(id_: str, bound_args: BoundArguments, instance: Optional[Any] = None, result: Optional[Any] = None, **kwargs: Any) -> None
Logic for exiting a span.
Source code in llama-index-core/llama_index/core/instrumentation/span_handlers/base.py
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 |
|
span_drop #
span_drop(id_: str, bound_args: BoundArguments, instance: Optional[Any] = None, err: Optional[BaseException] = None, **kwargs: Any) -> None
Logic for dropping a span i.e. early exit.
Source code in llama-index-core/llama_index/core/instrumentation/span_handlers/base.py
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 |
|
new_span
abstractmethod
#
new_span(id_: str, bound_args: BoundArguments, instance: Optional[Any] = None, parent_span_id: Optional[str] = None, tags: Optional[Dict[str, Any]] = None, **kwargs: Any) -> Optional[T]
Create a span.
Subclasses of BaseSpanHandler should create the respective span type T and return it. Only NullSpanHandler should return a None here.
Source code in llama-index-core/llama_index/core/instrumentation/span_handlers/base.py
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 |
|
prepare_to_exit_span
abstractmethod
#
prepare_to_exit_span(id_: str, bound_args: BoundArguments, instance: Optional[Any] = None, result: Optional[Any] = None, **kwargs: Any) -> Optional[T]
Logic for preparing to exit a span.
Subclasses of BaseSpanHandler should return back the specific span T that is to be exited. If None is returned, then the span won't actually be exited.
Source code in llama-index-core/llama_index/core/instrumentation/span_handlers/base.py
126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 |
|
prepare_to_drop_span
abstractmethod
#
prepare_to_drop_span(id_: str, bound_args: BoundArguments, instance: Optional[Any] = None, err: Optional[BaseException] = None, **kwargs: Any) -> Optional[T]
Logic for preparing to drop a span.
Subclasses of BaseSpanHandler should return back the specific span T that is to be dropped. If None is returned, then the span won't actually be dropped.
Source code in llama-index-core/llama_index/core/instrumentation/span_handlers/base.py
143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 |
|
SimpleSpanHandler #
Bases: BaseSpanHandler[SimpleSpan]
Span Handler that manages SimpleSpan's.
Source code in llama-index-core/llama_index/core/instrumentation/span_handlers/simple.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 |
|
class_name #
class_name() -> str
Class name.
Source code in llama-index-core/llama_index/core/instrumentation/span_handlers/simple.py
16 17 18 |
|
new_span #
new_span(id_: str, bound_args: BoundArguments, instance: Optional[Any] = None, parent_span_id: Optional[str] = None, tags: Optional[Dict[str, Any]] = None, **kwargs: Any) -> SimpleSpan
Create a span.
Source code in llama-index-core/llama_index/core/instrumentation/span_handlers/simple.py
20 21 22 23 24 25 26 27 28 29 30 |
|
prepare_to_exit_span #
prepare_to_exit_span(id_: str, bound_args: BoundArguments, instance: Optional[Any] = None, result: Optional[Any] = None, **kwargs: Any) -> SimpleSpan
Logic for preparing to drop a span.
Source code in llama-index-core/llama_index/core/instrumentation/span_handlers/simple.py
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
|
prepare_to_drop_span #
prepare_to_drop_span(id_: str, bound_args: BoundArguments, instance: Optional[Any] = None, err: Optional[BaseException] = None, **kwargs: Any) -> Optional[SimpleSpan]
Logic for droppping a span.
Source code in llama-index-core/llama_index/core/instrumentation/span_handlers/simple.py
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
|
print_trace_trees #
print_trace_trees() -> None
Method for viewing trace trees.
Source code in llama-index-core/llama_index/core/instrumentation/span_handlers/simple.py
142 143 144 145 146 147 |
|