Skip to main content

Spakky Actuator

Spakky Framework를 위한 transport 중립 actuator 계약입니다. Health, readiness, liveness, info 상태를 HTTP나 CLI adapter와 분리된 모델로 집계합니다.

설치

pip install spakky-actuator

주요 기능

  • Health/readiness/liveness 결과: HTTP, CLI 등 adapter가 공유하는 result 계약
  • Probe 확장 지점: Spakky DI로 등록되는 동기/비동기 health probe
  • Info contributor: 동기/비동기 info contributor의 결정적 병합
  • Startup diagnostics contributor: SpakkyApplication startup report를 actuator info로 노출
  • 예외 처리: Probe 예외를 구조화된 에러 상세가 포함된 비정상 component result로 변환
  • Transport 중립 core: FastAPI, Typer, plugin adapter 의존성 없음

Endpoint Semantics

Surface Meaning Default behavior
health operator-facing status check용 aggregate application health ActuatorEndpoint.HEALTHendpoints에 포함하는 probe 평가
readiness app이 traffic 또는 work를 받을 준비가 되었는지 readiness probe 평가; 필수 unhealthy probe가 있으면 결과 unhealthy
liveness process/framework 생존 여부 외부 dependency readiness와 분리; custom liveness probe가 없으면 healthy baseline 반환
info 결정적 application metadata 등록된 info contributor를 contributor 이름 기준으로 병합

기본적으로 health probe는 liveness가 아니라 healthreadiness에 참여합니다. 외부 의존성을 사용할 수 없다는 이유로 실패하면 안 되는 프로세스 내부 check에만 ActuatorEndpoint.LIVENESS를 사용하세요.

빠른 시작

from spakky.actuator import (
    AbstractHealthProbe,
    ActuatorAggregationService,
    ComponentHealthResult,
)
from spakky.core.application.application import SpakkyApplication
from spakky.core.application.application_context import ApplicationContext
from spakky.core.application.plugin import Plugin
from spakky.core.pod.annotations.pod import Pod


@Pod()
class DatabaseProbe(AbstractHealthProbe):
    @property
    def name(self) -> str:
        return "database"

    def check(self) -> ComponentHealthResult:
        return ComponentHealthResult.healthy(self.name)


app = (
    SpakkyApplication(ApplicationContext())
    .load_plugins(include={Plugin(name="spakky-actuator")})
    .add(DatabaseProbe)
    .start()
)
service = app.container.get(type_=ActuatorAggregationService)
health = service.evaluate_health()
readiness = service.evaluate_readiness()

Extension Points

Component health를 제공하려면 AbstractHealthProbe 또는 AbstractAsyncHealthProbe Pod를 등록하세요. info에 metadata를 제공하려면 IInfoContributor 또는 IAsyncInfoContributor Pod를 등록하세요. Actuator 플러그인은 ActuatorExtensionPostProcessor를 추가하여 DI가 관리하는 extension Pod를 발견하고 ActuatorExtensionRegistry에 저장합니다.

from spakky.actuator import (
    AbstractHealthProbe,
    IInfoContributor,
    ActuatorEndpoint,
    ComponentHealthResult,
)
from spakky.core.pod.annotations.pod import Pod


@Pod()
class ProcessProbe(AbstractHealthProbe):
    @property
    def name(self) -> str:
        return "process"

    @property
    def endpoints(self) -> tuple[ActuatorEndpoint, ...]:
        return (ActuatorEndpoint.LIVENESS,)

    def check(self) -> ComponentHealthResult:
        return ComponentHealthResult.healthy(self.name)


@Pod()
class BuildInfo(IInfoContributor):
    @property
    def name(self) -> str:
        return "build"

    def contribute_info(self) -> dict[str, object]:
        return {"version": "1.0.0"}

Backend plugin은 자신이 소유한 외부 의존 상태를 first-party probe/contributor로 등록합니다. 예를 들어 spakky-redis는 Redis 연결 상태와 cache metrics를 actuator health/info에 연결합니다. 애플리케이션은 transport adapter를 바꾸지 않고 같은 계약으로 자체 check를 추가할 수 있습니다.

개발 검증

패키지 단위 검증은 해당 패키지 디렉토리에서 실행합니다.

uv run ruff format .
uv run ruff check .
uv run pyrefly check
uv run pytest

pytest는 각 패키지 pyproject.toml의 coverage 설정을 사용합니다.

라이선스

MIT License

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

spakky_actuator-6.11.0.tar.gz (7.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

spakky_actuator-6.11.0-py3-none-any.whl (12.1 kB view details)

Uploaded Python 3

File details

Details for the file spakky_actuator-6.11.0.tar.gz.

File metadata

  • Download URL: spakky_actuator-6.11.0.tar.gz
  • Upload date:
  • Size: 7.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for spakky_actuator-6.11.0.tar.gz
Algorithm Hash digest
SHA256 1f81a7083b22ec0d8e66878f388ef119c65546f06d698ed8ae49f477f1c6cb43
MD5 0eac92cfa286504870ad38efe7c879de
BLAKE2b-256 17df7480655613c950ee175edfd572c7865b1c95f77177ce71b1bc1a1026d559

See more details on using hashes here.

Provenance

The following attestation bundles were made for spakky_actuator-6.11.0.tar.gz:

Publisher: release.yml on E5presso/spakky-framework

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file spakky_actuator-6.11.0-py3-none-any.whl.

File metadata

File hashes

Hashes for spakky_actuator-6.11.0-py3-none-any.whl
Algorithm Hash digest
SHA256 df6ad81ac80b2a681fae2262c9f7e3e580d3915ed5b4f90c4f7cac1560f8f399
MD5 b38ad3db34313d0117a3a844e0c518bf
BLAKE2b-256 3de468eb954e16cecde499e0b4a255dad26c8e4e68c8eea1af89f476bae127f7

See more details on using hashes here.

Provenance

The following attestation bundles were made for spakky_actuator-6.11.0-py3-none-any.whl:

Publisher: release.yml on E5presso/spakky-framework

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page