Skip to content
This repository has been archived by the owner on Sep 3, 2020. It is now read-only.

GKE metering cost_with_unallocated_untracked #337

Open
alsyia opened this issue May 15, 2020 · 0 comments
Open

GKE metering cost_with_unallocated_untracked #337

alsyia opened this issue May 15, 2020 · 0 comments

Comments

@alsyia
Copy link

alsyia commented May 15, 2020

Hi,

I have a question regarding the GKE Metering connector. What does the cost_with_unallocated_untracked metric represents? How is it computed? I took a look at the query but it's quite verbose.

I'm quite puzzled at how it's possible to track "unallocated/untracked" costs down to a specific combination of request and labels.

For example I get CPU request entries where the cost and the cost_with_unallocated_untracked are really different, and I'm not sure which one I should use.

Any explanation about this would be welcome :)

(Also, apologies if this is not the right place to ask)

Thanks!

EDIT:

Ok, I took some time to analyse the query.

First I don't understand the difference between unallocated_usage and breakdown_untracked_resource_usage. The only difference between these two tables is that the first one has been filtered on namespace="unallocated", but since they are both made from untracked_resource_usage in which all entries have namespace="unallocated", I don't really see the point. So I'm going to consider unallocated means the same thing as untracked in the following lines.

This being said, resource_usage.amount_with_untracked is just resource_usage.amount_with_untracked times a rate.
resource_usage.amount_with_untracked has the following formula:

resource_usage.amount_with_untracked = filtered_resource_usage_with_unused.amount + filtered_resource_usage_with_unused.allocate_unused + unallocated_usage.amount * (filtered_resource_usage_with_unused.amount / total_used.amount)

And of course, filtered_resource_usage_with_unused.allocate_unused is defined a few lines above like this:

  filtered_resource_usage_with_unused.allocate_unused = (filtered_resource_usage.amount / aggregated_resource_usage_by_resource_name.amount) * breakdown_untracked_resource_usage.amount

I somewhat understand allocate_unused; we take every resource (cpu/mem/networkEgress) we have not been able to track down to a specific reservation, and we split them between all reservations with a proportionality rule: each reservation (entry in filtered_resource_usage) gets a part of the untracked resources proportional to how much resource it reserved compared to the total reserved. (that's the quotient part).

So allocate_unused is a share of the unused (= untracked = not reserved) resources attributed to this particular reservation. (I find the term "unused" misleading, because they could very well be used, they just can't be tracked down to a reservation, which means a workload somewhere is exceeding it's request?)

Now if we look at resource_usage.amount_with_untracked, it's the sum of the real usage/reservation + the share of untracked usage attributed (so far so good), + another share of untracked usage, but this times the ratio used for the attribution is the share of the reservation in the total usage billed! That's a different way to attribute untracked usage, I guessed, but the resulting value doesn't really makes sense to me.

I guess I'm wrong somewhere (maybe about the "unallocated" part), because it looks to me like unallocated and unused are the same quantities, which doesn't make sense. And the resulting amount_with_untracked I don't understand either...

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant