Thought Leadership

Amberflo - benefits of long-lasting meters

March 27, 2023

To be the true system of record and the source-of-truth for usage and consumption data, a metering system must be capable of accurately tracking usage for all types of events and resources.

As we have written before, Amberflo allows you to meter both instantaneous, discrete events as well as long-lasting events which take place over time. In reality, since long-lasting events describe non-momentary resource consumption at some frequency/scale, the system is tracking the usage rate when metering long-lasting events.

To calculate the true usage from the usage rate, we can imagine the usage rate over time plotted on a graph as shown below. In this case, the usage can be thought of as the area underneath the curve, or the integral, of the usage rate plotted over time. Let’s walk through an example.

Consider a cloud database, where you are metering and billing customers based on data storage. Data storage is a long-lasting resource; if you upload files that take 10GB of memory, then that 10GB is being consumed for as long as the files are saved in the database. In reality, 10GB per unit time is the usage rate after uploading 10GB worth of files. If data is added or removed, then the usage rate will change accordingly. Given this data storage information over some day:

We can plot this usage over time as shown on the chart below. To calculate the total usage over the full day, we find the area under the curve. Ordinarily we would use a definite integral to solve, however since this is a simple example we can use the method of a Riemann sum:

Usage = (10 GB/hr)(6hr) + (7 GB/hr)(6hr) + (12 GB/hr)(6hr) + (12 GB/hr)(5hr) + (10 GB/hr)(1hr)Usage = 60 + 42 + 72 + 60 + 10 = 246 GB

Amberflo differentiation with respect to long-lasting events

Supporting both long-lasting and instantaneous events out-of-the-box provides a number of key advantages. Many competing platforms only offer the concept of a counter meter, which can only meter discrete events but not usage rate events.

To meter long-lasting events using only the counter meter, you will need to perform some calculations on your own before reporting the event to the metering system. Effectively, you would need to calculate the usage from the usage rate and then report this to the metering system each time there is a change. This approach imposes errors and latency since the usage for a particular rate can’t be calculated until the rate changes, it adds effort and resources demand on your side and at best will only offer an approximation of true usage.

Some of the key benefits of having the concept of long-lasting meters include:

  • Apply usage functions.
    Since Amberflo calculates the raw usage from long-lasting meters, users are able to define and apply functions on top of this usage. Common examples of usage functions are calculating uniqueness and the max usage over a period of time. Without the ability to accurately meter long-lasting events, it would not be possible to apply usage functions.
  • Delete and modify meters.
    Amberflo offers the ability to delete erroneous/unwanted meter events or to modify already-ingested events in the case of a reporting error or bug in the metering pipeline. Since Amberflo is able to ingest long-lasting events raw, without any pre-calculation on the user side, users are able to delete/modify those raw events in Amberflo. In the case where a platform does not have a concept of long-lasting events, then the onus is on the customer to calculate usage from the usage rate and consumption time, and report this to the metering service. Since the user is calculating and reporting events, then it would become the user’s responsibility to delete or edit any events.
  • Support a timeout period.
    The way long-lasting meters are built in Amberflo, users can configure a timeout period. After this duration passes with no further events received, the meter value will reset. This is used to preserve accuracy in case a ‘stop event’ is ever lost or not received. The timeout allows the user to set the maximum length of time that resource can be consumed for until the usage must stop and the meter value reset.
  • Real-time visibility to raw usage data.
    Amberflo is able to accurately track usage for discrete and long-lasting events in real-time, without additional configuration or coding. This means the raw usage data is always up-to-date and available for reporting, analysis, billing, and whatever other functions require it to run the business. Without the concept of long-lasting meters, there would be a team responsible within the user organization for calculating and reporting on usage, but this would require manual effort and would always be a backwards-facing task, without the ability to ever truly get ahead.

Conclusion

Before diving headfirst into a metering project, it is important to invest the time to really understand the use case – what resources are being tracked and consumed, and what metric is most effective at representing and communicating the usage of each resource? Analyzing usage from this lens will allow you to appreciate the important distinction between an instantaneous or discrete event, and a long-lasting event.

Examples of a discrete event are those that take place and are completed instantly; for example, when an API call is made, a file is sent, a user logs in, and so on. Examples of long-lasting events are perhaps more subtle; bandwidth is consumed at every moment that a connected device is active and connected to a network, so you will actually meter the bandwidth usage rate. Similarly in the cloud database example from above, each time you upload data, you are increasing the usage rate since you are consuming storage in each moment that you have files uploaded to the database.

Hopefully this document provides some background into understanding the importance of metering both instantaneous and long-lasting events, and illustrates how Amberflo’s unique architecture offers a number of advantages based on this capability.

Subscribe to our Newsletter

Delight customers with on-demand metered invoicing and billing.
Oops! Something went wrong while submitting the form.