Data is modeled by Loupe using three classes:
There are two ways to record metrics:
Each metric definition has a three element key:
Metric definition keys need to be unique between both Sampled and Event metrics. Because event metrics can be used as sampled metrics it's useful to lay out categories and counters so they make sense to your users together, however a single definition can't be used for both.
The main purpose of the Metric Definition object is to make it possible to share the metadata that describes a metric between multiple instances of the metric. For example, in Windows Performance Counters there are a set of metrics that are defined for every network interface. With this model, all of the metadata is ensured to be consistent between the metric instances.
Each Metric is a single instance of a metric definition which has a unique string name. For each definition there can be one metric with a null name, called the Default Instance. When no name is specified, the default instance is used. Use multiple instances of a metric instead of separate Metric Definitions when you want to distinguish a runtime separation (such as between databases or network interfaces or files) but share a common data structure.
Every value recorded for a specific Metric is recorded as a Metric Sample. Each sample always has a timestamp recorded with full time zone awareness and a sequence number that's unique within the session. This ensures that samples can be consistently and uniquely ordered in time based on when they were written to the Loupe Agent. The data structure that can be recorded with each sample varies depending on whether the metric is a Sampled Metric or Event Metric.