Skip to content

postgresql_metrics Vector source does not work with PostgreSQL 17 #22094

@unflxw

Description

@unflxw

A note for the community

I have uploaded a reproduction case for convenience: https://github.com/unflxw/vector-postgres-repro

Thank you for looking into this :)

Problem

When pointing the postgresql_metrics vector source at a PostgreSQL 17 instance, the source does not emit any metrics other than up, and instead emits errors related to the checkpoints_timed column being missing:

ERROR source{component_kind="source" component_id=postgres component_type=postgresql_metrics}: 
vector::internal_events::postgresql_metrics: PostgreSQL query error. 
error=failed to get value by key: checkpoints_timed (reason: invalid column `checkpoints_timed`) error_type="request_failed" 
stage="receiving" 
endpoint=postgresql:///vector?host=postgres&port=5432 
internal_log_rate_limit=true

This issue occurs when using PostgreSQL versions 17.0, 17.1 or 17.2. They do not occur on the latest 16.x release.

The likely cause is that the checkpoints_timed column, along with other metrics in pg_stat_bgwriter, was renamed and moved to the pg_stat_checkpointer table in PostgreSQL 17: https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=96f052613f35d07d001c8dd2f284ca8d95f82d1b

Configuration

sources:
  postgres:
    type: postgresql_metrics
    endpoints:
      - postgresql://vector:vector@postgres:5432/vector

transforms:
  postgres_as_log:
    type: metric_to_log
    inputs:
      - postgres

sinks:
  console:
    type: console
    inputs:
      - postgres_as_log
    encoding:
      codec: logfmt

Version

vector 0.44.0 (x86_64-unknown-linux-musl 029a2ff 2024-12-28 05:06:50.742487563) (current timberio/vector:nightly-alpine)

Debug Output

https://gist.github.com/unflxw/a38e28b7bb7f798934093b2bae33dc60

Example Data

No response

Additional Context

I reproduced the issue on Alpine containers on Docker for convenience, though I do not believe the issue is exclusive to either Alpine or Docker.

References

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions