API: Interface¶
이 페이지는 Fluxgate 컴포넌트의 동작을 정의하는 핵심 인터페이스를 문서화합니다. 이 인터페이스를 구현하여 자신만의 커스텀 컴포넌트(Window, Tracker, Tripper, Retry, Permit, Listener)를 생성할 수 있습니다.
fluxgate.windows.Window
¶
Bases: ABC
Base class for sliding windows over recent call records.
Subclasses must override record, get_metric, and reset.
record
abstractmethod
¶
record(record: Record) -> None
Source code in fluxgate/windows.py
17 18 | |
get_metric
abstractmethod
¶
get_metric() -> Metric
Source code in fluxgate/windows.py
20 21 | |
reset
abstractmethod
¶
reset() -> None
Source code in fluxgate/windows.py
23 24 | |
fluxgate.trackers.Tracker
¶
Bases: ABC
Base class for exception trackers.
Subclasses override __call__. The &/|/~ operators build
composite trackers automatically.
__call__
abstractmethod
¶
__call__(exception: Exception) -> bool
Source code in fluxgate/trackers.py
18 19 | |
__and__
¶
Source code in fluxgate/trackers.py
21 22 | |
__or__
¶
Source code in fluxgate/trackers.py
24 25 | |
fluxgate.trippers.Tripper
¶
Bases: ABC
Base class for tripper conditions.
Subclasses must override __call__. Composite trippers (_And/_Or)
override __iter__ to expose their children; a leaf yields itself by
default. The & and | operators build composite trippers.
__call__
abstractmethod
¶
__call__(ctx: CallContext) -> bool
Source code in fluxgate/trippers.py
46 47 | |
__iter__
¶
__iter__() -> Iterator[Tripper]
Source code in fluxgate/trippers.py
49 50 | |
__and__
¶
Source code in fluxgate/trippers.py
52 53 | |
fluxgate.retries.Retry
¶
Bases: ABC
Base class for retry strategies.
Subclasses override __call__ to decide whether the breaker should
transition from OPEN to HALF_OPEN at the current moment.
__call__
abstractmethod
¶
__call__(changed_at: float, reopens: int) -> bool
Source code in fluxgate/retries.py
17 18 | |
fluxgate.permits.Permit
¶
Bases: ABC
Base class for permit strategies.
Subclasses override __call__ to decide whether a probe call should
be admitted while the breaker is in HALF_OPEN.
__call__
abstractmethod
¶
__call__(changed_at: float) -> bool
Source code in fluxgate/permits.py
17 18 | |
fluxgate.listeners.Listener
¶
Bases: Protocol
Protocol for synchronous circuit breaker listeners.
Any callable with the matching signature satisfies this protocol —
a plain function or a class implementing __call__.
__call__
¶
__call__(signal: Signal) -> None
Source code in fluxgate/listeners/base.py
18 | |