The CodeXray Database Agent connects to each configured database on a cron cycle, runs engine-native diagnostic queries, and ships the results to the CodeXray backend. Metrics are organised by engine below — some are common, others engine-specific.
All metrics carry a service_name label (configured in the agent's YAML for each database) so you can distinguish multiple instances of the same engine in the UI.
Common to All Engines
| Metric | Type | Description |
|---|
db_availability | Gauge | 1 if the database is reachable, 0 otherwise |
total_queries_executed | Counter | Total queries executed since the last polling cycle |
query_execution_time | Gauge | Mean query execution time across the window |
total_connections | Gauge | Currently open connections |
active_connections | Gauge | Connections currently doing work |
inactive_connections | Gauge | Connections sitting idle |
cpu_usage | Gauge | Database-reported CPU usage percentage |
memory_usage | Gauge | Database-reported memory usage |
total_memory_gb / available_memory_gb | Gauge | Host-side memory (total and free) as seen by the engine |
db_count | Gauge | Number of databases managed by this instance |
db_users_count | Gauge | Number of users / logins |
network_bytes_sent / network_bytes_received | Counter | Network I/O at the engine level |
read_iops / write_iops | Gauge | Read/write operations per second |
read_throughput / write_throughput | Gauge | Read/write throughput |
read_latency_ms / write_latency_ms | Gauge | Per-operation latency |
outstanding_disk_io_requests | Gauge | Queued I/O requests at the engine layer |
disk_size_used | Gauge | Used disk space |
Slow-query stream
For every poll cycle, the agent emits the top N slow queries (queryLimit in the config, default 10) as individual records with:
query_text — the query fingerprint
query_exec_time — execution time for this sample
query_process_id — engine-assigned process ID
query_start_timestamp / query_current_timestamp — session timing
The backend aggregates these into the Top Queries view on each database's Advanced Database Monitoring page.
PostgreSQL (type: PG)
Native source: pg_stat_* views + optional pg_stat_statements extension.
Activity
| Metric | Description |
|---|
transactions_total | Total transactions |
transactions_committed / transactions_rolled_back | Commit / rollback counts |
sessions | Sessions opened |
sessions_abandoned / sessions_fatal / sessions_killed | Session termination reasons |
rows_inserted / rows_updated / rows_deleted / rows_fetched / rows_returned | Row activity per poll window |
query_calls_total | Total query calls (from pg_stat_statements if installed) |
query_exec_time_ms_total | Cumulative exec time (from pg_stat_statements if installed) |
Cache & buffer state
| Metric | Description |
|---|
buffer_hits | Shared buffer hits |
block_reads | Blocks read from disk |
shared_buffers | Current shared_buffers setting |
effective_cache_size | Current effective_cache_size setting |
shared_memory_size | Allocated shared memory |
segment_size | WAL segment size |
cpu_operator_cost | Planner cost constant |
Locks, waits, and cancellations
| Metric | Description |
|---|
queries_canceled_due_to_pinned_buffers | |
queries_canceled_due_to_deadlocks | |
queries_canceled_due_to_lock_timeouts | |
queries_canceled_due_to_old_snapshots | |
queries_canceled_due_to_dropped_tablespaces | |
deadlock_detected | Per-query deadlock flag |
Storage & replication
| Metric | Description |
|---|
total_db_size | Total DB size |
pg_disk_name | Disk name label |
pg_disk_size_total | Total disk size |
replication_count | Number of replication slots / standby count |
Host
| Metric | Description |
|---|
os_type / os_name / os_arch / os_version | Host OS info |
db_version | server_version (PG version) |
MySQL (type: MY)
Native source: performance_schema + INFORMATION_SCHEMA + SHOW STATUS counters.
Activity
| Metric | Description |
|---|
total_queries_executed | Total queries in window |
query_exec_time | Avg exec time |
queries_per_second | Live QPS |
transactions_total / transactions_committed / transactions_rolled_back | Transaction counts |
rows_inserted / rows_updated / rows_deleted / rows_fetched | Row operations |
InnoDB
| Metric | Description |
|---|
innodb_buffer_pool_size | Buffer pool size |
innodb_buffer_pool_hits | Buffer pool hits |
innodb_buffer_pool_reads | Reads that missed the buffer pool |
innodb_row_lock_waits | Row lock waits |
innodb_deadlocks | Detected deadlocks |
innodb_log_size | Redo log size |
Replication
| Metric | Description |
|---|
slave_running | 0/1 replication is running |
slave_seconds_behind_master | Replication lag |
semisync_enabled | 0/1 semi-sync replication on |
Connection
| Metric | Description |
|---|
max_connections | Configured limit |
threads_connected | Current connection count |
threads_running | Active connections |
aborted_connects | Failed connection attempts |
MSSQL / SQL Server (type: MS)
Native source: Dynamic Management Views (sys.dm_*).
Activity
| Metric | Description |
|---|
batch_requests_per_sec | Batch requests per second |
transactions_per_sec | Transactions per second |
active_sessions | Currently connected sessions |
blocked_processes | Processes blocked on locks |
Buffer & cache
| Metric | Description |
|---|
buffer_cache_hit_ratio | Percentage of pages served from cache |
page_life_expectancy | Seconds a page stays in buffer pool |
memory_grants_pending | Queries waiting for memory |
plan_cache_hit_ratio | Query plan cache hit rate |
Locks & waits
| Metric | Description |
|---|
lock_waits_per_sec | Lock wait events per second |
lock_requests_per_sec | Lock requests per second |
avg_wait_time_ms | Average wait time across all wait types |
deadlocks_per_sec | Deadlocks per second |
I/O
| Metric | Description |
|---|
io_read_latency_ms / io_write_latency_ms | Per-database file I/O latency |
io_stalls_total | Cumulative I/O stall time |
log_flush_waits_per_sec | Log flush waits |
MongoDB
Native source: db.serverStatus(), db.currentOp().
Operations
| Metric | Description |
|---|
ops_insert / ops_query / ops_update / ops_delete / ops_getmore / ops_command | Per-operation-type counters |
active_connections / available_connections | Connection pool state |
current_clients_total / current_clients_reading / current_clients_writing | Clients by state |
Memory & storage
| Metric | Description |
|---|
mem_resident_mb / mem_virtual_mb | Process memory |
wiredtiger_cache_bytes | WiredTiger cache in use |
wiredtiger_cache_dirty_bytes | Dirty pages |
collections_count / indexes_count | Schema shape |
Replication
| Metric | Description |
|---|
replset_state | Replica set member state |
replset_lag_seconds | Replication lag |
oplog_size_bytes | OpLog size |
Oracle (type: OR)
Native source: V$ performance views (AWR-style).
Activity
| Metric | Description |
|---|
active_sessions / inactive_sessions | Session counts by state |
transactions_per_sec | Transactions per second |
executions_per_sec | SQL executions per second |
parses_per_sec / hard_parses_per_sec | Parse activity |
Cache & memory
| Metric | Description |
|---|
buffer_cache_hit_ratio | DB cache hit ratio |
library_cache_hit_ratio | Shared pool hit ratio |
sga_size_bytes / pga_size_bytes | Memory area sizes |
redo_size_per_sec | Redo generation rate |
Waits
| Metric | Description |
|---|
top_wait_event_time_ms | Time spent in the top wait event |
log_file_sync_avg_ms | Log file sync latency (commit latency) |
db_file_read_avg_ms | Physical read latency |
Cassandra
Native source: system keyspace + JMX-style runtime metrics.
| Metric | Description |
|---|
read_latency_microseconds / write_latency_microseconds | Per-operation latency |
read_rate_per_sec / write_rate_per_sec | Operation rate |
pending_compactions | Pending compaction tasks |
pending_flushes | Pending memtable flushes |
cache_hit_rate_percent | Row cache hit rate |
timeouts_per_sec | Operation timeouts |
dropped_mutations_per_sec | Drops under load |
disk_load_bytes | Data size per node |
Couchbase (type: CB)
Native source: Cluster REST API.
| Metric | Description |
|---|
bucket_ops_per_sec | Operations per second per bucket |
bucket_cache_hit_rate_percent | Cache hit rate |
bucket_memory_used_bytes | RAM used per bucket |
bucket_item_count | Items per bucket |
disk_write_queue_length | Pending writes to disk |
replica_queue_length | Pending replica replication |
xdcr_replications_active | Active cross-datacenter replication streams |
Metric Naming Note
Metric names in CodeXray's UI may differ slightly from the native engine view names — the agent normalises into a consistent schema before emission. Use the Advanced Database Monitoring views in the UI as the source of truth for what's available per engine in your deployment.
Next Steps