or run

tessl search
Log in

Version

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
pypipkg:pypi/aioredis@2.0.x
tile.json

tessl/pypi-aioredis

tessl install tessl/pypi-aioredis@2.0.0

asyncio (PEP 3156) Redis support

Agent Success

Agent success rate when using this tile

98%

Improvement

Agent success rate improvement when using this tile compared to baseline

1.01x

Baseline

Agent success rate without this tile

97%

task.mdevals/scenario-7/

Redis Health Monitoring System

Build a Redis health monitoring system that tracks server metrics, manages client connections, and analyzes performance data.

@generates

Requirements

Health Check Monitor

Implement a health check function that gathers comprehensive server status information:

  • Retrieve current server information including memory usage, connected clients, and uptime
  • Get the current database size (number of keys)
  • Fetch server time for timestamp synchronization
  • Return all metrics in a structured dictionary

Configuration Inspector

Implement a configuration inspection function that:

  • Retrieves all memory-related configuration parameters
  • Retrieves all timeout-related configuration parameters
  • Returns both configuration sets in a structured format

Client Connection Tracker

Implement a client tracking function that:

  • Lists all currently connected clients
  • Counts the total number of connected clients
  • Identifies and returns clients by their connection type (normal, master, replica, pubsub)
  • Returns structured information about client connections

Performance Analyzer

Implement a performance analysis function that:

  • Retrieves slowlog entries to identify slow operations
  • Gets the total count of slowlog entries
  • Analyzes statistics including total commands processed and cache hit/miss ratios
  • Returns performance metrics in a structured format

Test Cases

  • When health check is called, it returns server info with memory usage, connected clients count, database size, and server time @test
  • When configuration inspector is called with memory patterns, it returns memory-related configuration parameters @test
  • When client tracker is called, it returns list of connected clients with their IDs and addresses @test
  • When performance analyzer is called, it returns slowlog entries and statistics including keyspace hits and misses @test

API

import asyncio
from typing import Dict, List, Any, Optional, Tuple


async def health_check(redis_client) -> Dict[str, Any]:
    """
    Gather comprehensive server health metrics.

    Args:
        redis_client: An aioredis Redis client instance

    Returns:
        Dictionary containing:
          - server_info: Server information dict with memory, clients, uptime
          - db_size: Number of keys in current database
          - server_time: Tuple of (seconds, microseconds)
    """
    pass


async def inspect_configuration(redis_client) -> Dict[str, Dict[str, str]]:
    """
    Retrieve and organize Redis configuration parameters.

    Args:
        redis_client: An aioredis Redis client instance

    Returns:
        Dictionary containing:
          - memory_config: Memory-related configuration parameters
          - timeout_config: Timeout-related configuration parameters
    """
    pass


async def track_clients(redis_client, client_type: Optional[str] = None) -> Dict[str, Any]:
    """
    Track and analyze connected Redis clients.

    Args:
        redis_client: An aioredis Redis client instance
        client_type: Optional filter by type ('normal', 'master', 'replica', 'pubsub')

    Returns:
        Dictionary containing:
          - client_list: List of client information dictionaries
          - total_clients: Total count of connected clients
    """
    pass


async def analyze_performance(redis_client, slowlog_count: int = 10) -> Dict[str, Any]:
    """
    Analyze Redis performance metrics and slowlog data.

    Args:
        redis_client: An aioredis Redis client instance
        slowlog_count: Number of slowlog entries to retrieve (default: 10)

    Returns:
        Dictionary containing:
          - slowlog_entries: List of slowlog entry dictionaries
          - slowlog_length: Total count of slowlog entries
          - stats: Statistics dict with commands_processed, ops_per_sec,
                   keyspace_hits, keyspace_misses
    """
    pass

Dependencies { .dependencies }

aioredis { .dependency }

Provides async Redis client support for Python.