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

Tagged thresholds improperly saved in the TimescaleDB's threshold table #13

Open
viginti23 opened this issue Oct 27, 2022 · 3 comments
Open

Comments

@viginti23
Copy link

As mentioned it the title, when passing tagged metrics in thresholds like so:
'http_req_duration{name:login}': ['p(95)<55000'],

they are not saved properly in the database, namely the metrics are not separated from their tags and the 'tags' column in the threshold table is populated with nulls.

@mstoykov
Copy link
Contributor

I did some digging and ... ughh.

So the column tags was removed as part of #1 in specifically a73723c which in practice dropped it.

Later when I had to make this runnable I readded the column ... I think because there was a query that used it and it was failing the whole dashboard

I kind of wonder if it's needed even 🤷

I kind of feel like dropping the whole column again and removing it usage 🤔

We will need to readd the parsing of the threshold. Which might not work in the future if we add more stuff in k6. Maybe we should have the tags accessible from the Threshold directly from k6 🤷.

cc @javaducky do you have any input here?

@viginti23 what do you want to use that column for? Does it make sense to have it at all? I mean it seems like we will always want to show the whole name(including the metric name).

I guess if you have a lot of thresholds it might be nice to query based on tags and or metric not the two at the same time 🤔 But seems kind of niche to me and still doable without the column.

@viginti23
Copy link
Author

Hi,
I think you are right, looks like there might not be any need for that column (at least at the moment :) ).

@danhngo-lx
Copy link

In my case I want the tags column to be filled with at least the testid field (that is passed when executing the k6 script) so that the graph for the checks can be more accurate. For example at the moment this is the query for the thresholds graph:

SELECT
  CASE WHEN "tags" IS NULL THEN "metric" ELSE "metric" || '{' || (SELECT key || ':' || value FROM jsonb_each_text("tags")) || '}' END,
  "threshold",
  CASE WHEN "last_failed" THEN 0 ELSE 1 END AS pass_fail
FROM
  thresholds
WHERE
  $__timeFilter(ts)
ORDER BY 3 ASC
LIMIT 100

The problem with this is when I'm checking out a specific test id, this won't show the correct thresholds for that test id.
I'm expecting to be able to filter the thresholds by test id like this:

SELECT
  CASE WHEN "tags" IS NULL THEN "metric" ELSE "metric" || '{' || (SELECT key || ':' || value FROM jsonb_each_text("tags")) || '}' END,
  "threshold",
  CASE WHEN "last_failed" THEN 0 ELSE 1 END AS pass_fail
FROM
  thresholds
WHERE
  $__timeFilter(ts)
AND tags->>'testid' = '$k6_testid'
ORDER BY 3 ASC
LIMIT 100

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants