Monitor your Streamline automation performance, sync status, and execution logs. ## Sync Logs Track Git repository synchronization events and errors. ### View Automation Sync Logs ```bash curl -H "X-API-Key: $FREDDY_API_KEY" \ "https://api.aitronos.com/api/v1/streamline/automations/sauto_abc123/sync-logs" ``` ```python import os import requests api_key = os.environ["FREDDY_API_KEY"] automation_id = "sauto_abc123" response = requests.get( f"https://api.aitronos.com/api/v1/streamline/automations/{automation_id}/sync-logs", headers={"X-API-Key": api_key} ) logs = response.json() print(f"Total logs: {logs['total']}") ``` ### Filter by Status ```bash # View only errors curl -H "X-API-Key: $FREDDY_API_KEY" \ "https://api.aitronos.com/api/v1/streamline/automations/sauto_abc123/sync-logs?status=error" ``` ### Filter by Event Type ```bash # View only pull events curl -H "X-API-Key: $FREDDY_API_KEY" \ "https://api.aitronos.com/api/v1/streamline/automations/sauto_abc123/sync-logs?event_type=pull" ``` ## Organization-Wide Monitoring View sync logs across all automations in your organization. ```bash curl -H "X-API-Key: $FREDDY_API_KEY" \ "https://api.aitronos.com/api/v1/streamline/organizations/org_xyz789/sync-logs" ``` ```python import os import requests api_key = os.environ["FREDDY_API_KEY"] organization_id = "org_xyz789" response = requests.get( f"https://api.aitronos.com/api/v1/streamline/organizations/{organization_id}/sync-logs", headers={"X-API-Key": api_key}, params={"status": "error", "limit": 50} ) error_logs = response.json() print(f"Found {len(error_logs)} errors across organization") ``` ## Event Types ### pull Code synchronization from Git repository. **Success indicators:** - Code pulled and updated successfully - `commit_sha` contains the latest commit **Common errors:** - `REPO_NOT_FOUND` - Repository deleted or inaccessible - `AUTHENTICATION_FAILED` - Invalid credentials - `NETWORK_ERROR` - Connectivity issues ### webhook_register GitHub webhook registration. **Success indicators:** - Webhook registered with GitHub - Automation will receive push notifications **Common errors:** - `INVALID_CREDENTIALS` - GitHub token invalid - `INSUFFICIENT_PERMISSIONS` - Token lacks webhook permissions ### webhook_remove GitHub webhook removal. **Success indicators:** - Webhook removed from GitHub **Common warnings:** - Webhook not found (already removed) ### validation Repository/credentials validation. **Success indicators:** - Repository accessible - Credentials valid **Common errors:** - `REPO_NOT_FOUND` - Repository doesn't exist - `INVALID_CREDENTIALS` - Credentials expired ### credential_check Periodic credential validation. **Success indicators:** - Credentials still valid **Common errors:** - `INVALID_CREDENTIALS` - Credentials expired or revoked ## Sync Types | Type | Description | Trigger | | --- | --- | --- | | `webhook` | Automatic sync | GitHub push event | | `manual` | User-initiated | UI or API call | | `scheduled` | Periodic sync | Background job | ## Common Error Codes | Error Code | Description | Resolution | | --- | --- | --- | | `REPO_NOT_FOUND` | Repository deleted or inaccessible | Update repository URL or restore access | | `INVALID_CREDENTIALS` | GitHub credentials invalid/expired | Update credentials in automation settings | | `AUTHENTICATION_FAILED` | GitHub authentication failed | Verify token has required permissions | | `RATE_LIMIT_EXCEEDED` | GitHub API rate limit reached | Wait and retry, or upgrade GitHub plan | | `NETWORK_ERROR` | Network connectivity issue | Check network and retry | | `WEBHOOK_REGISTRATION_FAILED` | Failed to register webhook | Check repository permissions | ## Monitoring Best Practices ### Set Up Alerts Monitor error logs regularly and set up alerts for critical failures: ```python import os import requests def check_automation_health(automation_id): """Check for recent errors in automation sync logs""" api_key = os.environ["FREDDY_API_KEY"] response = requests.get( f"https://api.aitronos.com/api/v1/streamline/automations/{automation_id}/sync-logs", headers={"X-API-Key": api_key}, params={"status": "error", "limit": 10} ) logs = response.json() error_count = logs.get("total", 0) if error_count > 5: send_alert(f"Automation {automation_id} has {error_count} errors") return error_count # Run periodically check_automation_health("sauto_abc123") ``` ### Track Sync Duration Monitor sync performance over time: ```python def analyze_sync_performance(automation_id): """Analyze sync duration trends""" api_key = os.environ["FREDDY_API_KEY"] response = requests.get( f"https://api.aitronos.com/api/v1/streamline/automations/{automation_id}/sync-logs", headers={"X-API-Key": api_key}, params={"limit": 100} ) logs = response.json()["logs"] durations = [log["duration_ms"] for log in logs if log.get("duration_ms")] avg_duration = sum(durations) / len(durations) if durations else 0 max_duration = max(durations) if durations else 0 print(f"Average sync duration: {avg_duration:.2f}ms") print(f"Max sync duration: {max_duration}ms") ``` ### Monitor Webhook Health Ensure webhooks are properly registered: ```python def verify_webhook_status(automation_id): """Check webhook registration status""" api_key = os.environ["FREDDY_API_KEY"] response = requests.get( f"https://api.aitronos.com/api/v1/streamline/automations/{automation_id}/sync-logs", headers={"X-API-Key": api_key}, params={"event_type": "webhook_register", "limit": 1} ) logs = response.json()["logs"] if logs and logs[0]["status"] == "success": print("Webhook is properly registered") else: print("Warning: Webhook registration may have failed") ``` ## Dashboard Metrics Key metrics to track: - **Success Rate**: Percentage of successful syncs - **Error Rate**: Percentage of failed syncs - **Average Duration**: Mean sync duration - **Last Sync Time**: Time since last successful sync - **Webhook Status**: Active/inactive webhook state ## Troubleshooting ### High Error Rate If you see frequent errors: 1. Check GitHub credentials are valid 2. Verify repository still exists and is accessible 3. Check GitHub API rate limits 4. Review recent repository changes ### Slow Sync Performance If syncs are taking too long: 1. Check repository size 2. Review network connectivity 3. Consider optimizing repository structure 4. Check GitHub API status ### Missing Webhook Events If webhook events aren't triggering: 1. Verify webhook is registered (check logs) 2. Check GitHub webhook settings 3. Verify repository permissions 4. Test with manual sync ## Related Documentation - **[Getting Started](/docs/documentation/streamline/getting-started)** - Create your first automation - **[Parameters](/docs/documentation/streamline/parameters)** - Configure automation parameters - **[Scheduling](/docs/documentation/streamline/scheduling)** - Schedule automations - **[Best Practices](/docs/documentation/streamline/best-practices)** - Follow recommended patterns - **[Sync Logs API](/docs/api-reference/streamline/sync-logs-automation)** - API reference