This documentation has an index for AI agents at /llms.txt. A Markdown version of this page is available at https://explorer.opentelemetry.io/collector/components/contrib/postgresqlreceiver.md.

PostgreSQL Receiver

OpenTelemetry Collector receiver · contrib distribution

This receiver queries the PostgreSQL statistics collector.

  • Component ID: contrib-postgresqlreceiver
  • Name: postgresqlreceiver
  • Type: receiver
  • Distribution: contrib
  • Repository: opentelemetry-collector-contrib

Stability

LevelSignals
betametrics
developmentlogs

Metrics

MetricTypeValue typeUnitStabilityEnabledAttributesDescription
postgresql.backendssumint1developmentyesdb.namespace (string)The number of backend processes associated with each database. Counts backends across all connection states (active, idle, idle-in-transaction) and all backend types, including non-client backends such as autovacuum and parallel workers.
postgresql.bgwriter.buffers.allocatedsum (monotonic)int{buffers}developmentyesNumber of buffers allocated.
postgresql.bgwriter.buffers.writessum (monotonic)int{buffers}developmentyesbg_buffer_source (string)Number of buffers written.
postgresql.bgwriter.checkpoint.countsum (monotonic)int{checkpoints}developmentyesbg_checkpoint_type (string)The number of checkpoints performed.
postgresql.bgwriter.durationsum (monotonic)doublemsdevelopmentyesbg_duration_type (string)Total time spent writing and syncing files to disk by checkpoints.
postgresql.bgwriter.maxwrittensum (monotonic)int1developmentyesNumber of times the background writer stopped a cleaning scan because it had written too many buffers.
postgresql.blks_hitsum (monotonic)int{blks_hit}developmentnodb.namespace (string)Number of times disk blocks were found already in the buffer cache.
postgresql.blks_readsum (monotonic)int{blks_read}developmentnodb.namespace (string)Number of disk blocks read in this database.
postgresql.blocks_readsum (monotonic)int1developmentyesdb.collection.name (string), db.namespace (string), source (string)The number of blocks read.
postgresql.commitssum (monotonic)int1developmentyesdb.namespace (string)The number of commits.
postgresql.connection.maxgaugeint{connections}developmentyesConfigured maximum number of client connections allowed
postgresql.database.countsumint{databases}developmentyesNumber of user databases.
postgresql.database.locksgaugeint{lock}developmentnodb.namespace (string), lock_type (string), mode (string), relation (string)The number of database locks.
postgresql.db_sizesumintBydevelopmentyesdb.namespace (string)The database disk usage.
postgresql.deadlockssum (monotonic)int{deadlock}developmentnodb.namespace (string)The number of deadlocks.
postgresql.function.callssum (monotonic)int{call}developmentnodb.namespace (string), function (string)The number of calls made to a function. Requires track_functions=pl|all in Postgres config.
postgresql.index.scanssum (monotonic)int{scans}developmentyesdb.collection.name (string), db.namespace (string), postgresql.index.name (string)The number of index scans on a table.
postgresql.index.sizegaugeintBydevelopmentyesdb.collection.name (string), db.namespace (string), postgresql.index.name (string)The size of the index on disk.
postgresql.operationssum (monotonic)int1developmentyesdb.collection.name (string), db.namespace (string), operation (string)The number of db row operations.
postgresql.query.conflictssum (monotonic)int{query}developmentnodb.namespace (string), postgresql.conflict.type (string)Number of queries canceled due to conflicts with recovery on this database. Conflicts only occur on standby servers; this metric will be zero on primary servers.
postgresql.query.execution.timesum (monotonic)doublesdevelopmentnodb.namespace (string)The total execution time of SQL statements currently tracked by pg_stat_statements for the database.
postgresql.replication.data_delaygaugeintBydevelopmentyesreplication_client (string)The amount of data delayed in replication.
postgresql.rollbackssum (monotonic)int1developmentyesdb.namespace (string)The number of rollbacks.
postgresql.rowssumint1developmentyesdb.collection.name (string), db.namespace (string), state (string)The number of rows in the database.
postgresql.sequential_scanssum (monotonic)int{sequential_scan}developmentnodb.collection.name (string), db.namespace (string)The number of sequential scans.
postgresql.table.countsumint{table}developmentyesdb.namespace (string)Number of user tables in a database.
postgresql.table.sizesumintBydevelopmentyesdb.collection.name (string), db.namespace (string)Disk space used by a table.
postgresql.table.vacuum.countsum (monotonic)int{vacuum}developmentyesdb.collection.name (string), db.namespace (string)Number of times a table has manually been vacuumed.
postgresql.temp.iosum (monotonic)intBydevelopmentnodb.namespace (string)Total amount of data written to temporary files by queries.
postgresql.temp_filessum (monotonic)int{temp_file}developmentnodb.namespace (string)The number of temp files.
postgresql.tup_deletedsum (monotonic)int{tup_deleted}developmentnodb.namespace (string)Number of rows deleted by queries in the database.
postgresql.tup_fetchedsum (monotonic)int{tup_fetched}developmentnodb.namespace (string)Number of rows fetched by queries in the database.
postgresql.tup_insertedsum (monotonic)int{tup_inserted}developmentnodb.namespace (string)Number of rows inserted by queries in the database.
postgresql.tup_returnedsum (monotonic)int{tup_returned}developmentnodb.namespace (string)Number of rows returned by queries in the database.
postgresql.tup_updatedsum (monotonic)int{tup_updated}developmentnodb.namespace (string)Number of rows updated by queries in the database.
postgresql.vector.insert.durationsum (monotonic)doublesdevelopmentnodb.namespace (string)The cumulative execution time of statements that insert vectors into pgvector tables. Requires the pg_stat_statements extension, PostgreSQL 13 or later, and the pgvector extension in the scanned database.
postgresql.vector.insert.rowssum (monotonic)int{vectors}developmentnodb.namespace (string)The number of vectors inserted into pgvector tables. Requires the pg_stat_statements extension, PostgreSQL 13 or later, and the pgvector extension in the scanned database.
postgresql.vector.search.callssum (monotonic)int{search}developmentnodb.namespace (string), postgresql.distance.function.name (string)The number of vector similarity search operations executed, grouped by the distance function used. Requires the pg_stat_statements extension, PostgreSQL 13 or later, and the pgvector extension in the scanned database. The l1, hamming, and jaccard distance functions additionally require pgvector 0.7.0 or later.
postgresql.vector.search.durationsum (monotonic)doublesdevelopmentnodb.namespace (string), postgresql.distance.function.name (string)The cumulative execution time of vector similarity searches, grouped by the distance function used. Requires the pg_stat_statements extension, PostgreSQL 13 or later, and the pgvector extension in the scanned database. The l1, hamming, and jaccard distance functions additionally require pgvector 0.7.0 or later.
postgresql.vector.search.rows_returnedsum (monotonic)int{rows}developmentnodb.namespace (string), postgresql.distance.function.name (string)The cumulative number of rows returned by vector similarity searches, grouped by the distance function used. Requires the pg_stat_statements extension, PostgreSQL 13 or later, and the pgvector extension in the scanned database. The l1, hamming, and jaccard distance functions additionally require pgvector 0.7.0 or later.
postgresql.wal.agegaugeintsdevelopmentyesAge of the oldest WAL file. This metric requires WAL to be enabled with at least one replica.
postgresql.wal.delaygaugedoublesdevelopmentnoreplication_client (string), wal_operation_lag (string)Time between flushing recent WAL locally and receiving notification that the standby server has completed an operation with it. This metric requires WAL to be enabled with at least one replica.
postgresql.wal.laggaugeintsdevelopmentyesreplication_client (string), wal_operation_lag (string)Time between flushing recent WAL locally and receiving notification that the standby server has completed an operation with it. This metric requires WAL to be enabled with at least one replica.

