Set up Database reliability monitoring template and check the results
Use the prompt to add events, then check the stored fields and query results. Review the event definitions before relying on the numbers.
- 1
Choose when to log
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 approved database operation fingerprints are consistently slow?
Template versus use case
Use this template to add events
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
Check the events, queries, and dashboard
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
You checked that events exclude prompts, bodies, credentials, signatures, and private content.
Example event schemas
Event schemas for this workflow
Check what each event records, when to send it, and which field types it needs. Review the example payload and privacy checklist before using it in production.
Use these queries in Telemetry
Learn about SQL query API
Run read-only DataFusion SQL over structured-event tables and reuse the result.
Related SQL recipes
More SQL recipes
Run the query using this workflow's event fields and check the example result. Save the result to a dashboard or set up an 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