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 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 |
|
class_name #
class_name() -> str
Class name.
Source code in llama-index-core/llama_index/core/instrumentation/span_handlers/base.py
45 46 47 |
|
span_enter #
span_enter(id_: str, bound_args: BoundArguments, instance: Optional[Any] = None, parent_id: Optional[str] = None, **kwargs: Any) -> None
Logic for entering a span.
Source code in llama-index-core/llama_index/core/instrumentation/span_handlers/base.py
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
|
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
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
|
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
111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 |
|
new_span
abstractmethod
#
new_span(id_: str, bound_args: BoundArguments, instance: Optional[Any] = None, parent_span_id: Optional[str] = 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
129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 |
|
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
145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 |
|
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
162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 |
|
SimpleSpanHandler #
Bases: BaseSpanHandler[SimpleSpan]
Span Handler that managest 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 |
|
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, **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 |
|
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
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
|
prepare_to_drop_span #
prepare_to_drop_span(id_: str, bound_args: BoundArguments, instance: Optional[Any] = None, err: Optional[BaseException] = None, **kwargs: Any) -> SimpleSpan
Logic for droppping a span.
Source code in llama-index-core/llama_index/core/instrumentation/span_handlers/simple.py
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
|
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
141 142 143 144 145 146 |
|