grafana / loki

Like Prometheus, but for logs.
https://grafana.com/loki
GNU Affero General Public License v3.0
23.81k stars 3.43k forks source link

Null result when expecting a 0 count #4449

Open viraptor opened 3 years ago

viraptor commented 3 years ago

Describe the bug (originally reported at https://github.com/grafana/grafana/issues/40246 but I think it's a loki bug) When running a query like count_over_time({unit="foo.service"} |= "ClientConnect" [1m]) I'm expecting the result to be 0 when there are no matching lines even.

To Reproduce

  1. Run loki from docker image sha256:c2d16210db36042c6a4b4f6ece2e8327f92f3d9f7ba7189b6ea6c74692a8a1be (corresponds to commit 415d4b03faf8b6fcbc850ef9416646f8bcbc6526)
  2. Run a count_over_time(...) query.
  3. Get back response like:
    {
    "status": "success",
    "data": {
    "resultType": "matrix",
    "result": null,
    "stats": { ... }
    }
    }

Expected behavior When there are no matches, I expect the result to be 0 rather than empty.

Environment:

viraptor commented 3 years ago

Seems to be a duplicate of https://github.com/grafana/loki/issues/4420

Korijn commented 2 years ago

FYI I updated to the latest release of the loki-stack last week and I'm still seeing this issue.

Doesn't seem to be a true duplicate of #4420 because I don't get any JS errors in the console.

viraptor commented 2 years ago

That's true. I'll reopen this and let devs make the dupe decision.

cyriltovena commented 2 years ago

@kavirajk I think you worked on something similar any input ?

stale[bot] commented 2 years ago

Hi! This issue has been automatically marked as stale because it has not had any activity in the past 30 days.

We use a stalebot among other tools to help manage the state of issues in this project. A stalebot can be very useful in closing issues in a number of cases; the most common is closing issues or PRs where the original reporter has not responded.

Stalebots are also emotionless and cruel and can close issues which are still very relevant.

If this issue is important to you, please add a comment to keep it open. More importantly, please add a thumbs-up to the original issue entry.

We regularly sort for closed issues which have a stale label sorted by thumbs up.

We may also:

We are doing our best to respond, organize, and prioritize all issues but it can be a challenging task, our sincere apologies if you find yourself at the mercy of the stalebot.

viraptor commented 2 years ago

I do think this issue is relevant, thanks bot.

stale[bot] commented 2 years ago

Hi! This issue has been automatically marked as stale because it has not had any activity in the past 30 days.

We use a stalebot among other tools to help manage the state of issues in this project. A stalebot can be very useful in closing issues in a number of cases; the most common is closing issues or PRs where the original reporter has not responded.

Stalebots are also emotionless and cruel and can close issues which are still very relevant.

If this issue is important to you, please add a comment to keep it open. More importantly, please add a thumbs-up to the original issue entry.

We regularly sort for closed issues which have a stale label sorted by thumbs up.

We may also:

We are doing our best to respond, organize, and prioritize all issues but it can be a challenging task, our sincere apologies if you find yourself at the mercy of the stalebot.

viraptor commented 2 years ago

Still relevant

stale[bot] commented 2 years ago

Hi! This issue has been automatically marked as stale because it has not had any activity in the past 30 days.

We use a stalebot among other tools to help manage the state of issues in this project. A stalebot can be very useful in closing issues in a number of cases; the most common is closing issues or PRs where the original reporter has not responded.

Stalebots are also emotionless and cruel and can close issues which are still very relevant.

If this issue is important to you, please add a comment to keep it open. More importantly, please add a thumbs-up to the original issue entry.

We regularly sort for closed issues which have a stale label sorted by thumbs up.

We may also:

We are doing our best to respond, organize, and prioritize all issues but it can be a challenging task, our sincere apologies if you find yourself at the mercy of the stalebot.

Korijn commented 2 years ago

Still relevant

kovaxur commented 2 years ago

Hi, I also have the same problem on Loki 2.5, using Ruler, the rules are failing: Rule: alert, when there are error level logs -> ruler will fail to evaluate rule, when there are no error logs

msg="Evaluating rule failed" rule="XXX" err="rule result is not a vector or scalar"

It's hard to see, if we have misconfigured alerting rules or it's just working fine.. It would be nice to be able to default to some value in case there are no log lines.