Attributes

AttributeTypeDescription
bg_buffer_sourcestringThe source of a buffer write.
bg_checkpoint_typestringThe type of checkpoint state.
bg_duration_typestringThe type of time spent during the checkpoint.
db.collection.namestringThe name of the table within the database.
db.namespacestringThe database namespace, following the {database}|{schema} format defined by OpenTelemetry semantic conventions for PostgreSQL.
db.query.textstringThe text of the database query being executed.
db.system.namestringThe database management system (DBMS) product as identified by the client instrumentation.
functionstringThe name of the function.
lock_typestringType of the lockable object.
modestringName of the lock mode held or desired by the process.
network.peer.addressstringIP address of the client connected to this backend.
network.peer.portintTCP port number that the client is using for communication with this backend.
operationstringThe database operation.
postgresql.application_namestringName of the application that is connected to this backend.
postgresql.blocking.lock.modestringThe lock mode being requested by the blocked session (e.g. RowExclusiveLock, AccessExclusiveLock). Empty string when not blocked.
postgresql.blocking.lock.relationstringThe name of the relation (table) being waited on. Empty string when not blocked or when lock is not on a relation.
postgresql.blocking.lock.typestringThe type of lock resource being waited on (e.g. relation, transactionid, tuple). Empty string when not blocked.
postgresql.blocking.pidsstringArray of PIDs of sessions blocking this session (from pg_blocking_pids). Empty array when not blocked.
postgresql.blocking.start_timestringUTC timestamp (RFC3339) when the current lock wait began, derived from pg_locks.waitstart. Empty string when not blocked.
postgresql.blocking.transaction.start_timestringUTC timestamp (RFC3339) when the current transaction started. Empty string when no active transaction.
postgresql.blocking.wait_durationintWhole seconds this session has been waiting for a lock, measured from pg_locks.waitstart. 0 when not blocked.
postgresql.callsintNumber of times the statement was executed, reported in delta value.
postgresql.client_hostnamestringHost name of the connected client, as reported by a reverse DNS lookup of client_addr.
postgresql.conflict.typestringThe type of recovery conflict that caused a query to be canceled on a standby server.
postgresql.distance.function.namestringThe vector distance (similarity) function used by the query, one of the pgvector distance functions.
postgresql.index.namestringThe name of the index on a table.
postgresql.pidintProcess ID of this backend.
postgresql.query_idstringIdentifier of this backend's most recent query. If state is active this field shows the identifier of the currently executing query. In all other states, it shows the identifier of last query that was executed.
postgresql.query_planstringThe execution plan used by PostgreSQL for the query.
postgresql.query_startstringTime when the currently active query was started, or if state is not active, when the last query was started.
postgresql.queryidstringHash code to identify identical normalized queries.
postgresql.rolnamestringThe name of the PostgreSQL role that executed the query.
postgresql.rowsintTotal number of rows retrieved or affected by the statement, reported in delta value.
postgresql.shared_blks_dirtiedintTotal number of shared blocks dirtied by the statement, reported in delta value.
postgresql.shared_blks_hitintTotal number of shared block cache hits by the statement, reported in delta value.
postgresql.shared_blks_readintTotal number of shared blocks read by the statement, reported in delta value.
postgresql.shared_blks_writtenintTotal number of shared blocks written by the statement, reported in delta value.
postgresql.statestringCurrent overall state of this backend
postgresql.temp_blks_readintTotal number of temp blocks read by the statement, reported in delta value.
postgresql.temp_blks_writtenintTotal number of temp blocks written by the statement, reported in delta value.
postgresql.total_exec_timedoubleTotal time spent executing the statement, in delta seconds.
postgresql.total_plan_timedoubleTotal time spent planning the statement, in delta seconds.
postgresql.wait_eventstringWait event name if backend is currently waiting, otherwise NULL.
postgresql.wait_event_typestringThe type of event for which the backend is waiting, if any; otherwise NULL.
relationstringOID of the relation targeted by the lock, or null if the target is not a relation or part of a relation.
replication_clientstringThe IP address of the client connected to this backend. If this field is "unix", it indicates either that the client is connected via a Unix socket.
sourcestringThe block read source type.
statestringThe tuple (row) state.
user.namestringName of the user logged into this backend.
wal_operation_lagstringThe operation which is responsible for the lag.

Data

  • JSON (latest): /data/collector/components/contrib-postgresqlreceiver/latest.json
  • JSON (pinned): /data/collector/components/contrib-postgresqlreceiver/contrib-postgresqlreceiver-579e14ab1d7a.json
  • Explore: /collector/components/contrib/postgresqlreceiver