-
-
Notifications
You must be signed in to change notification settings - Fork 1
Configuration Examples
This guide provides practical configuration examples for different environments, use cases, and deployment scenarios.
Goal: Maximum debugging information with immediate feedback
// config/chronotrace.php - Development
return [
'enabled' => true,
'mode' => 'always', // Record every request
'sample_rate' => 1.0, // 100% capture rate
// Storage - Local for fast access
'storage' => 'local',
'path' => storage_path('chronotrace'),
// Capture everything for debugging
'capture' => [
'database' => true,
'cache' => true,
'http' => true,
'jobs' => true,
'events' => true, // Verbose event tracking
'logs' => true, // Include application logs
],
// Short retention for development
'retention_days' => 3,
'auto_purge' => true,
// Minimal security (development data)
'scrub' => ['password', 'token'],
// Sync storage for immediate debugging
'async_storage' => false,
// Detailed performance tracking
'performance_tracking' => true,
'memory_profiling' => true,
];Environment Variables:
# .env - Development
CHRONOTRACE_ENABLED=true
CHRONOTRACE_MODE=always
CHRONOTRACE_CAPTURE_EVENTS=true
CHRONOTRACE_CAPTURE_LOGS=true
CHRONOTRACE_RETENTION_DAYS=3Goal: Production-like testing with balanced monitoring
// config/chronotrace.php - Staging
return [
'enabled' => true,
'mode' => 'sample', // Sample requests for testing
'sample_rate' => 0.1, // 10% of requests
// Storage - S3 for production testing
'storage' => 's3',
's3' => [
'bucket' => 'staging-chronotrace',
'region' => 'us-east-1',
'path_prefix' => 'staging/traces',
'storage_class' => 'STANDARD',
],
// Focused capture for testing
'capture' => [
'database' => true,
'cache' => false, // Reduce noise in staging
'http' => true,
'jobs' => true,
'events' => false, // Too verbose for staging
'logs' => false, // Use external log aggregation
],
// Medium-term retention
'retention_days' => 7,
'auto_purge' => true,
// Production-like security
'scrub' => [
'password', 'token', 'secret', 'key',
'email', 'phone', 'api_key',
],
// Async for performance testing
'async_storage' => true,
'queue_connection' => 'redis',
// Performance monitoring
'performance_tracking' => true,
'error_conditions' => [
'slow_requests' => 2000, // Flag requests >2s
'memory_threshold' => 128 * 1024 * 1024, // 128MB
],
];Environment Variables:
# .env - Staging
CHRONOTRACE_ENABLED=true
CHRONOTRACE_MODE=sample
CHRONOTRACE_SAMPLE_RATE=0.1
CHRONOTRACE_STORAGE=s3
CHRONOTRACE_S3_BUCKET=staging-chronotrace
CHRONOTRACE_RETENTION_DAYS=7Goal: Minimal overhead with critical error capture
// config/chronotrace.php - Production
return [
'enabled' => true,
'mode' => 'record_on_error', // Only errors + minimal sampling
'sample_rate' => 0.001, // 0.1% of successful requests
// Storage - S3 with optimization
'storage' => 's3',
's3' => [
'bucket' => 'production-chronotrace',
'region' => 'us-east-1',
'path_prefix' => 'production/traces',
'storage_class' => 'STANDARD_IA', // Cost optimization
'server_side_encryption' => 'AES256',
],
// Minimal capture for performance
'capture' => [
'database' => true, // Essential for debugging
'cache' => false, // Usually not needed
'http' => true, // Critical for API issues
'jobs' => true, // Important for async processing
'events' => false, // Too verbose
'logs' => false, // Use dedicated logging
],
// Short retention for compliance
'retention_days' => 15,
'auto_purge' => true,
// Comprehensive security
'scrub' => [
'password', 'token', 'secret', 'key',
'email', 'phone', 'ssn', 'credit_card',
'api_key', 'auth_token', 'bearer_token',
],
// Async for minimal impact
'async_storage' => true,
'queue_connection' => 'redis',
'queue_name' => 'chronotrace',
// Error-focused monitoring
'error_conditions' => [
'status_codes' => [400, 401, 403, 404, 422, 500, 502, 503, 504],
'slow_requests' => 5000, // Only very slow requests
'memory_threshold' => 256 * 1024 * 1024, // 256MB
],
// Compression for storage efficiency
'compression' => [
'enabled' => true,
'level' => 9, // Maximum compression
],
];Environment Variables:
# .env - Production
CHRONOTRACE_ENABLED=true
CHRONOTRACE_MODE=record_on_error
CHRONOTRACE_SAMPLE_RATE=0.001
CHRONOTRACE_STORAGE=s3
CHRONOTRACE_S3_BUCKET=production-chronotrace
CHRONOTRACE_RETENTION_DAYS=15
CHRONOTRACE_ASYNC_STORAGE=trueFocus: Payment processing, inventory, and checkout performance
// config/chronotrace.php - E-commerce
return [
'enabled' => true,
'mode' => 'targeted',
// Target critical e-commerce flows
'targeted_routes' => [
'checkout/*',
'api/payments/*',
'api/orders/*',
'api/inventory/*',
'cart/*',
],
'capture' => [
'database' => true, // Track inventory queries
'cache' => true, // Product catalog caching
'http' => true, // Payment gateway calls
'jobs' => true, // Order processing
'events' => false,
],
// Enhanced error tracking for payments
'error_conditions' => [
'payment_failures' => true,
'inventory_conflicts' => true,
'checkout_timeouts' => true,
],
// PCI DSS compliance
'scrub' => [
'credit_card', 'cvv', 'bank_account',
'payment_token', 'stripe_key',
],
// High-availability storage
'storage' => 's3',
's3' => [
'storage_class' => 'STANDARD',
'replication' => true,
],
];Focus: External integrations and API performance
// config/chronotrace.php - API-focused
return [
'enabled' => true,
'mode' => 'sample',
'sample_rate' => 0.05, // 5% sampling
'capture' => [
'database' => false, // Minimal DB usage
'cache' => true, // API response caching
'http' => true, // Focus on external APIs
'jobs' => true, // Async API processing
'events' => false,
],
// Enhanced HTTP tracking
'http' => [
'include_request_body' => true,
'include_response_body' => true,
'max_body_size' => 256 * 1024, // Larger for API responses
'timeout_threshold' => 10000, // 10s timeout tracking
],
// API-specific error conditions
'error_conditions' => [
'api_timeouts' => 30000, // 30s API timeouts
'rate_limit_errors' => true,
'authentication_failures' => true,
],
];Focus: Minimal overhead with essential monitoring
// config/chronotrace.php - High-traffic
return [
'enabled' => true,
'mode' => 'record_on_error',
'sample_rate' => 0.0001, // 0.01% sampling
'capture' => [
'database' => true,
'cache' => false, // Disable for performance
'http' => true,
'jobs' => false, // Disable if not critical
'events' => false,
'logs' => false,
],
// Aggressive performance optimization
'async_storage' => true,
'compression' => [
'enabled' => true,
'level' => 9,
],
// Short retention
'retention_days' => 3,
// Database optimization
'database' => [
'slow_query_threshold' => 200, // Only very slow queries
'capture_all_queries' => false,
],
];// config/chronotrace.php - Octane optimization
return [
'enabled' => true,
'mode' => 'record_on_error',
// Octane-specific settings
'octane' => [
'memory_leak_detection' => true,
'request_isolation' => true,
'worker_monitoring' => true,
],
// Minimal memory footprint
'capture' => [
'database' => true,
'cache' => false,
'http' => true,
'jobs' => false,
'events' => false,
],
'memory' => [
'max_trace_size' => 1 * 1024 * 1024, // 1MB limit
'gc_probability' => 100, // Aggressive GC
],
];// config/chronotrace.php - Microservice
return [
'enabled' => true,
'mode' => 'sample',
'sample_rate' => 0.02, // 2% sampling
// Service identification
'service_name' => env('SERVICE_NAME', 'unknown'),
'service_version' => env('SERVICE_VERSION', '1.0.0'),
// Focus on inter-service communication
'capture' => [
'database' => true,
'cache' => false,
'http' => true, // Service-to-service calls
'jobs' => true, // Message queues
'events' => false,
],
// Distributed tracing
'distributed_tracing' => [
'enabled' => true,
'trace_header' => 'X-Trace-ID',
'span_header' => 'X-Span-ID',
],
// Service mesh integration
'service_mesh' => [
'istio_headers' => true,
'jaeger_integration' => true,
],
];// config/chronotrace.php - GDPR
return [
'enabled' => true,
'mode' => 'record_on_error',
// Minimal data retention
'retention_days' => 30,
'auto_purge' => true,
// Comprehensive PII scrubbing
'scrub' => [
'name', 'email', 'phone', 'address',
'ip_address', 'user_agent', 'session_id',
'personal_id', 'passport', 'driver_license',
],
// Right to erasure
'gdpr' => [
'data_subject_requests' => true,
'anonymization_after_days' => 7,
'audit_trail' => true,
],
// Encryption at rest
'encryption' => [
'enabled' => true,
'key' => env('CHRONOTRACE_ENCRYPTION_KEY'),
],
];// config/chronotrace.php - HIPAA
return [
'enabled' => true,
'mode' => 'record_on_error',
// Healthcare-specific scrubbing
'scrub' => [
'ssn', 'medical_record_number', 'patient_id',
'diagnosis', 'treatment', 'prescription',
'health_plan', 'provider_id', 'insurance',
],
// HIPAA requirements
'hipaa' => [
'audit_logging' => true,
'access_controls' => true,
'encryption_required' => true,
'minimum_necessary' => true,
],
// Enhanced security
'security' => [
'role_based_access' => true,
'audit_trail' => true,
'data_integrity_checks' => true,
],
];// config/chronotrace.php - Load testing
return [
'enabled' => true,
'mode' => 'sample',
'sample_rate' => 0.001, // Very low for load testing
// Focus on performance metrics
'capture' => [
'database' => true,
'cache' => false,
'http' => false, // Disable external calls
'jobs' => false,
'events' => false,
],
// Performance tracking
'performance_tracking' => true,
'memory_profiling' => false, // Disable for load testing
// Temporary storage
'retention_days' => 1,
'auto_purge' => true,
];// config/chronotrace.php - Integration testing
return [
'enabled' => true,
'mode' => 'always', // Capture everything
'capture' => [
'database' => true,
'cache' => true,
'http' => true, // Test external integrations
'jobs' => true,
'events' => true,
],
// Test-specific settings
'testing' => [
'mock_external_apis' => false,
'capture_test_data' => true,
'validate_api_contracts' => true,
],
// Immediate cleanup
'retention_days' => 0,
'auto_purge' => true,
];return [
'enabled' => true,
'mode' => 'record_on_error',
'capture' => ['database' => true, 'http' => true],
'retention_days' => 7,
'async_storage' => true,
];return [
'enabled' => true,
'mode' => 'always',
'capture' => [
'database' => true, 'cache' => true,
'http' => true, 'jobs' => true, 'events' => true
],
'retention_days' => 3,
'async_storage' => false,
];return [
'enabled' => true,
'mode' => 'record_on_error',
'sample_rate' => 0.001,
'capture' => ['database' => true, 'http' => true, 'jobs' => true],
'scrub' => ['password', 'token', 'secret', 'email'],
'retention_days' => 15,
'async_storage' => true,
'compression' => ['enabled' => true],
];# Validate configuration for environment
php artisan chronotrace:validate-config --env=production
# Expected output:
β
Configuration Valid for Production
- Recording mode: record_on_error β
- Sample rate: 0.1% β
- PII scrubbing: enabled β
- Async storage: enabled β
- Retention: 15 days β
β οΈ Recommendations:
- Consider disabling cache capture for better performance
- Enable compression for storage optimization# Compare configurations between environments
php artisan chronotrace:compare-config --env1=staging --env2=production
# Show configuration differences
php artisan chronotrace:config-diff --env=production- Configuration - Complete configuration reference
- Recording Modes - Detailed recording mode explanation
- Security - Security and compliance configurations
- Production Monitoring - Production deployment guide
Choose the right configuration for your needs! Start with environment-specific templates and customize based on your application's requirements.
- Getting Started - Install and configure ChronoTrace
- Examples - Real-world debugging scenarios
- Production Guide - Deploy safely in production
- Troubleshooting - Solve common issues
| Section | Page | Description |
|---|---|---|
| π Basics | Your First Trace | Step-by-step beginner guide |
| ποΈ Config | Recording Modes | Choose when to record traces |
| π‘οΈ Security | Security & PII | Protect sensitive data |
| π§ Tools | Commands | Complete command reference |
- π¬ GitHub Discussions - Community support
- π Report Issues - Bug reports & feature requests
- π§ Contact - Direct support
- π‘ Feature Requests - Suggest improvements
ChronoTrace helps Laravel developers debug applications faster with intelligent request tracing.
Made with β€οΈ by Grazulex β’ Documentation updated August 2024