Skip to main content

SeqPulse SDK for metrics endpoint instrumentation and HMAC validation

Project description

seqpulse (Python SDK)

SeqPulse Python SDK couvre deux usages:

  • Runtime application: instrumentation HTTP + endpoint metrics + validation HMAC v2
  • CI/CD integration: client trigger/finish pour orchestrer un deployment SeqPulse

Install

pip install seqpulse

Runtime (FastAPI)

from fastapi import FastAPI
from seqpulse import SeqPulse

app = FastAPI()

seqpulse = SeqPulse(
    endpoint="/seqpulse-metrics",
    hmac_enabled=True,
    hmac_secret="hmac_xxx",
)

app.middleware("http")(seqpulse.middleware())

GET /seqpulse-metrics returns:

{
  "metrics": {
    "requests_per_sec": 0.25,
    "latency_p95": 31.221,
    "error_rate": 0,
    "cpu_usage": 0.42,
    "memory_usage": 0.18
  }
}

CI/CD client (trigger/finish)

from seqpulse import create_ci_client

client = create_ci_client(
    base_url="https://api.seqpulse.dev",
    api_key="sp_xxx",
    metrics_endpoint="https://your-app.example.com/seqpulse-metrics",
    env="prod",
    non_blocking=True,
)

trigger = client.trigger(branch="main")

# Deploy your app here...
deploy_succeeded = True

if trigger.get("ok") and trigger.get("deployment_id"):
    client.finish(
        deployment_id=trigger["deployment_id"],
        result="success" if deploy_succeeded else "failed",
    )

CI behavior

  • non_blocking=True (default): retourne un resultat skipped/error, sans lever d'exception.
  • non_blocking=False: leve une exception sur erreur API/config.
  • helpers inclus: build_ci_idempotency_key(), infer_result_from_pipeline_status().

Compatibility note

Cette evolution n'ecrase pas le SDK runtime actuel:

  • l'endpoint /seqpulse-metrics reste le meme
  • la logique HMAC runtime reste la meme
  • le client CI est ajoute en couche supplementaire

Local smoke test

python scripts/smoke.py

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

seqpulse-0.4.0.tar.gz (7.3 kB view details)

Uploaded Source

Built Distribution

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

seqpulse-0.4.0-py3-none-any.whl (7.9 kB view details)

Uploaded Python 3

File details

Details for the file seqpulse-0.4.0.tar.gz.

File metadata

  • Download URL: seqpulse-0.4.0.tar.gz
  • Upload date:
  • Size: 7.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for seqpulse-0.4.0.tar.gz
Algorithm Hash digest
SHA256 5a25a59fb0d65f36da6f39ce0090ce3e647224695967bfa4ba270f5c38bae44b
MD5 0fdfa4d585bb34ff285f5d6a14d197c8
BLAKE2b-256 240cc7b8fbf4cd1d42b21a6240591e2090e6702f38db51102858140c702d8aac

See more details on using hashes here.

File details

Details for the file seqpulse-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: seqpulse-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 7.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for seqpulse-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6c6d8a3e051711081643a233642f3af3db8998dac8fcfa5e6645a3e2acc16155
MD5 1b52f9a902e209a06dad05d27ceb47b3
BLAKE2b-256 18ffffc5396425c09bad952e7848e6dcb673d84d3975ed4573b5b07dbad33136

See more details on using hashes here.

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