PostgreSQL metrics
Collect metrics from the PostgreSQL database
status: beta
role: daemon
role: sidecar
delivery: at-least-once
acknowledgements: no
egress: batch
state: stateless
output: metrics
PostgreSQL is a powerful, open source object-relational database system with over 30 years
of active development that has earned it a strong reputation for reliability, feature robustness, and
performance.
Configuration
Example configurations
{
"sources": {
"my_source_id": {
"type": "postgresql_metrics",
"endpoints": [
"postgresql://postgres:vector@localhost:5432/postgres"
],
"scrape_interval_secs": 15
}
}
}
[sources.my_source_id]
type = "postgresql_metrics"
endpoints = [ "postgresql://postgres:vector@localhost:5432/postgres" ]
scrape_interval_secs = 15
---
sources:
my_source_id:
type: postgresql_metrics
endpoints:
- postgresql://postgres:vector@localhost:5432/postgres
scrape_interval_secs: 15
{
"sources": {
"my_source_id": {
"type": "postgresql_metrics",
"endpoints": [
"postgresql://postgres:vector@localhost:5432/postgres"
],
"scrape_interval_secs": 15,
"namespace": "postgresql",
"include_databases": [
"^postgres$"
],
"exclude_databases": [
"^postgres$"
],
"tls": null
}
}
}
[sources.my_source_id]
type = "postgresql_metrics"
endpoints = [ "postgresql://postgres:vector@localhost:5432/postgres" ]
scrape_interval_secs = 15
namespace = "postgresql"
include_databases = [ "^postgres$" ]
exclude_databases = [ "^postgres$" ]
---
sources:
my_source_id:
type: postgresql_metrics
endpoints:
- postgresql://postgres:vector@localhost:5432/postgres
scrape_interval_secs: 15
namespace: postgresql
include_databases:
- ^postgres$
exclude_databases:
- ^postgres$
tls: null
endpoints
required [string]PostgreSQL server endpoint in libpq-style connection strings.
exclude_databases
optional [string]A list of databases to match (by using POSIX Regular Expressions) against
the
datname
column for which you don’t want to collect metrics from.
Specifying ""
will include metrics where datname
is NULL
.
This can be used in conjunction with include_databases
.include_databases
optional [string]A list of databases to match (by using POSIX Regular Expressions) against
the
datname
column for which you want to collect metrics from. If not set, metrics are collected from
all databases. Specifying ""
will include metrics where datname
is NULL
. This can be used in
conjunction with exclude_databases
.Outputs
<component_id>
Default output stream of the component. Use this component’s ID as an input to downstream transforms and sinks.
Output Data
Metrics
pg_stat_bgwriter_buffers_alloc_total
counterNumber of buffers allocated.
endpoint
PostgreSQL endpoint.
host
The hostname of the PostgreSQL server.
pg_stat_bgwriter_buffers_backend_fsync_total
counterNumber of times a backend had to execute its own fsync call (normally the background writer handles those even when the backend does its own write).
endpoint
PostgreSQL endpoint.
host
The hostname of the PostgreSQL server.
pg_stat_bgwriter_buffers_backend_total
counterNumber of buffers written directly by a backend.
endpoint
PostgreSQL endpoint.
host
The hostname of the PostgreSQL server.
pg_stat_bgwriter_buffers_checkpoint_total
counterNumber of buffers written during checkpoints.
endpoint
PostgreSQL endpoint.
host
The hostname of the PostgreSQL server.
pg_stat_bgwriter_buffers_clean_total
counterNumber of buffers written by the background writer.
endpoint
PostgreSQL endpoint.
host
The hostname of the PostgreSQL server.
pg_stat_bgwriter_checkpoint_sync_time_seconds_total
counterTotal amount of time that has been spent in the portion of checkpoint processing where files are synchronized to disk.
endpoint
PostgreSQL endpoint.
host
The hostname of the PostgreSQL server.
pg_stat_bgwriter_checkpoint_write_time_seconds_total
counterTotal amount of time that has been spent in the portion of checkpoint processing where files are written to disk.
endpoint
PostgreSQL endpoint.
host
The hostname of the PostgreSQL server.
pg_stat_bgwriter_checkpoints_req_total
counterNumber of requested checkpoints that have been performed.
endpoint
PostgreSQL endpoint.
host
The hostname of the PostgreSQL server.
pg_stat_bgwriter_checkpoints_timed_total
counterNumber of scheduled checkpoints that have been performed.
endpoint
PostgreSQL endpoint.
host
The hostname of the PostgreSQL server.
pg_stat_bgwriter_maxwritten_clean_total
counterNumber of times the background writer stopped a cleaning scan because it had written too many buffers.
endpoint
PostgreSQL endpoint.
host
The hostname of the PostgreSQL server.
pg_stat_bgwriter_stats_reset
gaugeTime at which these statistics were last reset.
endpoint
PostgreSQL endpoint.
host
The hostname of the PostgreSQL server.
pg_stat_database_blk_read_time_seconds_total
counterTime spent reading data file blocks by backends in this database, in milliseconds (if
track_io_timing
is enabled, otherwise zero).endpoint
PostgreSQL endpoint.
host
The hostname of the PostgreSQL server.
type
Database name.
pg_stat_database_blk_write_time_seconds_total
counterTime spent writing data file blocks by backends in this database, in milliseconds (if
track_io_timing
is enabled, otherwise zero).endpoint
PostgreSQL endpoint.
host
The hostname of the PostgreSQL server.
type
Database name.
pg_stat_database_blks_hit_total
counterNumber of times disk blocks were found already in the buffer cache, so that a read was not necessary (this only includes hits in the PostgreSQL buffer cache, not the operating system’s file system cache).
endpoint
PostgreSQL endpoint.
host
The hostname of the PostgreSQL server.
type
Database name.
pg_stat_database_blks_read_total
counterNumber of disk blocks read in this database.
endpoint
PostgreSQL endpoint.
host
The hostname of the PostgreSQL server.
type
Database name.
pg_stat_database_checksum_failures_total
counterNumber of data page checksum failures detected in this database (or on a shared object), or 0 if data checksums are not enabled.
endpoint
PostgreSQL endpoint.
host
The hostname of the PostgreSQL server.
type
Database name.
pg_stat_database_checksum_last_failure
gaugeTime at which the last data page checksum failure was detected in this database (or on a shared object), or 0 if data checksums are not enabled.
endpoint
PostgreSQL endpoint.
host
The hostname of the PostgreSQL server.
type
Database name.
pg_stat_database_conflicts_confl_bufferpin_total
counterNumber of queries in this database that have been canceled due to pinned buffers.
endpoint
PostgreSQL endpoint.
host
The hostname of the PostgreSQL server.
type
Database name.
pg_stat_database_conflicts_confl_deadlock_total
counterNumber of queries in this database that have been canceled due to deadlocks.
endpoint
PostgreSQL endpoint.
host
The hostname of the PostgreSQL server.
type
Database name.
pg_stat_database_conflicts_confl_lock_total
counterNumber of queries in this database that have been canceled due to lock timeouts.
endpoint
PostgreSQL endpoint.
host
The hostname of the PostgreSQL server.
type
Database name.
pg_stat_database_conflicts_confl_snapshot_total
counterNumber of queries in this database that have been canceled due to old snapshots.
endpoint
PostgreSQL endpoint.
host
The hostname of the PostgreSQL server.
type
Database name.
pg_stat_database_conflicts_confl_tablespace_total
counterNumber of queries in this database that have been canceled due to dropped tablespaces.
endpoint
PostgreSQL endpoint.
host
The hostname of the PostgreSQL server.
type
Database name.
pg_stat_database_conflicts_total
counterNumber of queries canceled due to conflicts with recovery in this database. (Conflicts occur only on standby servers; see
pg_stat_database_conflicts
for details.)endpoint
PostgreSQL endpoint.
host
The hostname of the PostgreSQL server.
type
Database name.
pg_stat_database_datid
gaugeOID of this database, or 0 for objects belonging to a shared relation.
endpoint
PostgreSQL endpoint.
host
The hostname of the PostgreSQL server.
type
Database name.
pg_stat_database_deadlocks_total
counterNumber of deadlocks detected in this database.
endpoint
PostgreSQL endpoint.
host
The hostname of the PostgreSQL server.
type
Database name.
pg_stat_database_numbackends
gaugeNumber of backends currently connected to this database, or 0 for shared objects. This is the only column in this view that returns a value reflecting current state; all other columns return the accumulated values since the last reset.
endpoint
PostgreSQL endpoint.
host
The hostname of the PostgreSQL server.
type
Database name.
pg_stat_database_stats_reset
gaugeTime at which these statistics were last reset.
endpoint
PostgreSQL endpoint.
host
The hostname of the PostgreSQL server.
type
Database name.
pg_stat_database_temp_bytes_total
counterTotal amount of data written to temporary files by queries in this database. All temporary files are counted, regardless of why the temporary file was created, and regardless of the
log_temp_files
setting.endpoint
PostgreSQL endpoint.
host
The hostname of the PostgreSQL server.
type
Database name.
pg_stat_database_temp_files_total
counterNumber of temporary files created by queries in this database. All temporary files are counted, regardless of why the temporary file was created (e.g., sorting or hashing), and regardless of the
log_temp_files
setting.endpoint
PostgreSQL endpoint.
host
The hostname of the PostgreSQL server.
type
Database name.
pg_stat_database_tup_deleted_total
counterNumber of rows deleted by queries in this database.
endpoint
PostgreSQL endpoint.
host
The hostname of the PostgreSQL server.
type
Database name.
pg_stat_database_tup_fetched_total
counterNumber of rows fetched by queries in this database.
endpoint
PostgreSQL endpoint.
host
The hostname of the PostgreSQL server.
type
Database name.
pg_stat_database_tup_inserted_total
counterNumber of rows inserted by queries in this database.
endpoint
PostgreSQL endpoint.
host
The hostname of the PostgreSQL server.
type
Database name.
pg_stat_database_tup_returned_total
counterNumber of rows returned by queries in this database.
endpoint
PostgreSQL endpoint.
host
The hostname of the PostgreSQL server.
type
Database name.
pg_stat_database_tup_updated_total
counterNumber of rows updated by queries in this database.
endpoint
PostgreSQL endpoint.
host
The hostname of the PostgreSQL server.
type
Database name.
pg_stat_database_xact_commit_total
counterNumber of transactions in this database that have been committed.
endpoint
PostgreSQL endpoint.
host
The hostname of the PostgreSQL server.
type
Database name.
Telemetry
Metrics
linkcollect_completed_total
counterThe total number of metrics collections completed for this component.
host
optional
The hostname of the system Vector is running on.
pid
optional
The process ID of the Vector instance.
collect_duration_seconds
histogramThe duration spent collecting of metrics for this component.
host
optional
The hostname of the system Vector is running on.
pid
optional
The process ID of the Vector instance.
component_discarded_events_total
counterThe number of events dropped by this component.
component_id
The Vector component ID.
component_kind
The Vector component kind.
component_name
Deprecated, use
component_id
instead. The value is the same as component_id
.component_type
The Vector component type.
host
optional
The hostname of the system Vector is running on.
pid
optional
The process ID of the Vector instance.
component_errors_total
counterThe total number of errors encountered by this component.
component_id
The Vector component ID.
component_kind
The Vector component kind.
component_name
Deprecated, use
component_id
instead. The value is the same as component_id
.component_type
The Vector component type.
error_type
The type of the error
host
optional
The hostname of the system Vector is running on.
pid
optional
The process ID of the Vector instance.
stage
The stage within the component at which the error occurred.
component_received_bytes_total
counterThe number of raw bytes accepted by this component from source origins.
component_id
The Vector component ID.
component_kind
The Vector component kind.
component_name
Deprecated, use
component_id
instead. The value is the same as component_id
.component_type
The Vector component type.
container_name
optional
The name of the container from which the data originated.
file
optional
The file from which the data originated.
host
optional
The hostname of the system Vector is running on.
mode
optional
The connection mode used by the component.
peer_addr
optional
The IP from which the data originated.
peer_path
optional
The pathname from which the data originated.
pid
optional
The process ID of the Vector instance.
pod_name
optional
The name of the pod from which the data originated.
uri
optional
The sanitized URI from which the data originated.
component_received_event_bytes_total
counterThe number of event bytes accepted by this component either from
tagged origins like file and uri, or cumulatively from other origins.
component_id
The Vector component ID.
component_kind
The Vector component kind.
component_name
Deprecated, use
component_id
instead. The value is the same as component_id
.component_type
The Vector component type.
container_name
optional
The name of the container from which the data originated.
file
optional
The file from which the data originated.
host
optional
The hostname of the system Vector is running on.
mode
optional
The connection mode used by the component.
peer_addr
optional
The IP from which the data originated.
peer_path
optional
The pathname from which the data originated.
pid
optional
The process ID of the Vector instance.
pod_name
optional
The name of the pod from which the data originated.
uri
optional
The sanitized URI from which the data originated.
component_received_events_total
counterThe number of events accepted by this component either from tagged
origins like file and uri, or cumulatively from other origins.
component_id
The Vector component ID.
component_kind
The Vector component kind.
component_name
Deprecated, use
component_id
instead. The value is the same as component_id
.component_type
The Vector component type.
container_name
optional
The name of the container from which the data originated.
file
optional
The file from which the data originated.
host
optional
The hostname of the system Vector is running on.
mode
optional
The connection mode used by the component.
peer_addr
optional
The IP from which the data originated.
peer_path
optional
The pathname from which the data originated.
pid
optional
The process ID of the Vector instance.
pod_name
optional
The name of the pod from which the data originated.
uri
optional
The sanitized URI from which the data originated.
component_sent_event_bytes_total
counterThe total number of event bytes emitted by this component.
component_id
The Vector component ID.
component_kind
The Vector component kind.
component_name
Deprecated, use
component_id
instead. The value is the same as component_id
.component_type
The Vector component type.
host
optional
The hostname of the system Vector is running on.
output
optional
The specific output of the component.
pid
optional
The process ID of the Vector instance.
component_sent_events_total
counterThe total number of events emitted by this component.
component_id
The Vector component ID.
component_kind
The Vector component kind.
component_name
Deprecated, use
component_id
instead. The value is the same as component_id
.component_type
The Vector component type.
host
optional
The hostname of the system Vector is running on.
output
optional
The specific output of the component.
pid
optional
The process ID of the Vector instance.
events_in_total
counterThe number of events accepted by this component either from tagged
origins like file and uri, or cumulatively from other origins.
This metric is deprecated and will be removed in a future version.
Use
component_received_events_total
instead.component_id
The Vector component ID.
component_kind
The Vector component kind.
component_name
Deprecated, use
component_id
instead. The value is the same as component_id
.component_type
The Vector component type.
container_name
optional
The name of the container from which the data originated.
file
optional
The file from which the data originated.
host
optional
The hostname of the system Vector is running on.
mode
optional
The connection mode used by the component.
peer_addr
optional
The IP from which the data originated.
peer_path
optional
The pathname from which the data originated.
pid
optional
The process ID of the Vector instance.
pod_name
optional
The name of the pod from which the data originated.
uri
optional
The sanitized URI from which the data originated.
events_out_total
counterThe total number of events emitted by this component.
This metric is deprecated and will be removed in a future version.
Use
component_sent_events_total
instead.component_id
The Vector component ID.
component_kind
The Vector component kind.
component_name
Deprecated, use
component_id
instead. The value is the same as component_id
.component_type
The Vector component type.
host
optional
The hostname of the system Vector is running on.
output
optional
The specific output of the component.
pid
optional
The process ID of the Vector instance.
request_errors_total
counterThe total number of requests errors for this component.
host
optional
The hostname of the system Vector is running on.
pid
optional
The process ID of the Vector instance.
source_lag_time_seconds
histogramThe difference between the timestamp recorded in each event and the time when it was ingested, expressed as fractional seconds.
component_id
The Vector component ID.
component_kind
The Vector component kind.
component_name
Deprecated, use
component_id
instead. The value is the same as component_id
.component_type
The Vector component type.
host
optional
The hostname of the system Vector is running on.
pid
optional
The process ID of the Vector instance.