Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Promtail: allow single job with multiple service discovery elements #1754

Closed
rfratto opened this issue Feb 27, 2020 · 1 comment · Fixed by #1770
Closed

Promtail: allow single job with multiple service discovery elements #1754

rfratto opened this issue Feb 27, 2020 · 1 comment · Fixed by #1770
Labels
type/bug Somehing is not working as expected

Comments

@rfratto
Copy link
Member

rfratto commented Feb 27, 2020

Users can't configure a single job with two different service discovery entries:

- job_name: job
  static_configs:
    - targets:
        - localhost
      labels:
        name: a
        job: job
        __path__: /data/file.a.log
    - targets:
        - localhost
      labels:
        name: b
        job: job
        __path__: /data/file.b.log

When using this config, Promtail will only use the latest element in the array. I believe
these lines are the cause.

@adityacs
Copy link
Contributor

adityacs commented Mar 3, 2020

@rfratto This is a bug coming from here https://github.com/prometheus/prometheus/blob/master/discovery/manager.go#L301. We are missing Source value in our configs. Which in turn ends up with targetGroups containing the last element of the array.

Trying to configure with source value gives Unmarshal error which may be due to https://github.com/prometheus/prometheus/blob/master/discovery/targetgroup/targetgroup.go#L41-L43

The thing is other SD configs like DNS, file etc.. Source is an extracted value. However, for static_configs there is no source extracted.

I am working to fix this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/bug Somehing is not working as expected
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants