Totals do not match

Hello,

I have a problem with calculations.

I have the following graph that shows the total number of WebServices that are being used in a time frame.

The query is the following:

sum(count_over_time({environment=“PRO”, service=“SIC_ATM”} |~ \t([0-9]{1,}\.[0-9]{1,})\t | pattern <month> <day> <loki_hour> <server> <_>:<date> <time> <ip> <response_time> <method> <petid> <ws> <statusid> <size> [$__interval]))

I have another graph, where it shows the total but by WebService. If I add them all, it should show the same amount as in the previous graph, but it doesn’t, it always shows much less.

It has the following query. I have tried both with sum and with count by webservice but it still doesn’t show the correct content.

sum (count_over_time({environment=“PRO”, service=“SIC_ATM”} |~ \t([0-9]{1,}\.[0-9]{1,})\t | pattern <month> <day> <loki_hour> <server> <_>:<date> <time> <ip> <response_time> <method> <petid> <ws> <statusid> <size> [$__interval])) by (ws)

Can you help me?

Thank you very much :wink:

How did you get the total graph? Is it calculated by Grafana Graph?

Can you show screenshot of query inspector for both?

Hello,

I am adding the screenshots you indicated.

If they are not these, please tell me which ones they are.

Please note that the graphs are different in the two graphs.

Not sure, your queries look identical, except that the intervals are different, which could produce small differences.

Couple of things you can try:

  1. Download the JSON data from query inspector for both graphs and compare.
  2. Execute API calls with the queries yourself and compare.

Hello,
In the end what I did was duplicate the graph where it shows the total and change the graph type. Now it shows me the same value.
But I don’t understand why all the configuration was correct and I used the same statement.