Skip to content

The pg_replication_slots metric fails on a replica #1794

Closed

Description

@gbartolini

The file config/manager/default-monitoring.yaml contains a metric called pg_replication_slots that at the moment can only be run if executed on the primary due to the execution of functions that cannot be executed on replicas. This is similar to the problem resolved by the patch contained in #1666 (issue #1604).

When running this query on a standby it returns WAL control functions cannot be executed during recovery:

        SELECT slot_name,
          slot_type,
          database,
          active,
          pg_catalog.pg_wal_lsn_diff(pg_catalog.pg_current_wal_lsn(), restart_lsn)
        FROM pg_catalog.pg_replication_slots
        WHERE NOT temporary

This is also still present in the prometheus exporter: prometheus-community/postgres_exporter#547

Activity

  1. sajdakabir commented on Jul 2, 2023

    @sajdakabir

    @gbartolini can I work on this issue?

  2. gbartolini commented on Sep 4, 2023

    @gbartolini
    ContributorAuthor

    Of course, please propose a patch if interested

  3. mblp commented on Sep 16, 2023

    @mblp
  4. added a commit that references this issue on Sep 28, 2023
    0af769f
  5. added a commit that references this issue on Sep 28, 2023
    0e51469
  6. added 2 commits that reference this issue on Sep 28, 2023
    f0715ff
    11e4952
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issue

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions