Skip to content
Sergio Ocón edited this page Nov 7, 2017 · 1 revision

Rate

A rate defines monetary value calcuations for a single measure in the data. Rates are not used individually, but as part of a Price plan

A rate consists on an input value (value) and a fixed and variable rate:

Cost = fixed_rate + f(variable_rate, value)

Fixed rate is applied in full, independently of the input, while variable rates are applied depending on the input value. When applying fixed rate, that can be prorated by time or not, depending on the calculation (see below)

Screener

Data rollups are created with a context. That context can be anything (i.e. variables to use in rating, tier values, tags, etc). In order to be able to filter based on tags or rates, we compare the context with the rate screener.

  1. If screener is fully included in the context, the rate is used (i.e. the tag is present)
  2. If screener is not fully included in the context, the rate is not used (i.e. the tag is not present)

Let's imagine that the user wants to set up different rates for storage types: "SSD", "HA", "normal". The user would need to define 3 rates with the same input and type but with different screeners, like one that includes storage-type: "SSD", another with storage-type: "HA", and a third one with storage-type: "normal".

Rating will evaluate the event against the screener, and if the event is marked "normal", only the storage-type: "normal"rate would be applied.


Calculation:

There are three types of calculations that can applied to the rate. Calculation is a parameter of the rate itself, and not of the input. You can add as many rates (different or similar) to a price plan.

  • Occurrence: the rate is applied if it is present. For instance, $ 10 per month if the account is present. Fixed cost are always added fully, variable costs will only be added if the account is present. In that way, you can add a fixed rate to the price plan, or a fixed rate if an specific event is present in the system.
  • Duration: the rate is applied depending on the duration of the event. Fixed rate will be prorated, variable rate will be calculated using the duration of the event as a modifier, using both the duration and the quantity of the input for variable rating. (i.e. A VM is rated based on the number of CPU that has been used while the VM was running 4€/hour/CPU)
  • Quantity: the rate is applied depending on the quantity of the value per cycle, independently of the duration. For instance, MB downloaded. That is independent on the time that is needed to download those Mb.

Rate modifiers:

  • Per time: It is possible to define a rate per time (i.e. 5 $ per hour). It will be applied as many times as needed on the cycle
  • Per unit: You can define the same rate as 1$/Mbps or 1000$/Kbps, to make this easier to understand. There is a helper that translates between units.

We differentiate between SI units (Mb = 1000 b), and BINARY units (Mib = 1024b)

Defining per unit or per time won't modify the rates, 24$/day and 1$/hour are exactly the same rate (if you don't take into account 28, 29, 30, 31 days in month).

  • Minimum step: it defines the minimum amount considered. For instance, 1 b with a minimum step of 1MB will be considered as 1MB. Example: Red Hat rates are defined as x$ /year / par of sockets. Using 1 CPU per one month in a single socket 8 core CPU will be charged as 2 sockets one full year.

Tiers [TODO]:

Many times, rates depend on an input parameter (i.e. you get a different price if you buy 1 candy that if you buy 1.000 of them). In IT, many times you get a free tier and a paid tier. Example 1: The price of the CPU is different depending on the number of CPU 0-4 CPU -> 4$/month/CPU variable, 0 fixed 5- CPU --> 5$/month/CPU. 16$ fixed

A VM with 3 CPU will be charged 0 + 4 * 3 = 12$/month A VM with 6 CPU will have to options:

  1. Apply the tier in full (like the candy example): 16$ + 6 * 5$ = 46 $
  2. Apply the tier only with the metrics within the tier: 16$ + (6-4) * 5$ = 26$
  3. Apply all tiers with the metrics within the tier: 4 * 4 + 2 * 5 +16 = 42$

Depending on the circumstances, the three strategies can be used.

In addition, tiers can depend on other parameters in the context: 0 - 100 users in the system --> 5$ /user /month 101 - users in the system -> 4$ / user /month

In this case, the number of users in the system needs to be part of the context of the calculation, and be used to determine the tier to be used.

Discounts [TODO]:

Types of discounts:

  • Rate discounts, are applied after the rate has been done (rate modificators)
  • Billing time discounts, applied when billing is done

Discounts can be a fixed amount or a percentage of total. Normally they should not make the charge to go below 0.