Skip to content

Improve error reporting when configured metrics are missing or invalid #1125

@AnannyaMahajan

Description

@AnannyaMahajan

Problem

When a metric is configured for a source but its metric definition is missing
or invalid, pgwatch currently emits limited or rate-limited warnings and skips
metric collection.

This makes it difficult for users to understand why certain metrics are not
being collected, especially in larger or dynamic configurations.

** Steps to reproduce**

  1. Configure a source with a metric name that does not exist in metric definitions
  2. Start pgwatch
  3. Observe that metric collection is skipped with minimal or delayed logging

Current behavior

  • Warnings are rate-limited and may not appear immediately
  • Log messages do not always include enough context (source + metric)
  • Users must inspect configuration or code to identify the root cause

Expected behavior

  • Clear and immediate warning when a configured metric has no valid definition
  • Log messages should include:
    • Source name
    • Metric name
    • Reason (missing definition, unsupported version, etc.)

Proposed improvement

Improve error reporting to:

  • Emit clearer warnings when a metric definition is missing or invalid
  • Include source and metric context in log messages
  • Retain rate-limiting to avoid excessive log spam

** Environment**

  • pgwatch version: current master
  • OS: independent

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requestmetricsMetrics related issues

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions