Skip to main content

solenai-monitor

Report runtime errors to Solen MetaShift incident webhooks from Python. Registers sys.excepthook and asyncio unhandled-exception handlers automatically. No required dependencies—stdlib only (requests optional for HTTP).

Install

pip install solenai-monitor

Optional faster HTTP backend:

pip install "solenai-monitor[requests]"

Quick setup

import solenai_monitor

solenai_monitor.init(
    endpoint="https://api.solenai.ca/api/webhooks/incident/<endpointId>",
    secret="<your-secret>",
)

Calling init() registers handlers for uncaught exceptions and unhandled asyncio task failures. Failures while reporting are swallowed so your app never crashes because of the monitor.

Webhook URL and secret

Create an incident webhook endpoint in the Solen dashboard:

https://solenai.ca/integrations/webhooks

Each endpoint provides:

  • Webhook URL — MetaShift ingest URL (/api/webhooks/incident/{endpointId})
  • Secret — used to sign requests (X-Solen-Signature, HMAC-SHA256 of the JSON body) and authenticate (X-Solen-Secret)

Store both in environment variables (for example SOLEN_WEBHOOK_URL and SOLEN_WEBHOOK_SECRET) and pass them to init().

Payload

On exception, the SDK POSTs JSON:

{
  "source": "python",
  "error": "division by zero",
  "traceback": "Traceback (most recent call last):\n  ...",
  "timestamp": "2026-05-16T12:00:00.000000+00:00",
  "hostname": "my-host"
}

Headers:

  • Content-Type: application/json
  • X-Solen-Signature — hex HMAC-SHA256 of the raw body
  • X-Solen-Secret — shared webhook secret

Manual capture

import solenai_monitor

solenai_monitor.init(endpoint=url, secret=secret)

try:
    risky()
except Exception as exc:
    solenai_monitor.report_exception(exc)
    raise

Requirements

  • Python 3.8+
  • Optional: requests for HTTP (falls back to urllib.request)

Metadata

Release files for solenai-monitor 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for solenai-monitor 0.1.0
File Size Uploaded
solenai_monitor-0.1.0.tar.gz 4.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for solenai-monitor 0.1.0
File Interpreter ABI Platform
solenai_monitor-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 9.0 kB

Release files / solenai_monitor-0.1.0.tar.gz

Download URL solenai_monitor-0.1.0.tar.gz
Size 4.2 kB
Tags Source
SHA-256 checksum
How to use checksums
360e1e4c910bbdb8e4911be02ac8ab68358f9d8c314ff83583769b4bd831c1aa
BLAKE2b-256 checksum
How to use checksums
fa7bed77eb682261a198b8bea508eeb6b5d17b800faf40f19bca60cdf2c71f6a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

Release files / solenai_monitor-0.1.0-py3-none-any.whl

Download URL solenai_monitor-0.1.0-py3-none-any.whl
Size 4.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e91c0e67a8088f8635a6f51ba5861dbd1c6911349d1005d3baea13be4dbf91df
BLAKE2b-256 checksum
How to use checksums
37da1e2d5b8af1f92ae9c9d2d5b29101aea0c4da69913219cad8b6df5fca0573
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page