Skip to main content

Faro SDK for Python — send logs and captured exceptions to a Faro instance.

Project description

faro-sdk (Python)

Perfil de defaults: server — flush 750ms · batch 200 · queue 10 000. Ver perfiles.

pip install faro-sdk
import faro_sdk as faro

faro.init(
    endpoint="https://faro.iaportafolio.com",
    token="...",                       # visible en /projects → SDK
    service="ingesta-csv",
    environment="production",
    release="git-sha-abc123",
    attributes={"region": "eu-west-1"},
)

faro.info("arranque ok", port=8080)

try:
    procesar(archivo)
except Exception as exc:
    faro.capture_exception(exc, tags={"archivo": archivo.name})
    raise

Integración con logging

import logging
from faro_sdk import FaroHandler

logging.basicConfig(level=logging.INFO)
logging.getLogger().addHandler(FaroHandler())

logging.info("auto-enviado a Faro")
try:
    raise ValueError("boom")
except Exception:
    logging.exception("falló el job")   # incluye stack trace

Captura automática

init() instala sys.excepthook y threading.excepthook (Python 3.8+). Cualquier excepción no manejada se envía a Faro antes de imprimirla en stderr.

Para desactivar: faro.init(..., install_global_handlers=False).

Flush / cierre

faro.flush(timeout=3.0)
# o, al cerrar la app:
faro.close()

atexit ya registra un cierre limpio al terminar el proceso, pero para scripts cortos llama explícitamente para no perder eventos.

Auto-correlación con traces

track() adjunta trace_id/span_id si OpenTelemetry está instalado y hay un span activo, o si pasas un provider explícito. El provider puede devolver un header W3C traceparent o un dict con trace_id/span_id:

faro.init(
    endpoint="https://faro.iaportafolio.com",
    token="...",
    service="checkout",
    trace_context=lambda: "00-4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7-01",
)

faro.track("checkout_completed")  # incluye trace_id + span_id

Opciones cross-SDK

warning() (alias de warn()), scrub_fields/scrub_headers/scrub_patterns y el hook before_send están disponibles aquí con la misma semántica que en el resto de SDKs. Ver API uniforme entre SDKs.

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

faro_sdk-0.2.0.tar.gz (26.2 kB view details)

Uploaded Source

Built Distribution

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

faro_sdk-0.2.0-py3-none-any.whl (20.1 kB view details)

Uploaded Python 3

File details

Details for the file faro_sdk-0.2.0.tar.gz.

File metadata

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

File hashes

Hashes for faro_sdk-0.2.0.tar.gz
Algorithm Hash digest
SHA256 064fff044e1e0d3413b4edbac7834df7c07f6d94f066da4e16e8112268ec56e3
MD5 53962f0cc61b29b88281d96dd58d2816
BLAKE2b-256 8a12ed23e828289cb4c1e03d408ad23bbaf04079b2001eb4cba8957fdd56a260

See more details on using hashes here.

Provenance

The following attestation bundles were made for faro_sdk-0.2.0.tar.gz:

Publisher: publish-sdks.yml on IA-Portafolio/faro

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

File details

Details for the file faro_sdk-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: faro_sdk-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 20.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for faro_sdk-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a77253423525fec7be36a9d7ad897ce69b83d180989662d2f3fb4d4bd0afed5c
MD5 610d19d25b1b9953cc20de5e18e87c89
BLAKE2b-256 155e72eb8a2fa47027b9e0e04904bdda2c6cf09de3e494000ff279ad56dba84d

See more details on using hashes here.

Provenance

The following attestation bundles were made for faro_sdk-0.2.0-py3-none-any.whl:

Publisher: publish-sdks.yml on IA-Portafolio/faro

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