Skip to main content

Pyvider Telemetry: An opinionated, developer-friendly telemetry wrapper for Python.

This project has been archived.

The maintainers of this project have marked this project as archived. No new releases are expected.

Project description

๐Ÿ๐Ÿ“ก pyvider-telemetry

Beautiful, performant, structured logging for Python.

Modern structured logging built on structlog with emoji-enhanced visual parsing and semantic Domain-Action-Status patterns.

PyPI Version Python Versions License: Apache 2.0 Code style: ruff Powered by Structlog Built with attrs


Make your logs beautiful and meaningful! pyvider-telemetry transforms your application logging with visual emoji prefixes, semantic Domain-Action-Status patterns, and high-performance structured output. Perfect for development debugging, production monitoring, and everything in between.

๐Ÿค” Why pyvider-telemetry?

  • ๐ŸŽจ Visual Log Parsing: Emoji prefixes based on logger names and semantic context make logs instantly scannable
  • ๐Ÿ“Š Semantic Structure: Domain-Action-Status (DAS) pattern brings meaning to your log events
  • โšก High Performance: Benchmarked >1000 msg/sec with optimized processor chains and emoji caching
  • ๐Ÿ”ง Zero Configuration: Works beautifully out of the box, configurable via environment variables or code
  • ๐ŸŽฏ Developer Experience: Thread-safe, async-ready, with comprehensive type hints for Python 3.13+

โœจ Features

  • ๐ŸŽจ Emoji-Enhanced Logging:

    • Logger Name Prefixes: ๐Ÿ”‘ User authentication successful (auth module)
    • Domain-Action-Status: [๐Ÿ”‘][โžก๏ธ][โœ…] Login completed (auth-login-success)
    • Custom TRACE Level: Ultra-verbose debugging with ๐Ÿ‘ฃ visual markers
  • ๐Ÿ“ˆ Production Ready:

    • High Performance: >1000 messages/second throughput
    • Thread Safe: Concurrent logging from multiple threads
    • Async Support: Native async/await compatibility
    • Memory Efficient: Optimized emoji caching and processor chains
  • โš™๏ธ Flexible Configuration:

    • Multiple Formats: JSON for production, key-value for development
    • Module-Level Filtering: Different log levels per component
    • Environment Variables: Zero-code configuration options
    • Service Identification: Automatic service name injection
  • ๐Ÿ—๏ธ Modern Python:

    • Python 3.13+ Exclusive: Latest language features and typing
    • Built with attrs: Immutable, validated configuration objects
    • Structlog Foundation: Industry-standard structured logging

๐Ÿš€ Installation

Requires Python 3.13 or later.

pip install pyvider-telemetry

๐Ÿ’ก Quick Start

Basic Usage

from pyvider.telemetry import setup_telemetry, logger

# Initialize with sensible defaults
setup_telemetry()

# Start logging immediately
logger.info("Application started", version="1.0.0")
logger.debug("Debug information", component="auth")
logger.error("Something went wrong", error_code="E123")

# Create component-specific loggers
auth_logger = logger.get_logger("auth.service")
auth_logger.info("User login attempt", user_id=12345)
# Output: ๐Ÿ”‘ User login attempt user_id=12345

Semantic Domain-Action-Status Logging

# Use domain, action, status for semantic meaning
logger.info("User authentication",
           domain="auth", action="login", status="success",
           user_id=12345, ip="192.168.1.100")
# Output: [๐Ÿ”‘][โžก๏ธ][โœ…] User authentication user_id=12345 ip=192.168.1.100

logger.error("Database connection failed",
            domain="database", action="connect", status="error",
            host="db.example.com", timeout_ms=5000)
# Output: [๐Ÿ—„๏ธ][๐Ÿ”—][๐Ÿ”ฅ] Database connection failed host=db.example.com timeout_ms=5000

Custom Configuration

from pyvider.telemetry import setup_telemetry, TelemetryConfig, LoggingConfig

config = TelemetryConfig(
    service_name="my-microservice",
    logging=LoggingConfig(
        default_level="INFO",
        console_formatter="json",           # JSON for production
        module_levels={
            "auth": "DEBUG",                # Verbose auth logging
            "database": "ERROR",            # Only DB errors
            "external.api": "WARNING",      # Minimal third-party noise
        }
    )
)

setup_telemetry(config)

Environment Variable Configuration

export PYVIDER_SERVICE_NAME="my-service"
export PYVIDER_LOG_LEVEL="INFO"
export PYVIDER_LOG_CONSOLE_FORMATTER="json"
export PYVIDER_LOG_MODULE_LEVELS="auth:DEBUG,db:ERROR"
from pyvider.telemetry import setup_telemetry, TelemetryConfig

# Automatically loads from environment
setup_telemetry(TelemetryConfig.from_env())

