Skip to main content

Stimpact Python telemetry SDK

Project description

Stimpact Python SDK

The Python SDK sends runtime exceptions to the Stimpact agent platform using a project-scoped API key.

Capture contract

Use Stimpact in two layers:

  • auto-capture for uncaught process and thread exceptions with install_auto_capture()
  • handled-error capture for exceptions you catch deliberately with capture_handled_exception(), wrap(), or wrap_async()

Transport failures still raise StimpactRequestError, but the auto-capture hooks swallow those reporting failures so they do not create recursive exception loops.

Install

pip install stimpact-sdk

Basic usage

from stimpact_sdk import StimpactClient

client = StimpactClient.from_env(
    service="billing-api",
    environment="production",
)

client.install_auto_capture()

try:
    charge_customer()
except Exception as exc:
    client.capture_handled_exception(
        exc,
        request={"method": "POST", "url": "/api/charge"},
    )
    raise

Wrapped operations

For synchronous work:

client.wrap(lambda: charge_customer(), request={"method": "POST", "url": "/api/charge"})

For async work:

await client.wrap_async(
    lambda: charge_customer_async(),
    request={"method": "POST", "url": "/api/charge"},
)

When your framework already catches and renders exceptions, capture them once in the shared request or task boundary rather than in every individual UI or business-logic call site.

Environment variables

  • STIMPACT_BASE_URL
  • STIMPACT_PROJECT_ID
  • STIMPACT_API_KEY
  • STIMPACT_SERVICE
  • STIMPACT_ENVIRONMENT

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

stimpact_sdk-0.3.0.tar.gz (5.5 kB view details)

Uploaded Source

Built Distribution

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

stimpact_sdk-0.3.0-py3-none-any.whl (6.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: stimpact_sdk-0.3.0.tar.gz
  • Upload date:
  • Size: 5.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for stimpact_sdk-0.3.0.tar.gz
Algorithm Hash digest
SHA256 89ee71e3d1b836e1b80307cc8b66045c056837f06d69b5221504a4a9bbb1095a
MD5 8cc04e854f6f18bac7fd5a7a5636d2f8
BLAKE2b-256 657feb3d235ff63fd04643c186f64e25b64474ca5f169b99b1256236126075d0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: stimpact_sdk-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 6.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for stimpact_sdk-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a067882ca6b5f134c4bf71869f6c8f783b2249f8a27714991e77c5e22c495d7f
MD5 4997948877390f41af44db1d002890e4
BLAKE2b-256 f585b1714acba9b8b9e44061c69c679375d0b8fc8487d53666badf6b55c35418

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