Add your description here
Project description
๐ก๏ธ UYEIA
Unified Yet Easy Issue Alerts - A comprehensive error monitoring and status management system for Python applications.
๐ Overview
UYEIA is a sophisticated yet easy-to-use Python library designed for monitoring application health, managing error states, and providing centralized error tracking across distributed systems. It offers a thread-safe, SQLite-backed caching system with configurable status levels, automatic escalation mechanisms, and flexible logging integration.
โจ Key Features
- ๐ Real-time Status Monitoring: Track application health with customizable status levels
- ๐ Centralized Error Management: JSON-based error configuration with dynamic message templating
- ๐๏ธ Persistent Cache System: SQLite-backed storage for status persistence across sessions
- ๐ Thread-Safe Operations: Built-in threading support for concurrent applications
- ๐ Automatic Escalation: Configurable error escalation based on occurrence patterns
- ๐ง Flexible Configuration: Highly customizable status levels, logging, and behavior
- ๐พ Secure Vault Storage: Key-value storage for sensitive configuration data
- ๐ชต Integrated Logging: Seamless integration with Python's logging framework
๐ Quick Start
Installation
pip install uyeia
Basic Usage
import uyeia
import logging
# Configure UYEIA
config = uyeia.Config(
status={
"HEALTHY": 20,
"WARNING": 40,
"CRITICAL": 50
},
error_config_location="./errors.json"
)
uyeia.set_global_config(config)
# Create a watcher
logger = logging.getLogger("my_app")
watcher = uyeia.Watcher(logger=logger)
# Register an error
watcher.register("E001", "Custom error message", {"user_id": "12345"})
# Check current status
status = watcher.get_actual_status()
print(f"Current status: {status}")
# Get all errors
all_errors = uyeia.get_errors()
print(f"All errors: {all_errors}")
# Release the error when resolved
watcher.release()
Error Configuration
Create an errors.json file to define your error codes:
{
"E001": {
"status": "WARNING",
"message": "Database connection timeout for user {{user_id}}",
"solution": "Check database connectivity and retry"
},
"E002": {
"status": "CRITICAL",
"message": "Authentication service unavailable",
"solution": "Contact system administrator immediately"
}
}
๐ Detailed Usage
Configuration Options
from uyeia import Config
config = Config(
# Define status hierarchy (name: log_level)
status={
"HEALTHY": 20, # INFO level
"PENDING": 20, # INFO level
"LIMITED": 30, # WARNING level
"WARNING": 40, # ERROR level
"RESCUE": 50 # CRITICAL level
},
# Escalation settings
escalation_status="RESCUE", # Status to escalate to
max_escalation=5, # Max escalations before critical
disable_escalation=False, # Enable/disable escalation
# Default values
default_healthy="HEALTHY",
default_solution="Contact your IT admin.",
# File locations
error_config_location="./uyeia.errors.json",
error_cache_location="./errors_cache.db",
# Behavior
disable_logging=False # Enable/disable automatic logging
)
Advanced Watcher Usage
import uyeia
import logging
# Method 1: Using logger
logger = logging.getLogger("database")
watcher = uyeia.Watcher(logger=logger)
# Method 2: Using name
watcher = uyeia.Watcher(name="api_service")
# Register error with variable substitution
watcher.register(
error_code="DB_TIMEOUT",
custom_message="Connection failed after {{timeout}}s",
vars={"timeout": "30", "retry_count": "3"}
)
# Clear all errors for this watcher
watcher.release()
Error Retrieval Modes
# Get all errors grouped by status
all_errors = uyeia.get_errors("all")
# Get only the highest severity errors currently active
hot_errors = uyeia.get_errors("hot")
# Get only the lowest severity errors currently active
cold_errors = uyeia.get_errors("cold")
Vault Storage
# Secure key-value storage
vault = uyeia.Vault()
# Store sensitive data
vault.set("api_key", "secret_key_12345")
vault.set("db_password", "super_secure_password")
# Retrieve data
api_key = vault.get("api_key")
# Remove data
vault.remove("api_key")
Error Escalation
# Manual escalation (increases escalation count for all non-critical errors)
uyeia.escalate()
# Errors that reach max_escalation count automatically become critical status
๐๏ธ Architecture
Core Components
- Watcher: Individual monitors for different application components
- Manager: Central coordination of all watchers and cache operations
- UyeiaCache: SQLite-backed persistent storage system
- Config: Configuration management with validation
- Vault: Secure key-value storage for sensitive data
Data Flow
Application Error โ Watcher โ Manager โ Cache (SQLite) โ Status Retrieval
โ
Logging System
๐งช Testing
Run the test suite:
# Run all tests
pytest
# Run specific test file
pytest tests/test_cache_operation.py
# Run with coverage
pytest --cov=src/uyeia
# Lint code
rye run lint
# Format code
rye run format
๐ Status Hierarchy
UYEIA uses a hierarchical status system where higher values indicate more severe issues:
| Status | Default Level | Description |
|---|---|---|
| HEALTHY | 20 (INFO) | Normal operation |
| PENDING | 20 (INFO) | Temporary issues |
| LIMITED | 30 (WARNING) | Degraded functionality |
| WARNING | 40 (ERROR) | Significant problems |
| RESCUE | 50 (CRITICAL) | Critical failures |
๐ง Configuration Files
Error Definitions (uyeia.errors.json)
{
"SERVICE_001": {
"status": "WARNING",
"message": "Service {{service_name}} is experiencing delays",
"solution": "Monitor service performance and consider scaling"
},
"AUTH_002": {
"status": "CRITICAL",
"message": "Authentication service completely down",
"solution": "Immediate intervention required - check service logs"
}
}
Variable Substitution
Use {{variable_name}} in error messages for dynamic content:
watcher.register(
"SERVICE_001",
vars={"service_name": "payment_processor", "latency": "2.5s"}
)
๐ ๏ธ Development
Setup Development Environment
# Clone repository
git clone https://github.com/David-Aires/uyeia.git
cd uyeia
# Install dependencies with Rye
rye sync
# Run tests
rye run test
# Format code
rye run format
# Lint code
rye run lint
Project Structure
uyeia/
โโโ src/uyeia/ # Main package
โ โโโ __init__.py # Main API and Watcher/Manager classes
โ โโโ cache.py # SQLite caching system
โ โโโ type.py # Type definitions and Config
โ โโโ exceptions.py # Custom exceptions
โ โโโ serializers.py # Validation utilities
โโโ tests/ # Test suite
โโโ pyproject.toml # Project configuration
โโโ README.md # This file
๐ค Contributing
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Make your changes
- Add tests for new functionality
- Run the test suite (
rye run test) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
๐ License
This project is licensed under the MIT License - see the LICENSE file for details.
๐ Support
- Issues: GitHub Issues
- Documentation: Project Wiki
๐ Acknowledgments
- Built with โค๏ธ for robust application monitoring
- Inspired by the need for simple yet powerful error tracking
- Thanks to all contributors who help improve UYEIA
UYEIA - Making error monitoring unified, yet easy! ๐ก๏ธ
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
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 uyeia-1.0.1.tar.gz.
File metadata
- Download URL: uyeia-1.0.1.tar.gz
- Upload date:
- Size: 15.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d5126f4ca056a20444712e4887faefc61f8f52540fb5c2dedfa58fe15039fbe5
|
|
| MD5 |
fc92ee5262413f65273b3af3d8a613fc
|
|
| BLAKE2b-256 |
8338177d8acbf7f6d9a3b9915760621097ad074e82cadaafbff09143ad08f758
|
Provenance
The following attestation bundles were made for uyeia-1.0.1.tar.gz:
Publisher:
packaging.yml on David-Aires/uyeia
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
uyeia-1.0.1.tar.gz -
Subject digest:
d5126f4ca056a20444712e4887faefc61f8f52540fb5c2dedfa58fe15039fbe5 - Sigstore transparency entry: 686904780
- Sigstore integration time:
-
Permalink:
David-Aires/uyeia@6f29e06f1a0536a9cbbc35e4a26bed4409f42369 -
Branch / Tag:
refs/tags/v1.0.1 - Owner: https://github.com/David-Aires
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
packaging.yml@6f29e06f1a0536a9cbbc35e4a26bed4409f42369 -
Trigger Event:
push
-
Statement type:
File details
Details for the file uyeia-1.0.1-py3-none-any.whl.
File metadata
- Download URL: uyeia-1.0.1-py3-none-any.whl
- Upload date:
- Size: 11.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b089065d941f7e1275970a4394d2729d64d776a21fe5d770ab6785bba8559054
|
|
| MD5 |
9a6a22dd6beb84b64d46c05f62b32a6b
|
|
| BLAKE2b-256 |
d6f70fae30ce13ad5357690510e4c6c891aa74d530c106c3ae25af438e47cbdc
|
Provenance
The following attestation bundles were made for uyeia-1.0.1-py3-none-any.whl:
Publisher:
packaging.yml on David-Aires/uyeia
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
uyeia-1.0.1-py3-none-any.whl -
Subject digest:
b089065d941f7e1275970a4394d2729d64d776a21fe5d770ab6785bba8559054 - Sigstore transparency entry: 686904790
- Sigstore integration time:
-
Permalink:
David-Aires/uyeia@6f29e06f1a0536a9cbbc35e4a26bed4409f42369 -
Branch / Tag:
refs/tags/v1.0.1 - Owner: https://github.com/David-Aires
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
packaging.yml@6f29e06f1a0536a9cbbc35e4a26bed4409f42369 -
Trigger Event:
push
-
Statement type: