Features Overview
Sherlock AI provides comprehensive monitoring and analysis capabilities for Python applications. Each feature is designed to work independently or in combination with others for complete observability.
Core Features
Performance Monitoring
Track execution times of functions and code blocks with the @log_performance decorator and PerformanceTimer context manager.
Memory Monitoring
Monitor Python memory usage with detailed heap analysis and tracemalloc integration using @monitor_memory.
Resource Monitoring
Track comprehensive system resources including CPU, memory, I/O, and network usage with @monitor_resources.
Error Analysis
AI-powered error analysis with automatic probable cause detection and MongoDB storage using @sherlock_error_handler.
Code Analysis
Automatically detect and refactor hardcoded values in your code using @hardcoded_value_detector.
Auto-Instrumentation
Zero-code setup for popular frameworks like FastAPI, automatically instrumenting routes with monitoring decorators.
Feature Comparison
| Feature | Decorator | Context Manager | Async Support | Storage Options |
|---|---|---|---|---|
| Performance Monitoring | ✓ | ✓ | ✓ | Log files |
| Memory Monitoring | ✓ | ✓ | ✓ | Log files |
| Resource Monitoring | ✓ | ✓ | ✓ | Log files |
| Error Analysis | ✓ | ✗ | ✓ | MongoDB, API |
| Code Analysis | ✓ | ✗ | ✓ | File system |
| Auto-Instrumentation | ✓ | ✗ | ✓ | All supported |
Combined Usage
Features can be stacked for comprehensive monitoring:
from sherlock_ai import log_performance, monitor_memory, monitor_resources
from sherlock_ai.monitoring import sherlock_error_handler
from sherlock_ai import hardcoded_value_detector
@log_performance
@monitor_memory(trace_malloc=True)
@monitor_resources(include_io=True)
@sherlock_error_handler
@hardcoded_value_detector
def comprehensive_function():
# This function will be monitored for:
# - Execution time (performance)
# - Memory usage (memory)
# - System resources (CPU, I/O, etc.)
# - Error analysis (AI-powered)
# - Hardcoded value detection
data = process_large_dataset()
save_to_database(data)
return len(data)
Next Steps
Explore each feature in detail to understand how to use them effectively in your application:
- Start with Performance Monitoring for basic tracking
- Add Memory Monitoring for memory-intensive operations
- Use Resource Monitoring for comprehensive system analysis
- Enable Error Analysis for AI-powered debugging
- Try Code Analysis to improve code quality
- Set up Auto-Instrumentation for zero-code monitoring