New to Kestra?
Use blueprints to kickstart your first workflows.
Audits Azure Cosmos DB containers via Azure Monitor to detect HTTP 429 throttling and Normalized RU consumption surges, alerting DBAs via Slack.
Global enterprise applications and real-time distributed platforms leverage Azure Cosmos DB for multi-model, globally distributed NoSQL database storage with turnkey multi-region replication. Throughput in Cosmos DB is provisioned and metered in Request Units per second (RU/s). When client query volume spikes, batch ETL jobs execute unindexed partition scans, or data skew concentrates writes onto a single hot logical partition key, container throughput demand exceeds the provisioned or autoscale ceiling. When this occurs, Cosmos DB throttles client requests with HTTP 429 Request rate is large status codes. Although client SDKs perform internal exponential backoff retries, persistent throttling inflates client response latencies and eventually results in dropped user transactions. This sentinel interrogates Azure Monitor Metrics every 10 minutes, detects HTTP 429 throttling surges and Normalized RU consumption breaches above 85%, and notifies DBAs on Slack before application outages occur.
*/10 * * * *) or runs on-demand via manual execution.NormalizedRUConsumption and TotalRequests across a 15-minute rolling lookback window.max_429_count_threshold or if normalized RU utilization crosses 90%.io.kestra.plugin.core.flow.If flowable checks if rate limiting occurred and dispatches a Slack alert to #azure-database-alerts.flowchart TD
A[ten_minute_cosmosdb_audit Schedule Trigger] --> B[scan_cosmosdb_metrics Python Script]
B --> C[check_rate_limiting Flowable If]
C -- RU Throttling Detected --> D[notify_slack_cosmos_throttling Webhook]
C -- Throughput Nominal --> E[log_database_health_state Log]
D --> E
E --> F[export_cosmos_manifest Return]
Azure Monitor captures metric telemetry, but correlating database rate limiting with operational ChatOps incident response requires automated workflow coordination. Kestra queries Azure Monitor APIs securely via service principal credentials, validates custom capacity thresholds, formats actionable alert cards, and can trigger automated throughput scaling. With Kestra's containerized Python runner and native secret management, teams maintain reliable database guardrails without deploying brittle monitoring agents.
| Name | Type | Default | Description |
|---|---|---|---|
azure_subscription_id |
STRING |
12345678-1234-1234-1234-123456789abc |
Azure subscription identifier containing the Cosmos DB account. |
resource_group_name |
STRING |
rg-production-databases |
Name of the Azure Resource Group hosting the Cosmos DB account. |
cosmosdb_account_name |
STRING |
cosmos-ecommerce-orders |
Target Azure Cosmos DB account identifier to evaluate for RU rate limiting. |
max_429_count_threshold |
INT |
10 |
Maximum allowable HTTP 429 rate-limited request count across the lookback window. |
alert_on_throttling |
BOOL |
true |
Whether to dispatch automated Slack alerts when Cosmos DB Request Units are throttled. |
{{ outputs.scan_cosmosdb_metrics.vars.account_name }}: Identifier of the evaluated Cosmos DB account.{{ outputs.scan_cosmosdb_metrics.vars.normalized_ru_percent }}: Maximum recorded Normalized RU consumption percentage.{{ outputs.scan_cosmosdb_metrics.vars.is_throttled }}: Boolean flag indicating whether rate limiting or RU saturation was detected.{{ outputs.export_cosmos_manifest.value }}: Structured dictionary containing the consolidated Cosmos DB diagnostic manifest.management.azure.com).Monitoring Reader permissions on the target resource group.AZURE_CLIENT_ID: Service Principal Application (Client) ID.AZURE_CLIENT_SECRET: Service Principal Secret.AZURE_TENANT_ID: Azure Active Directory Directory (Tenant) ID.SLACK_WEBHOOK_URL: Slack Incoming Webhook URL used to dispatch database incident notifications.AZURE_CLIENT_ID, AZURE_CLIENT_SECRET, AZURE_TENANT_ID, and SLACK_WEBHOOK_URL in your Kestra secret storage.company.cloud namespace.azure_subscription_id, resource_group_name, and cosmosdb_account_name with your Cosmos DB deployment details.Microsoft.Insights/metrics/read permission on the Cosmos DB account.io.kestra.plugin.core.flow.ForEach loop to scan all Cosmos DB databases across production subscriptions.