Database Reliability Monitoring Template: implementation to decision
Treat the prompt as an implementation brief. The useful artifact is not copied code alone, but a reviewed event contract that produces a trustworthy answer.
- 1
Select the boundary
Instrument the point where database_query_completed becomes final.
- 2
Create the contract
Start with database_query_completed, database_pool_sampled, database_transaction_completed and keep every field typed, bounded, and privacy-reviewed.
- 3
Run a fixture
Exercise known success, failure, retry, and empty-result cases before relying on aggregate results.
- 4
Answer the question
Which bounded database operation fingerprints are consistently slow?
Template versus use case
This page is the implementation brief
Copy this template when the measurement goal is already clear. Use the matching use-case guide to review event boundaries, success definitions, and the decisions the resulting SQL should support.
Template
Paste this into your coding agent
Replace YOUR_API_KEY, run the flow locally, then verify the generated events and dashboards.
Database Reliability Monitoring Template
Instrument application-level database reliability with Telemetry.
Use /skill.md and this Telemetry API key: YOUR_API_KEY
Log database_query_completed, database_pool_sampled, database_transaction_completed, database_lock_wait_completed, database_replication_sampled, and database_migration_completed with controlled fields such as:
query_fingerprint, service, database_name, pool_name, status, duration_ms, acquisition_wait_ms, active_connections, idle_connections, max_connections, transaction_id, error_type, lag_seconds, migration_id, release, and environment.
Create dashboards and reviewed alerts for slow-query rate by fingerprint, connection-pool waits and timeouts, transaction rollback rate, unresolved locks and deadlocks, replica or CDC lag, and migration failures by release.
Use bounded operation names and allowlisted error categories. Do not log raw SQL, query parameters, connection strings, credentials, database error messages, or customer records.Events to capture
Verification checklist
What a complete instrumentation pass leaves behind
Events
Synthetic events reach the intended table with stable names and field types.
Queries
The first SQL queries return plausible rows with an explicit time window.
Views
A dashboard uses the real fields and includes enough context to explain a change.
Safety
Prompts, bodies, credentials, signatures, and private content were checked for redaction.
Event schema starting points
Event contracts for this workflow
Review the row grain, emit boundary, required types, privacy classes, example payload, and validation checklist before adapting a query or snippet to production.
Related product capability
Continue this workflow in SQL query API
Run read-only DataFusion SQL over structured-event tables and reuse the result.
Related SQL recipes
Answer the next question with SQL
Run the query against the structured fields from this workflow, inspect the example result, and turn a useful answer into a dashboard or alert.
Detect N+1 Database Query Patterns
Which route and query combinations repeat suspiciously within a request?
Open recipeFind Slow Database Queries by Fingerprint
Which database operations are consistently slow enough to investigate?
Open recipeMeasure Database Connection-Pool Saturation
Which application pools are making callers wait for a database connection?
Open recipeCalculate Database Transaction Rollback Rate
Which services roll back an unusual share of database transactions?
Open recipeFind Database Lock Waits and Deadlocks
Which database operations create the most serious lock contention?
Open recipeMeasure Database Replication and CDC Lag
Which replicas or CDC consumers are falling behind their source database?
Open recipeTrack Database Migration Failures by Release
Which releases contain failed or rolled-back database migrations?
Open recipeRank Database Queries by Total Time Impact
Which database operation consumes the most cumulative request time?
Open recipeMeasure Long-Running Database Transactions
Which application transaction classes remain open the longest?
Open recipeAnalyze Database Errors by SQLSTATE and Release
Which database error classes increased after an application release?
Open recipeMeasure Database Connection Timeouts and Churn
Which services and regions show unhealthy database connection churn?
Open recipeMeasure Database Replica Staleness by Region
Which replica regions are serving stale or failed reads?
Open recipeMore templates