← Back to Tutorials
Intermediate• 20 minutes
Monitoring and Alerting
Set up comprehensive monitoring and alerting for your automations to ensure reliability and performance.
What You'll Build
In this tutorial, you'll learn how to:
- Monitor automation performance and health
- Create alerts based on metrics and thresholds
- Configure notification channels (email, webhooks, Slack)
- Set up dashboards for real-time monitoring
- Track key performance indicators
Prerequisites
Before You Start
- ✅ A Sematryx account with active automations
- ✅ Understanding of monitoring concepts
- ✅ Access to notification channels (email, webhooks)
Step 1: Create Monitoring Alerts
Set up alerts to be notified when metrics exceed thresholds:
Create monitoring alert
curl -X POST https://api.sematryx.com/v1/alerts \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "high-error-rate",
"condition": {
"metric": "error_rate",
"operator": ">",
"threshold": 0.05
},
"notifications": [
{
"type": "email",
"config": {
"recipients": ["team@example.com"]
}
},
{
"type": "webhook",
"config": {
"url": "https://your-app.com/alerts"
}
}
]
}'Available Metrics
- error_rate: Percentage of failed executions
- execution_time: Average execution duration
- throughput: Executions per time period
- cost: API usage costs
- queue_depth: Number of pending executions
Step 2: Using the Python SDK
Create alerts programmatically:
Create alert with Python SDK
from sematryx import SematryxClient
client = SematryxClient(api_key='your-api-key')
# Create monitoring alert
alert = client.alerts.create(
name='high-error-rate',
condition={
'metric': 'error_rate',
'operator': '>',
'threshold': 0.05
},
notifications=[
{
'type': 'email',
'config': {'recipients': ['team@example.com']}
}
]
)Step 3: Monitor Metrics
Retrieve real-time metrics and analytics:
Get monitoring metrics
# Get real-time metrics
metrics = client.analytics.get_metrics(
start_date='2024-01-01',
end_date='2024-01-31'
)
print(f"Total executions: {metrics.total_executions}")
print(f"Success rate: {metrics.success_rate}")
print(f"Average execution time: {metrics.avg_execution_time}")Notification Channels
Email Notifications
Receive email alerts when conditions are met. Configure recipients and email templates.
Webhook Notifications
Send alerts to your own systems via HTTP webhooks for custom integrations.
Slack Integration
Send alerts directly to Slack channels for team visibility.
SMS Notifications
Receive SMS alerts for critical issues that require immediate attention.
Best Practices
Monitoring Best Practices
- Set up alerts for critical metrics (error rate, execution time)
- Use appropriate thresholds to avoid alert fatigue
- Configure multiple notification channels for redundancy
- Review and adjust alert thresholds regularly
- Monitor trends over time, not just point-in-time values
- Set up dashboards for visual monitoring
🎉 Next Steps
You've learned how to set up monitoring and alerts! Continue learning: