#calculate capacity growth of month and year

1 messages · Page 1 of 1 (latest)

ebon portal
#

Hi,
I'm trying to create a dashboard panel that shows the yearly and monthly growth of the cluster
I'm using but it shows non rational numbers
sum(delta(aggr_space_used{}[360d]))
sum(delta(aggr_space_used{}[30d]))

wooden apex
#

Does this chatgpt answer make any sense ? Seems to be not terrible on my setup :

100 *(avg_over_time(aggr_space_used[30d])
/
avg_over_time(aggr_space_used[30d] offset 30d)
- 1
)
#

Don't shoot the messenger...
Don't assume any of this is correct either, but as always with AI, it seems legit 😄

#

What delta() Actually Does

delta(v[range])

•    Computes last − first value in the range
•    Assumes a gauge
•    Ignores anything outside the range
•    ❌ Does not align “this month vs last month” or “this year vs last year”

So for capacity (absolute disk used), delta() gives:

“How much did disk usage change during this window?”

Not:

“How much bigger is it compared to the same period last month/year?”

#

❌ Why delta() Is Not Correct for MoM / YoY

Example

If disk usage grows steadily:

Time Capacity
Jan 1 100
Jan 31 130
Feb 28 160

delta(capacity[30d]) → 30

This tells you:

“Disk grew by 30 GB this month”

But MoM growth % should be:

(160 − 130) / 130 = 23%

delta() has no reference to the previous month’s value.

#

✅ When delta() Can Be Used (Rare)

You can technically compute growth % inside a single window:

100 *
delta(capacity[30d])
/
capacity offset 30d

But this has problems:

Problem Why
Window-bound Breaks if scrape gaps exist
Calendar misalignment “30d” ≠ “previous month”
No YoY support delta() cannot span 1y cleanly
No seasonality Cannot compare same periods

This is not recommended for reporting.

#

✅ Correct Way (Offset-Based Comparison)

MoM Growth %

100 *
(
avg_over_time(capacity[30d])
/
avg_over_time(capacity[30d] offset 30d)

  • 1
    )

YoY Growth %

100 *
(
avg_over_time(capacity[30d])
/
avg_over_time(capacity[30d] offset 1y)

  • 1
    )

Why this is better:
• Aligns periods correctly
• Stable with hourly scrapes
• Works with Grafana time series
• Matches business expectations

#

🔑 Rule of Thumb

Use case Function
“How much did it grow during this period?” delta()
“How fast is disk growing?” deriv()
“Compare now vs last month/year” offset
“Percent growth MoM / YoY” offset + avg_over_time()

📌 Final Verdict

No — delta() should not be used for MoM or YoY growth percentages.
It answers a different question.

ebon portal
#

i’m not looking for mom growth

#

just simple calc of the capacity growth in TB

#

Like 100-130

#

30tb

#

and the same in yealy

wooden apex
#

Ah yes not a percentage but an absolute value

ebon portal
#

yep

wooden apex
#

Did you try with minus + offset anyways ?

ebon portal
#

sorry for resolution

#

its return 0

#

I can say that some of aggr/node names was change during the last 360d

#

maybe this causing the issue ?

wooden apex
#

It might, does your 30d query work ?

ebon portal
#

I'm not sure if the value is right

#

i need to check it manually

#

to be smarter

#

I think I found something simple that should work sum(aggr_space_used) - sum(aggr_space_used offset 30d)

ebon portal
#

working

#

thanks man

wooden apex
#

That's what I would assume yes, you might want to add a grain of avg_over_time for smoother charts (EDIT, you're not working on a chart, so....)

ebon portal
#

searching by offset in google and found the answer

ebon portal
#

it’s just need to show usage in tb over time

wooden apex
#

I would try to add some avg_over_time() around aggr_space_used offset and aggr_space_used offset 30d

ebon portal
#

its also catching me the last value of aggregates that got destroyed how can I get just the one that exists?

wooden apex
#

In dashboards the harvest team use the aggr_new_status in variables, you probably want to filter on this, somehow

#

Well it seems if you add that variable to your dashboards, and use it as {aggr=~"$Aggregate"} filter it should work

ebon portal
#

got it