Hey Nikhil,
this is actually kind of possible, by using the .derivative()
function to detect the drop of the line.
The following example would draw a point at a fixed value (10) every time the line dropped:
.es(metric='max:ruUPTime').derivative().if(lt, 0, 10, null)
It first build the derivative - which will be negative everytime the line dropped and positive in all other cases. Then we'll use the if
function on it, to set the value to 10, if the derivative was negative, and to null
(i.e. remove it from the graph) if it was positive.
This is very very slightly different from what you asked, since this points will actually be not the one you marked red, but the first one after it dropped (since this is the data point, where the derivative got negative). Also it just places the point at a fixed height (10 or whatever you like).
If you want to show the point on the y-axis at the actual value (uptime) the server had before, you need a slightly more complex expression:
.es(metric='max:ruUPTime').derivative().if(lt, 0, .es(metric='max:ruUPTime', offset=-1s, fit=carry), null)
That way, if the derivative gets negative, you won't just fill in an static value, but you will fill in the value, that this series had 1 second earlier (offset=-1s
), while using the carry
fit method, meaning, it doesn't interpolate the value between the previous and the current value, but just leave it at it's previous value until it changes. Which in this case mean, the value 1 second earlier will still be the same as the previous data point.
I hope this expressions helped you getting started. Please feel free to reach out with any further questions
Cheers,
Tim