![]() |
VOOZH | about |
The PostgreSQL receiver allows for collection of PostgreSQL metrics and access to the PostgreSQL Overview and PostgreSQL Metrics dashboards. Configure the receiver according to the specifications of the latest version of the postgresqlreceiver.
For more information, see the OpenTelemetry project documentation for the PostgreSQL receiver.
To collect PostgreSQL metrics with OpenTelemetry for use with Datadog:
receivers:postgresql/pg-host-1:endpoint:"<HOST>:<PORT>"username:"<USERNAME>"password:"<PASSWORD>"collection_interval:15smetrics:postgresql.blks_hit:enabled:truepostgresql.blks_read:enabled:truepostgresql.database.locks:enabled:truepostgresql.deadlocks:enabled:truepostgresql.function.calls:enabled:truepostgresql.sequential_scans:enabled:truepostgresql.temp_files:enabled:truepostgresql.temp.io:enabled:truepostgresql.tup_deleted:enabled:truepostgresql.tup_fetched:enabled:truepostgresql.tup_inserted:enabled:truepostgresql.tup_returned:enabled:truepostgresql.tup_updated:enabled:truepostgresql.wal.delay:enabled:trueprocessors:resource/pg-host-1:attributes:- action:insertkey:datadog.host.namevalue:<HOST>cumulativetodelta:{}deltatorate:metrics:- postgresql.tup_returned- postgresql.tup_fetched- postgresql.tup_inserted- postgresql.tup_updated- postgresql.tup_deleted- postgresql.operations- postgresql.commits- postgresql.rollbacks- postgresql.blks_hit- postgresql.blks_read- postgresql.temp_files- postgresql.temp.io- postgresql.function.calls- postgresql.index.scans- postgresql.sequential_scans- postgresql.blocks_readSee the PostgreSQL receiver documentation for detailed configuration options and requirements.
receivers:hostmetrics:scrapers:load:cpu:metrics:system.cpu.utilization:enabled:truememory:network:This example assumes PostgreSQL 15+ with log_destination = 'jsonlog' configured. If you use the default stderr log format, adjust the operators to match your log_line_prefix.
receivers:filelog:include:- <PATH_TO_YOUR_POSTGRESQL_LOG>operators:- type:json_parserparse_from:bodytimestamp:parse_from:attributes.timestamplayout:"%Y-%m-%d %H:%M:%S.%L %Z"processors:transform/logs:log_statements:- context:resourcestatements:- set(attributes["datadog.host.name"], "<HOST>")- set(attributes["datadog.log.source"], "postgresql")batch:{}service:pipelines:metrics/pg-host-1:receivers:[postgresql/pg-host-1]processors:[resource/pg-host-1, cumulativetodelta, deltatorate]exporters:[datadog/exporter]If you configured the host metrics receiver, add it to a separate metrics pipeline:
metrics/host:receivers:[hostmetrics]processors:[cumulativetodelta]exporters:[datadog/exporter]If you configured the file log receiver, add a logs pipeline:
logs:receivers:[filelog]processors:[transform/logs, batch]exporters:[datadog/exporter]| OTEL | DESCRIPTION | FILTER |
|---|---|---|
| postgresql.backends | The number of backends. | |
| postgresql.bgwriter.buffers.allocated | Number of buffers allocated. | |
| postgresql.bgwriter.buffers.writes | Number of buffers written. | source: backend |
| postgresql.bgwriter.buffers.writes | Number of buffers written. | source: backend_fsync |
| postgresql.bgwriter.buffers.writes | Number of buffers written. | source: checkpoints |
| postgresql.bgwriter.buffers.writes | Number of buffers written. | source: bgwriter |
| postgresql.bgwriter.checkpoint.count | The number of checkpoints performed. | type: scheduled |
| postgresql.bgwriter.checkpoint.count | The number of checkpoints performed. | type: requested |
| postgresql.bgwriter.duration | Total time spent writing and syncing files to disk by checkpoints. | type: sync |
| postgresql.bgwriter.duration | Total time spent writing and syncing files to disk by checkpoints. | type: write |
| postgresql.bgwriter.maxwritten | Number of times the background writer stopped a cleaning scan because it had written too many buffers. | |
| postgresql.blks_hit | Number of times disk blocks were found already in the buffer cache. | |
| postgresql.blks_read | Number of disk blocks read in this database. | |
| postgresql.blocks_read | The number of blocks read. | source: heap_read |
| postgresql.blocks_read | The number of blocks read. | source: heap_hit |
| postgresql.blocks_read | The number of blocks read. | source: idx_read |
| postgresql.blocks_read | The number of blocks read. | source: idx_hit |
| postgresql.blocks_read | The number of blocks read. | source: toast_read |
| postgresql.blocks_read | The number of blocks read. | source: toast_hit |
| postgresql.blocks_read | The number of blocks read. | source: tidx_read |
| postgresql.blocks_read | The number of blocks read. | source: tidx_hit |
| postgresql.commits | The number of commits. | |
| postgresql.connection.max | Configured maximum number of client connections allowed | |
| postgresql.database.count | Number of user databases. | |
| postgresql.database.locks | The number of database locks. | |
| postgresql.db_size | The database disk usage. | |
| postgresql.deadlocks | The number of deadlocks. | |
| postgresql.function.calls | The number of calls made to a function. Requires track_functions=pl|all in Postgres config. | |
| postgresql.index.scans | The number of index scans on a table. | |
| postgresql.index.size | The size of the index on disk. | |
| postgresql.operations | The number of db row operations. | operation: hot_upd |
| postgresql.replication.data_delay | The amount of data delayed in replication. | |
| postgresql.rollbacks | The number of rollbacks. | |
| postgresql.rows | The number of rows in the database. | state: dead |
| postgresql.rows | The number of rows in the database. | state: live |
| postgresql.sequential_scans | The number of sequential scans. | |
| postgresql.table.count | Number of user tables in a database. | |
| postgresql.table.size | Disk space used by a table. | |
| postgresql.table.vacuum.count | Number of times a table has manually been vacuumed. | |
| postgresql.temp.io | Total amount of data written to temporary files by queries. | |
| postgresql.temp_files | The number of temp files. | |
| postgresql.tup_deleted | Number of rows deleted by queries in the database. | |
| postgresql.tup_fetched | Number of rows fetched by queries in the database. | |
| postgresql.tup_inserted | Number of rows inserted by queries in the database. | |
| postgresql.tup_returned | Number of rows returned by queries in the database. | |
| postgresql.tup_updated | Number of rows updated by queries in the database. | |
| postgresql.wal.age | Age of the oldest WAL file. | |
| postgresql.wal.delay | Time between flushing recent WAL locally and receiving notification that the standby server has completed an operation with it. | operation: write |
| postgresql.wal.delay | Time between flushing recent WAL locally and receiving notification that the standby server has completed an operation with it. | operation: flush |
| postgresql.wal.delay | Time between flushing recent WAL locally and receiving notification that the standby server has completed an operation with it. | operation: replay |
For the full mapping between OpenTelemetry and Datadog metric names, see OpenTelemetry Metrics Mapping.
Additional helpful documentation, links, and articles:
| |