However, I queried the values in grafana to try to sort them, and the query doesn’t look quite the same as the values I queried in my influxdb, and this is my query statement in grafana
The values queried in Grafan and the values I queried in the database are way too different, is there a problem with my query statement in Grafana, please help me out!
@tengdagg Just to confirm, the query that you’re running in Grafana is using a statically defined time range and is not using the timerange variables (v.timeRangeStart, v.timeRangeStop)?
How are you running the queries in InfluxDB (that filter by specific by a specific tag value)? In the data explorer? In a dashboard cell? If in a dashboard cell, what type of visualization are you using?
One discrepancy between the queries is that the ones you’re running in InfluxDB use the default group key (by measurement and all tags) while the one you’re running in Grafana groups by server_name. count() operates on each group/table. I’d recommend updating the queries you’re running in InfluxDB to use the same grouping before executing a count():
@scott
I want to count the number of requests for server_name in grafana in this specific time period and rank them in descending order of Top10.
|> range(start: 2024-08-21T00:00:00Z, stop: 2024-08-22T00:00:00Z)
Both grafana and influxdb times are like this This time I just conducted a test
This query is a query test for my explorations in grafana, and because of the differences in the data, I have queried the specific domains with differences in influxdb, is there a problem with the query statement in grafana that leads to the different number of results? Is there something wrong with my query statement in grafana that is causing the difference in the number of results?
The query value is not correct in influxdb either, I feel like there is something wrong with my query statement
Ok, the reason I ask what fields exist is because you’re not filtering by field, so the numbers you’re calculating are actually the sum of points across all fields. I don’t think that’s what you’re looking for. I’d suggest filter by a field, just to limit the count to a single field: