Plot a single point instead of a never ending straight line

Need to plot a single dot. If we see the screenshot below.**I need a single dot at **
“2024-11-07 17:11:00” only.and after that i do not need any line at all. I am using prometheus metric.I am using “Time series visualisations”.

If i select “Instant” in the options, i am able to see the single dot but at the last updated time. I want this dot only at “2024-11-07 17:11:00”. Attached screenshot below.

Hi @sanpraka , I think you might be looking for the “Points” option under Graph Styles in the panel options for your time series chart. This should work for any data source that returns time series values.

You can see and click around an example of a chart that shows just points here: Grafana

@mitchelseaman I tried that option also…i need only a single dot…and not continuous dots…With your suggested option, i am getting continuous dots, which is becoming a line…See the screenshot below…

I need only a single dot at “2024-11-07 17:11:00” only

I might have something and I hope you won’t curse me for that :smile:

The main problem is that, since your metric has just started, promql won’t be able to calculate anything - increase / rate / changes will all yield 0. We need to “merge” your series with something, so that prometheus can calculate the increase in the start of the series (that’s the plan). I tried to do or on vector(0) but it seems prometheus creates another series for that, so that’s off the table. I found on some [stack thread[(prometheus - PromQL how to use changes function with a metric consisting of or condition - Stack Overflow), that you can merge your series with zeros by using fragment of the code in the thread. So the query you could use is:

increase((sum(my_metric) by (flow, job) or (my_metric offset -5m * 0))[$__rate_interval:$__rate_interval]) > 0

sum(my_metric) by (flow, job) is the part of query that leaves out the labels you need.
or (my_metric offset -5m * 0) is for creating vectors of zeros with labels we need, so that we have something to calculate increase on (1m of offset would work too). Then increase does the “here is the start of the metric and the value is the increase from 0 to this number” (and since PG will always report the same value, we are safe from other points, they will all be 0). Then we limit the incoming points so that they are higher than 0.

Your query could look like this:

increase(
    sum(((my_custom_counter_total{envName="prod",imageName="img013"}) - on(imageName) (my_custom_counter_total{envName="dev",imageName="img013"}))) by (imageName)
    or on(imageName) (sum(my_custom_counter_total{envName="prod", imageName="img013"} offset -1m) by (imageName) * 0)
[$__rate_interval:$__rate_interval]) > 0

@sanpraka you could also try using the “lines” style, but with the line width reduced to zero, “show points” on and a point size larger than zero…

If that doesn’t work, could you export the panel along with the data you’re working with using the Get Help option in the panel context menu? I could take a look that way.