/ src / evidently / ui / service / components / tracing.py
tracing.py
 1  from abc import ABC
 2  from typing import Callable
 3  from typing import ClassVar
 4  
 5  from evidently.ui.service.components.base import Component
 6  from evidently.ui.service.components.base import ComponentContext
 7  from evidently.ui.service.components.base import FactoryComponent
 8  from evidently.ui.service.tracing.storage.base import TracingStorage
 9  
10  
11  class TracingStorageComponent(FactoryComponent[TracingStorage], ABC):
12      """Base component for tracing storage."""
13  
14      class Config:
15          is_base_type = True
16  
17      __section__: ClassVar[str] = "tracing_storage"
18      dependency_name: ClassVar[str] = "tracing_storage"
19      use_cache: ClassVar[bool] = True
20  
21      def dependency_factory(self) -> Callable[..., TracingStorage]:
22          raise NotImplementedError(self.__class__)
23  
24  
25  class TracingComponent(Component):
26      """Component for tracing support."""
27  
28      __section__: ClassVar[str] = "tracing"
29  
30      def get_api_route_handlers(self, ctx: ComponentContext):
31          from evidently.ui.service.components.security import SecurityComponent
32          from evidently.ui.service.tracing.api import tracing_api
33  
34          guard = ctx.get_component(SecurityComponent).get_auth_guard()
35          return [tracing_api(guard)]