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.1.1.tar.gz (13.6 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.1.1-py3-none-any.whl (9.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: faro_sdk-0.1.1.tar.gz
  • Upload date:
  • Size: 13.6 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.1.1.tar.gz
Algorithm Hash digest
SHA256 3fb9d0760cbd39a5c9470d5fc96e722918d17fe166a68db1b3822c209d037437
MD5 c4ea741f9240399ac2b697d3b28b12da
BLAKE2b-256 e5fd861d5e49bfa342d0bed8e8f569739693ab648f2bcdd5741967cee7a2b9b8

See more details on using hashes here.

Provenance

The following attestation bundles were made for faro_sdk-0.1.1.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.1.1-py3-none-any.whl.

File metadata

  • Download URL: faro_sdk-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 9.2 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.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3e3d095a3215df8c507bfb1af8805fda7901123c226b78378ee616fd97748aa6
MD5 35bfcc8a80e14591f4d18f20007812e1
BLAKE2b-256 e5fb77a9914710559f105803f821cf263e3cb0095fae954617179f18596ad7a5

See more details on using hashes here.

Provenance

The following attestation bundles were made for faro_sdk-0.1.1-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