-
Notifications
You must be signed in to change notification settings - Fork 12.4k
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
Feature: Treat null as zero for coloring thresholds #2393
Comments
transformNull function works great if you use Graphite |
There's no fill mechanism I can see right now for my backend. |
which is? |
Prometheus |
Does prometheus have transformation functions / features? I have yet to try it out (really eager to do that, might add Prometheus as official data source plugin) |
A pretty decent selection: http://prometheus.io/docs/querying/functions/ |
In grafana 2.1 it seems like the 'null' values are treated as 0 values, as far as the coloring is concerned (even if null is mapped to a text as in #1166). To make it a bit more challening: if lower is better, however, you may want to set thresholds for green/orange/red on 0/1/3, i.e. value >3 is read (but maybe null should also be red). So then a null value becomes green, but you can argue it should be red. When addressing this issue, it is worth to consider it together with #1319. E.g. they could be addressed simultaneously by implementing ranges for text mappings, and specifying color codings for such texts (colors for values are then specified indirectly, which is more flexible but arguably more cumbersome). |
@torkelo I agree with @feliksik and would go as far as calling this a bug: When one of my monitored nodes goes offline, querying its load average returns null. Since the singlestat panel replaces null with zero, the panel shows "N/A" in green, when it really should be red or colourless (preferably depending on a configuration option). Edit: Turns out this feature existed before (#1130), but was removed in cc21c66. Guess we can move the discussion to #1130. |
closing this as most TSDB backends have ways to handle nulls in the query |
it's true that the OR operator fixes this if the expression was null. However, in a single stats page this fixes the color for null values, but breaks that for none-null metrics, as they will be reported having multiple values: the real value and the {} added by your prometheus expression. Can I suggest to re-open this issue? |
@boeboe I updated my expression from the comment above. This one should work for you. Explanation: Prometheus uses label matching in expressions. If your |
@grobie thanks for your explanation. Unfortunately, the Prometheus documentation don't give a clear example on the usage of the Here is my current query: How should I rewrite this one in order to avoid duplicates in case the metrics does exist (in this case of a microservice has return HTTP 4xx responces). Right now the query returns the following 2 results:
|
@grobie nevermind my last comment, must saw you updated the query. Thanks! |
Does anybody have a query workaround for MySQL? |
@TheFrogDaddy you can use a select case when and/or in combination with coalesce function. |
Hi, thanks for getting back to me so quickly. I not getting this to work, am I missing something? Tried this:
AND this
Thanks |
@TheFrogDaddy what are you trying to summarize with |
说的真好 |
This doesn't work with
|
Here is my 2 cents
This can give me the difference of the 2 expression in the targeted interval. If the timeserie is not present the calculation is done considering the value is 0 |
The following MetricsQL query is the easiest one if gaps on the graph must be filled with zeroes:
Contrary to |
this doesn't work when in the expression i use for an example node_id="111|222" but it does work when they are separate like node_id=111 or node_id=222. with this it means i need to do a separate query for each node :/ Is there a solution when a query returns a table and one of the rows have no data? As it is with 'OR on() vector(0)' the row that doesn't have data is just missing and doesn't have a 0. |
For Singlestat panels in particular it would be useful to treat null as zero, otherwise there's no way to color a panel with a null result.
The text was updated successfully, but these errors were encountered: