System Reliability Assistant - SDK for automatic incident detection and response
Project description
System Reliability Assistant (SRA)
Lightweight Python SDK for automatic log collection, metrics tracking, and incident detection.
Installation
pip install sra
For system metrics collection:
pip install sra[metrics]
Quick Start
Basic Logging
from sra import SRALogger
logger = SRALogger(
api_key="your-api-key",
endpoint="https://your-backend.com",
service="my-service",
environment="production"
)
logger.info("Application started")
logger.warning("High memory usage detected")
logger.error("Database connection failed", extra={"db_host": "localhost"})
Integration with Python Logging
import logging
from sra import SRAHandler
handler = SRAHandler(
api_key="your-api-key",
endpoint="https://your-backend.com",
service="my-service"
)
logging.root.addHandler(handler)
logging.info("This is forwarded to SRA")
logging.error("Errors are captured automatically")
Metrics Collection
from sra import MetricsCollector
metrics = MetricsCollector(
api_key="your-api-key",
endpoint="https://your-backend.com",
service="my-service"
)
metrics.gauge("active_users", 150)
metrics.counter("requests_total")
metrics.timing("request_duration_ms", 45.2)
# Auto-collect system metrics
metrics.start_system_metrics(interval=30)
Exception Capture
from sra import SRALogger, capture_exceptions
logger = SRALogger(api_key="your-key", capture_exceptions=True)
@capture_exceptions(logger)
def risky_function():
return 1 / 0
Configuration
SRALogger Options
| Parameter | Type | Default | Description |
|---|---|---|---|
| api_key | str | required | Your API key |
| endpoint | str | http://localhost:8000 | Backend URL |
| service | str | None | Service name |
| environment | str | None | Environment |
| capture_exceptions | bool | True | Auto-capture exceptions |
| batch_size | int | 50 | Logs per batch |
| flush_interval | float | 5.0 | Seconds between flushes |
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
sra_sdk-0.1.0.tar.gz
(2.8 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sra_sdk-0.1.0.tar.gz.
File metadata
- Download URL: sra_sdk-0.1.0.tar.gz
- Upload date:
- Size: 2.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b8ad522f828bc92b88f7f09c342b7fe00c7387dcfcc6f734e6639af9fec6ad04
|
|
| MD5 |
8907efeadbc461bdf623435c122951cf
|
|
| BLAKE2b-256 |
57b116cfd2e45cb231e533e84c5922b6dd45e089c726187251ee8d0f4750bbca
|
File details
Details for the file sra_sdk-0.1.0-py3-none-any.whl.
File metadata
- Download URL: sra_sdk-0.1.0-py3-none-any.whl
- Upload date:
- Size: 2.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9a7cba07e2bff8f8c78001af69d8ab26c2a51fc91926d75738bc9df6e13669ec
|
|
| MD5 |
2232376179eac831e489f4a46cae13ca
|
|
| BLAKE2b-256 |
0c531afad3618b395a282a88628289f48a638114306dffe9ca295903e461e4bd
|