Metering

Overview

📖

Definitions

Metrics represent all the data that you capture to analyze trends across your business and technology domains. Raw metrics are unfiltered data. Derived metrics, on the other hand, are generated when a certain combination of selection criteria (or filters) is applied on the raw metrics.

Metering is the act of measuring customer activity or consumption of resources to collect the metrics needed to generate an invoice.

Aggregates are derived metrics. Average, count, distinct, maximum, minimum, and sum are some selection criteria (or filters) applied on raw metrics to derive aggregates.

Your application can be instrumented with specific metering capabilities to extract the metrics needed to generate an invoice. These metrics could be the number of messages sent or received, number of active users, or it could be some aggregate of resource consumption (CPU, memory, storage) that makes sense to your customers.

Map of concepts

Generic nameName in ZenskarComments
Raw metricsUsage EventsUsage events are the specific type of raw metrics we are interested in. For example, per-minute temperature readings from a sensor are also raw metrics. However, they are of no interest to our billing system.
MeteringMetering
Billable metrics orBillable MetricsBillable metrics are the specific type of derived metrics we are interested in. For example, filtering out the highest temperature reading from raw metrics gathered from a sensor are also derived metrics. However, they too are of no interest to our billing system.
AggregatesAggregates- A set of built-in SQL aggregate functions used for deriving billable metrics. - Any other custom SQL query condition that you employ to filter your data.

Zenskar can be configured to connect with your data sources to ingest raw metrics or aggregates. Zenskar can ingest data from various data sources seamlessly. Alternatively, you can send us your usage events using our application programming interfaces (APIs) to generate an invoice, as shown in Fig. 1.

Various data sources that Zenskar can connect to and various ways customers can send raw metrics to Zenskar

Fig. 1: Zenskar ingests data from various data sources and generates invoices


Data ingestion

Read the documentation on the various ways Zenskar can ingest your data.


Data processing

Raw Metrics versus aggregates

You have seen how to configure data sources and data-ingestion APIs. There are two types of data that these sources can send: raw metrics and aggregates. It is important to remember that aggregates are actionable data derived from raw metrics. If the data ingested by Zenskar is raw metrics, further filtering is necessary to derive aggregates, as shown in Fig. 2.

📖

The Structured Query Language

Zenskar stores all the data in the form of RDBMS tables. Therefore, the power of the Structured Query Language (SQL) must be employed to derive and\or retrieve aggregates from the databases. If the source data is raw metrics, SQL queries must be written to derive and retrieve specific aggregates for calculations. However, if the source data is aggregates, SQL queries must only retrieve specific aggregates for calculations.

Fig. 8: Deriving aggregates from raw metrics by applying necessary filters

Fig. 2: Deriving aggregates from raw metrics by applying necessary filters

Deriving Aggregates from Raw Metrics

Zenskar provides you two ways to create SQL queries to derive and\or retrieve aggregates. Once you pick your source, a list of relevant tables are displayed. You can define SQL queries on these tables to derive or retrieve the aggregates needed to generate an invoice. There are two ways to create SQL queries:

  1. Visual query builder
  2. SQL builder