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

Expected different result from count() #4735

Closed
codesome opened this Issue Oct 12, 2018 · 4 comments

Comments

Projects
None yet
3 participants
@codesome
Copy link
Member

codesome commented Oct 12, 2018

Bug Report

What did you do?
Spin up prometheus (with config at the end). All the targets are down.

up{instance="localhost:9100",job="node_exporter",test="tst"} 0
up{instance="localhost:9998",job="dummy2",test="tst"} 0
up{instance="localhost:9999",job="dummy",test="tst"} 0

Ran the query count(up{test=~".*tst.*"} == 1) by (test)

What did you expect to see?
A series/sample with count (value) as 0.

What did you see instead? Under which circumstances?
No data as output. This happens only when all the up series are 0.
This comes as nil in the code, hence any expression including that part becomes nil and interferes with alerting too. For example an alerting rule with count(up{test=~".*tst.*"} == 1) by (test) == 0 would never fire.

  • Prometheus version:

    master @ 3e6b9d4 (post 2.4.3)

  • Prometheus configuration file:

global:
  scrape_interval:     5s
  evaluation_interval: 30s

scrape_configs:
- job_name: node_exporter
  static_configs:
  - targets: ['localhost:9100']
    labels:
      test: tst
- job_name: dummy
  static_configs:
  - targets: ['localhost:9999']
    labels:
      test: tst
- job_name: dummy2
  static_configs:
  - targets: ['localhost:9998']
    labels:
      test: tst
@brian-brazil

This comment has been minimized.

@codesome

This comment has been minimized.

Copy link
Member Author

codesome commented Oct 12, 2018

@codesome

This comment has been minimized.

Copy link
Member Author

codesome commented Oct 12, 2018

Thanks @brian-brazil for the blog post!

@codesome codesome closed this Oct 12, 2018

@metalmatze

This comment has been minimized.

Copy link
Contributor

metalmatze commented Oct 12, 2018

Thanks for further looking into at @codesome. 💯

@lock lock bot locked and limited conversation to collaborators Apr 10, 2019

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.