Skip to main content

Transport-neutral actuator health and info contracts for Spakky Framework

Project description

Spakky Actuator

Transport-neutral actuator contracts for Spakky Framework.

Installation

pip install spakky-actuator

Features

  • Health, readiness, liveness results: Shared result contracts for HTTP, CLI, or other adapters
  • Probe extension points: Sync and async health probes registered through Spakky DI
  • Info contributors: Deterministic merge of sync and async info contributors
  • Exception handling: Probe exceptions become unhealthy component results with structured error details
  • Transport-neutral core: No FastAPI, Typer, or plugin adapter dependency

Endpoint Semantics

Surface Meaning Default behavior
health Aggregate application health for operator-facing status checks Evaluates probes whose endpoints include ActuatorEndpoint.HEALTH
readiness Whether the app is ready to serve traffic or work Evaluates readiness probes; required unhealthy probes make the result unhealthy
liveness Whether the process/framework is alive Separate from external dependency readiness; no custom liveness probes returns a healthy baseline
info Deterministic application metadata Merges registered info contributors by contributor name

By default, health probes participate in health and readiness, not liveness. Use ActuatorEndpoint.LIVENESS only for process-local checks that should not fail because an external dependency is unavailable.

Quick Start

from spakky.actuator import (
    AbstractHealthProbe,
    ActuatorAggregationService,
    ActuatorExtensionRegistry,
    ComponentHealthResult,
)


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

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


registry = ActuatorExtensionRegistry()
registry.register_health_probe(DatabaseProbe())

service = ActuatorAggregationService(registry)
health = service.evaluate_health()
readiness = service.evaluate_readiness()

Extension Points

Register AbstractHealthProbe or AbstractAsyncHealthProbe Pods to contribute component health. Register IInfoContributor or IAsyncInfoContributor Pods to contribute metadata to info. The actuator plugin adds ActuatorExtensionPostProcessor, which discovers those Pods and stores them in ActuatorExtensionRegistry.

from spakky.actuator import (
    AbstractHealthProbe,
    IInfoContributor,
    ActuatorEndpoint,
    ComponentHealthResult,
)


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)


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

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

Plugin-specific deep checks for SQLAlchemy, Kafka, RabbitMQ, Celery, or other integrations are intentionally not included in this milestone. Applications can add those checks as first-party probes without changing the transport adapters.

License

MIT License

Project details


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.3.1.tar.gz (6.0 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.3.1-py3-none-any.whl (10.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: spakky_actuator-6.3.1.tar.gz
  • Upload date:
  • Size: 6.0 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.3.1.tar.gz
Algorithm Hash digest
SHA256 4efa8127c06289b6d34dc9d7f20252184b5a1c71aaa3ab6ac1ca2b4f3020d0a9
MD5 a9fc0b3ddf17b1d112f55e818216d97f
BLAKE2b-256 164ccd0609f9d311389c780be0d89e37e9ee543c42f065149a88e702259c7cf3

See more details on using hashes here.

Provenance

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

Publisher: publish-package.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.3.1-py3-none-any.whl.

File metadata

File hashes

Hashes for spakky_actuator-6.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 38a2332a80baefec846864a85964641d94a8adf92451a8902c86a79e20b44197
MD5 4640e48ff0aa7c35eb692710cdb88fd2
BLAKE2b-256 4b6a72ff7e436b677d31f97ac0ed4b1e753e7c17632f9b93f578a2bf2a77f2fe

See more details on using hashes here.

Provenance

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

Publisher: publish-package.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 Pingdom Monitoring Sentry Error logging StatusPage Status page