Exception Logging

try:
    risky_operation()
except Exception:
    logger.exception("Operation failed",
                    operation="user_registration",
                    user_id=123)
    # Automatically includes full traceback

Ultra-Verbose TRACE Logging

from pyvider.telemetry import setup_telemetry, logger, TelemetryConfig, LoggingConfig

# Enable TRACE level for deep debugging
config = TelemetryConfig(
    logging=LoggingConfig(default_level="TRACE")
)
setup_telemetry(config)

logger.trace("Entering function", function="authenticate_user")
logger.trace("Token validation details",
            token_type="bearer", expires_in=3600)

๐Ÿ“Š Performance

pyvider-telemetry is designed for high-throughput production environments:

Scenario Performance Notes
Basic Logging >1,200 msg/sec Key-value format with emojis
JSON Output >600 msg/sec Structured production format
Multithreaded >900 msg/sec 10 threads concurrent logging
TRACE Level >1,100 msg/sec Ultra-verbose debugging

Run benchmarks yourself:

python scripts/benchmark_performance.py

๐ŸŽจ Emoji Reference

Domain Emojis (Primary)

  • ๐Ÿ”‘ auth, ๐Ÿ—„๏ธ database, ๐ŸŒ network, โš™๏ธ system
  • ๐Ÿ›Ž๏ธ server, ๐Ÿ™‹ client, ๐Ÿ” security, ๐Ÿ“„ file
  • See full matrix: PYVIDER_SHOW_EMOJI_MATRIX=true python -c "from pyvider.telemetry.logger.emoji_matrix import show_emoji_matrix; show_emoji_matrix()"

Action Emojis (Secondary)

  • โžก๏ธ login, ๐Ÿ”— connect, ๐Ÿ“ค send, ๐Ÿ“ฅ receive
  • ๐Ÿ” query, ๐Ÿ“ write, ๐Ÿ—‘๏ธ delete, โš™๏ธ process

Status Emojis (Tertiary)

  • โœ… success, โŒ failure, ๐Ÿ”ฅ error, โš ๏ธ warning
  • โณ attempt, ๐Ÿ” retry, ๐Ÿ complete, โฑ๏ธ timeout

๐Ÿ”ง Advanced Usage

Async Applications

import asyncio
from pyvider.telemetry import setup_telemetry, logger, shutdown_pyvider_telemetry

async def main():
    setup_telemetry()

    # Your async application code
    logger.info("Async app started")

    # Graceful shutdown
    await shutdown_pyvider_telemetry()

asyncio.run(main())

Production Configuration

production_config = TelemetryConfig(
    service_name="production-service",
    logging=LoggingConfig(
        default_level="INFO",               # Don't spam with DEBUG
        console_formatter="json",           # Machine-readable
        module_levels={
            "security": "DEBUG",            # Always verbose for security
            "performance": "WARNING",       # Only perf issues
            "third_party": "ERROR",         # Minimal external noise
        }
    )
)

๐Ÿ“š Documentation

For comprehensive API documentation, configuration options, and advanced usage patterns, see:

๐Ÿ“– Complete API Reference

๐Ÿ“œ License

This project is licensed under the Apache 2.0 License. See the LICENSE file for details.

๐Ÿ™ Acknowledgements

pyvider-telemetry builds upon these excellent open-source libraries:

  • structlog - The foundation for structured logging
  • attrs - Powerful data classes and configuration management

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

pyvider_telemetry-0.0.4.tar.gz (51.3 kB view details)

Uploaded Source

Built Distribution

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

pyvider_telemetry-0.0.4-py3-none-any.whl (33.5 kB view details)

Uploaded Python 3

File details

Details for the file pyvider_telemetry-0.0.4.tar.gz.

File metadata

  • Download URL: pyvider_telemetry-0.0.4.tar.gz
  • Upload date:
  • Size: 51.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for pyvider_telemetry-0.0.4.tar.gz
Algorithm Hash digest
SHA256 471e4e56ba2fa50f4abbb53397bb64668a8891701dfaaaec6b38deb13c10acbe
MD5 269f457b5d1ab54fe319768dd452f732
BLAKE2b-256 c5937df2b1d72bbc63d6d02dd36c193d5d7d7e3c200728c5ab67ac148cc4b59e

See more details on using hashes here.

File details

Details for the file pyvider_telemetry-0.0.4-py3-none-any.whl.

File metadata

File hashes

Hashes for pyvider_telemetry-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 87dd10f55bfd0ddbab760af96fa79be7c7f2508bc6c9e9e4a9de1736a62c626f
MD5 5f71cb5e3381479e16b79c7d138df1c2
BLAKE2b-256 831e952220bb4c13dacae64ecdeb4b0a39f1dddeb251261ec6a9cf30f75899f3

See more details on using hashes here.

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