Skip to main content

Add your description here

Project description

๐Ÿ›ก๏ธ UYEIA

Unified Yet Easy Issue Alerts - A comprehensive error monitoring and status management system for Python applications.

Python License Tests

๐ŸŒŸ 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

  1. Watcher: Individual monitors for different application components
  2. Manager: Central coordination of all watchers and cache operations
  3. UyeiaCache: SQLite-backed persistent storage system
  4. Config: Configuration management with validation
  5. 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

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Make your changes
  4. Add tests for new functionality
  5. Run the test suite (rye run test)
  6. Commit your changes (git commit -m 'Add amazing feature')
  7. Push to the branch (git push origin feature/amazing-feature)
  8. Open a Pull Request

๐Ÿ“ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ†˜ Support

๐Ÿ™ 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

uyeia-1.0.1.tar.gz (15.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

uyeia-1.0.1-py3-none-any.whl (11.6 kB view details)

Uploaded Python 3

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

Hashes for uyeia-1.0.1.tar.gz
Algorithm Hash digest
SHA256 d5126f4ca056a20444712e4887faefc61f8f52540fb5c2dedfa58fe15039fbe5
MD5 fc92ee5262413f65273b3af3d8a613fc
BLAKE2b-256 8338177d8acbf7f6d9a3b9915760621097ad074e82cadaafbff09143ad08f758

See more details on using hashes here.

Provenance

The following attestation bundles were made for uyeia-1.0.1.tar.gz:

Publisher: packaging.yml on David-Aires/uyeia

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for uyeia-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b089065d941f7e1275970a4394d2729d64d776a21fe5d770ab6785bba8559054
MD5 9a6a22dd6beb84b64d46c05f62b32a6b
BLAKE2b-256 d6f70fae30ce13ad5357690510e4c6c891aa74d530c106c3ae25af438e47cbdc

See more details on using hashes here.

Provenance

The following attestation bundles were made for uyeia-1.0.1-py3-none-any.whl:

Publisher: packaging.yml on David-Aires/uyeia

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page