Skip to content
Telemetry
Event tracking template

Database reliability monitoring template

Record query fingerprints, pool waits, rollbacks, locks, replication lag, and migration results. Exclude raw statements and parameters.

Reviewed by the Telemetry product team on . We checked the event names, suggested fields, questions to query, and data to exclude. Who reviews this page

Questions you can answer
  • Which approved database operation fingerprints are consistently slow?
  • Which application pools make callers wait or time out?
  • Which releases correlate with rollbacks, deadlocks, lag, or failed migrations?
How to test this template

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. 1

    Choose when to log

    Instrument the point where database_query_completed becomes final.

  2. 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. 3

    Run a fixture

    Exercise known success, failure, retry, and empty-result cases before relying on aggregate results.

  4. 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.

Read Database reliability monitoring with SQL

Template

Paste this into your coding agent

Replace YOUR_API_KEY, run the flow locally, then verify the generated events and dashboards.

database-reliability

Database reliability monitoring template

text
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

database_query_completeddatabase_pool_sampleddatabase_transaction_completeddatabase_lock_wait_completeddatabase_replication_sampleddatabase_migration_completed

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

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.

Browse all recipes
Database reliabilityIntermediate

Detect N+1 database query patterns

Which route and query combinations repeat suspiciously within a request?

Open recipe
Database reliabilityBeginner

Find slow database queries by fingerprint

Which database operations are consistently slow enough to investigate?

Open recipe
Database reliabilityBeginner

Measure database connection-pool saturation

Which application pools are making callers wait for a database connection?

Open recipe
Database reliabilityIntermediate

Calculate database transaction rollback rate

Which services roll back an unusual share of database transactions?

Open recipe
Database reliabilityIntermediate

Find database lock waits and deadlocks

Which database operations create the most serious lock contention?

Open recipe
Database reliabilityBeginner

Measure database replication and CDC lag

Which replicas or CDC consumers are falling behind their source database?

Open recipe
Database reliabilityBeginner

Track database migration failures by release

Which releases contain failed or rolled-back database migrations?

Open recipe
Database reliabilityBeginner

Rank database queries by total time impact

Which database operation consumes the most cumulative request time?

Open recipe
Database reliabilityIntermediate

Measure long-running database transactions

Which application transaction classes remain open the longest?

Open recipe
Database reliabilityBeginner

Analyze database errors by SQLSTATE and release

Which database error classes increased after an application release?

Open recipe
Database reliabilityIntermediate

Measure database connection timeouts and churn

Which services and regions show unhealthy database connection churn?

Open recipe
Database reliabilityAdvanced

Measure database replica staleness by region

Which replica regions are serving stale or failed reads?

Open recipe
Recipe collectionsDatabase reliability SQL

More templates