API Client Integration
HTTP-based data ingestion to centralized backend services.
Setup
Error Insights
from sherlock_ai.monitoring import sherlock_error_handler
@sherlock_error_handler
def monitored_function():
# Errors sent to: POST /v1/logs/injest-error-insights
result = complex_operation()
return result
Performance Insights
from sherlock_ai.monitoring import sherlock_performance_insights
@sherlock_performance_insights
def slow_function():
# Performance data sent to: POST /v1/logs/injest-performance-insights
return heavy_computation()
Complete Example
import os
from sherlock_ai import SherlockAI, log_performance
from sherlock_ai.monitoring import sherlock_error_handler, sherlock_performance_insights
os.environ["SHERLOCK_AI_API_KEY"] = "your-api-key"
SherlockAI().setup()
@log_performance
@sherlock_error_handler
@sherlock_performance_insights
def api_monitored_function():
return process_data()