Product SiteDocumentation Site

2.3. Domains, Metrics, Instances and Labels

This section defines metrics and instances, discusses how they should be designed for a particular target domain, and shows how to implement support for them.
The examples in this section are drawn from the trivial and simple PMDAs. Refer to the ${PCP_PMDAS_DIR}/trivial and ${PCP_PMDAS_DIR}/simple directories, respectively, where both binaries and source code are available.

2.3.1. Overview

Domains are autonomous performance areas, such as the operating system or a layered service or a particular application. Metrics are raw performance data for a domain, and typically quantify activity levels, resource utilization or quality of service. Instances are sets of related metrics, as for multiple processors, or multiple service classes, or multiple transaction types.
PCP employs the following simple and uniform data model to accommodate the demands of performance metrics drawn from multiple domains:
  • Each metric has an identifier that is unique across all metrics for all PMDAs on a particular host.
  • Externally, metrics are assigned names for user convenience--typically there is a 1:1 relationship between a metric name and a metric identifier.
  • The PMDA implementation determines if a particular metric has a singular value or a set of (zero or more) values. For instance, the metric hinv.ndisk counts the number of disks and has only one value on a host, whereas the metric disk.dev.total counts disk I/O operations and has one value for each disk on the host.
  • If a metric has a set of values, then members of the set are differentiated by instances. The set of instances associated with a metric is an instance domain. For example, the set of metrics disk.dev.total is defined over an instance domain that has one member per disk spindle.
The selection of metrics and instances is an important design decision for a PMDA implementer. The metrics and instances for a target domain should have the following qualities:
  • Obvious to a user
  • Consistent across the domain
  • Accurately representative of the operational and functional aspects of the domain
For each metric, you should also consider these questions:
  • How useful is this value?
  • What units give a good sense of scale?
  • What name gives a good description of the metric's meaning?
  • Can this metric be combined with another to convey the same useful information?
As with all programming tasks, expect to refine the choice of metrics and instances several times during the development of the PMDA.