Skip to content

Config parser does not complain about overriden parts of configuration #1275

@RichiH

Description

@RichiH

While I readily agree that autogenerated config files should not have this problem, and that YAML works that way, especially in the trial phase, this can confuse users. Warning or, preferably, erroring out would be appreciated.

If you run with a configuration like:

scrape_configs:
  - job_name: 'prometheus_system'
    target_groups:
    - targets: ['localhost:9100']

scrape_configs:
  - job_name: 'foo_system'
    target_groups:
    - targets: ['foot:9100']

the former scrape_configs is silently discarded. While that's the obvious case, constructs like

scrape_configs:
  - job_name: 'prometheus_system'
    target_groups:
    - targets: ['localhost:9100']

rule_files:
  - 'prometheus.rules'

scrape_configs:
  - job_name: 'foo_system'
    target_groups:
    - targets: ['foo:9100']

are silently discarded as well.

So to summarize: Yes, I fat-fingered, but principle of least surprise would be to error out instead of silently carrying on.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions