Metadata-Version: 2.4
Name: finanfut-watchtower-sdk
Version: 0.3.0
Summary: Python SDK for FinanFut Watchtower.
Requires-Python: >=3.10
Description-Content-Type: text/markdown
Requires-Dist: httpx>=0.27
Requires-Dist: pydantic>=2.8
Provides-Extra: fastapi
Requires-Dist: fastapi>=0.115; extra == "fastapi"
Provides-Extra: dev
Requires-Dist: pytest>=8.3; extra == "dev"
Requires-Dist: ruff>=0.6; extra == "dev"

# FinanFut Watchtower SDK

Python SDK for sending application telemetry to FinanFut Watchtower.

Install the published package with FastAPI support:

```bash
pip install "finanfut-watchtower-sdk[fastapi]==0.2.0"
```

Until `0.2.0` is published, use the temporary Git dependency:

```text
finanfut-watchtower-sdk[fastapi] @ git+https://github.com/erovirafinanfut/FinanFut_WatchTower.git@main#subdirectory=packages/finanfut-watchtower-sdk
```

```python
import finanfut_watchtower as watchtower

watchtower.configure_from_env(
    service="billing-api",
    environment="development",
)
watchtower.install_logging()

try:
    raise RuntimeError("boom")
except RuntimeError as exc:
    watchtower.capture_exception(exc, event="example_failed")

watchtower.capture_metric("cache.hits", 1, unit="count", kind="counter")
```

Recommended environment:

```bash
WATCHTOWER_SDK_ENDPOINT=http://localhost:8000
WATCHTOWER_SDK_PROJECT_KEY=pk_dev_watchtower
WATCHTOWER_SDK_SECRET_KEY=sk_dev_watchtower_change_me
WATCHTOWER_SDK_SERVICE=finanfut-billing-api
WATCHTOWER_SDK_ENVIRONMENT=development
WATCHTOWER_LOG_LEVEL=WARNING
WATCHTOWER_ISSUE_LEVEL=ERROR
WATCHTOWER_BREADCRUMB_LEVEL=INFO
WATCHTOWER_LOG_SAMPLE_RATE=1.0
WATCHTOWER_MAX_LOGS_PER_MINUTE=300
WATCHTOWER_LOG_BATCH_SIZE=50
WATCHTOWER_LOG_FLUSH_INTERVAL_SECONDS=5
WATCHTOWER_PROMOTE_EXCEPTIONS_TO_ISSUES=true
```

Integrations:

- `finanfut_watchtower.integrations.fastapi.WatchtowerMiddleware`
- `finanfut_watchtower.install_logging()` for Python logging
- `finanfut_watchtower.integrations.logging.WatchtowerLoggingHandler`
- `finanfut_watchtower.monitor_job`
- `finanfut_watchtower.capture_metric`

`install_logging()` keeps existing stdout/Render handlers intact, sends
`WARNING+` records as structured logs and links `ERROR/CRITICAL` records to
issues. It is a direct SDK logging path, not Render Log Streams.
