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-sdk
For system metrics collection:
pip install sra-sdk[metrics]
Quick Start
Basic Logging
from sra_sdk 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_sdk 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_sdk 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_sdk 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.1.tar.gz
(8.5 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.1.tar.gz.
File metadata
- Download URL: sra_sdk-0.1.1.tar.gz
- Upload date:
- Size: 8.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ac5937f1889597195df9649e49f8d149e07a29a2ca816bfa8b41ef87c8472967
|
|
| MD5 |
050cd647e36e9ecbbb60ff6f14d5bbb8
|
|
| BLAKE2b-256 |
fcf4916096d2d4969736312c10205349bee89dc8ac70e0f3f3af765defdc5015
|
File details
Details for the file sra_sdk-0.1.1-py3-none-any.whl.
File metadata
- Download URL: sra_sdk-0.1.1-py3-none-any.whl
- Upload date:
- Size: 8.6 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 |
88e02eb67a180ea922c0728be7fec63c8c7205c1ca89530c76f39ac4dd12ccba
|
|
| MD5 |
301b0b45a663125f1ea92b90e40fa931
|
|
| BLAKE2b-256 |
0982ab72f4997af928c28998f4dadc8fd2dc1e9b02ba348778d4be68c346d120
|