Skip to content
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

Sum Aggregation function does not work as intended #27

Open
yenicelik opened this issue Mar 19, 2023 · 0 comments
Open

Sum Aggregation function does not work as intended #27

yenicelik opened this issue Mar 19, 2023 · 0 comments

Comments

@yenicelik
Copy link

yenicelik commented Mar 19, 2023

I have the following query:

from(bucket: "dev_web3_proxy")
 |> range(start: 1678780033, stop: 1679256946)
 |> filter(fn: (r) => r["_measurement"] == "global_proxy")
 |> filter(fn: (r) => r["_field"] == "frontend_requests")
 |> filter(fn: (r) => r["chain_id"] == "1")
 |> group(columns: ["chain_id","_measurement","_field","_measurement","error_response","archive_needed"])
 |> aggregateWindow(every: 1000s, fn: mean, createEmpty: false)
 |> group()

Screenshot 2023-03-19 at 22 32 55

which functions correctly. When I now call sum instead of mean, all functions returned are "0", and incorrect. The statement works correctly in the UI:

2023-03-19 22 24 44

Any idea what could be off?

This is what the code returns in the case of "sum":

Influx responses are [
AggregatedRpcAccounting { chain_id: 0, field: "frontend_requests", value: 0.0, time: 2023-03-19T20:16:40+00:00, error_response: false, archive_needed: false }, 
AggregatedRpcAccounting { chain_id: 0, field: "frontend_requests", value: 0.0, time: 2023-03-19T20:16:40+00:00, error_response: false, archive_needed: false }, 
AggregatedRpcAccounting { chain_id: 0, field: "frontend_requests", value: 0.0, time: 2023-03-19T20:16:40+00:00, error_response: false, archive_needed: false }]

while with "mean", it seems correct:

Influx responses are [
AggregatedRpcAccounting { chain_id: 0, field: "frontend_requests", value: 2.5, time: 2023-03-19T20:16:40+00:00, error_response: false, archive_needed: false }, 
AggregatedRpcAccounting { chain_id: 0, field: "frontend_requests", value: 3.7222222222222223, time: 2023-03-19T20:16:40+00:00, error_response: false, archive_needed: false }, 
AggregatedRpcAccounting { chain_id: 0, field: "frontend_requests", value: 1.3333333333333333, time: 2023-03-19T20:16:40+00:00, error_response: false, archive_needed: false }]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant