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

Mismatched interval in description and generated sql for double-groupby-X series #216

Open
JackieTien97 opened this issue Nov 23, 2022 · 0 comments

Comments

@JackieTien97
Copy link

In the descriptions of README for double-groupby-X series, it says that Aggregate on across both time and host, giving the average of 1(or 2, or all) CPU metric per host per hour for 24 hours.

However, in the generated sql for InfluxDB and TimescaleDB(I just checked these two, don't whether others are mismatched), it's per hour for 12 hours instead of per hour for 24 hours

Sql generated for double-groupby-all

InfluxDB

SELECT mean(usage_user), mean(usage_system), mean(usage_idle), mean(usage_nice), mean(usage_iowait), mean(usage_irq), mean(usage_softirq), mean(usage_steal), mean(usage_guest), mean(usage_guest_nice) from cpu where time >= '2016-01-01T21:18:55Z' and time < '2016-01-02T09:18:55Z' group by time(1h),hostname

TimescaleDB

WITH cpu_avg AS (
          SELECT time_bucket('3600 seconds', time) as hour, tags_id,
          avg(usage_user) as mean_usage_user, avg(usage_system) as mean_usage_system, avg(usage_idle) as mean_usage_idle, avg(usage_nice) as mean_usage_nice, avg(usage_iowait) as mean_usage_iowait, avg(usage_irq) as mean_usage_irq, avg(usage_softirq) as mean_usage_softirq, avg(usage_steal) as mean_usage_steal, avg(usage_guest) as mean_usage_guest, avg(usage_guest_nice) as mean_usage_guest_nice
          FROM cpu
          WHERE time >= '2016-01-02 11:22:40.646325 +0000' AND time < '2016-01-02 23:22:40.646325 +0000'
          GROUP BY 1, 2
        )
        SELECT hour, tags.hostname, mean_usage_user, mean_usage_system, mean_usage_idle, mean_usage_nice, mean_usage_iowait, mean_usage_irq, mean_usage_softirq, mean_usage_steal, mean_usage_guest, mean_usage_guest_nice
        FROM cpu_avg
        JOIN tags ON cpu_avg.tags_id = tags.id
        ORDER BY hour, tags.hostname
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