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.3.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.3.0-py3-none-any.whl (7.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: seqpulse-0.3.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.3.0.tar.gz
Algorithm Hash digest
SHA256 74d3436c5076c54b41b2f1c6a18f0273bf015ed3243da91505b17495b204f8ac
MD5 54e3fe7b97a57b7d1ab5bc3aa903a33b
BLAKE2b-256 20e821e08499a5832866427dd693ef4caa32662a1e91c6d4f85c3e3eb8079621

See more details on using hashes here.

File details

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

File metadata

  • Download URL: seqpulse-0.3.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.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7797fa3d612b98b5649e8686c8b3525caeb26c9f1a50f7bd78284e3ab08ac1d9
MD5 6cd4fefbef8098a6b06cc84911cf1eba
BLAKE2b-256 0da63aad5a0e9602232903f37c1c0f8b6dbfce0914a2d52a0d3d90c9aafafbf4

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