Energy attribution plugin
The energy-attribution plugin combines measurements related to the energy consumption of some hardware components with measurements related to the use of the hardware by the software.
It computes a value per resource per consumer, using the formula of your choice (configurable).
Requirements
To obtain hardware and software measurements, you need to enable other plugins such as:
raplprocfsamd-gpunvidia-nvml
Metrics
This plugin creates new measurements based on its configuration.
| Name | Type | Unit | Description | Resource | ResourceConsumer | Attributes | More information |
|---|---|---|---|---|---|---|---|
| chosen by the config | Gauge | Joules | attributed energy | depends on the config | depends on the config | same as the input measurements |
Configuration
Here is an example of how to configure this plugin.
Put the following in the configuration file of the Alumet agent (usually alumet-config.toml).
You can configure multiple formulas. Be sure to give each formula a unique name.
For instance, you can have a table formulas.attributed_energy_cpu and a table formulas.attributed_energy_gpu.
CPU example
In this example, we define an attribution formula that produces a new metric attributed_energy_cpu by combining cpu_energy and cpu_usage.
[plugins.energy-attribution.formulas.attributed_energy_cpu]
# the expression used to compute the final value
expr = "cpu_energy * cpu_usage / 100.0"
# the time reference: this is a timeseries, defined by a metric (and other criteria, see below), that will not change during the transformation. Other timeseries can be interpolated in order to have the same timestamps before applying the formula.
ref = "cpu_energy"
# Timeseries related to the resources.
[plugins.energy-attribution.formulas.attributed_energy_cpu.per_resource]
# Defines the timeseries `cpu_energy` that is used in the formula, as the measurement points that have:
# - the metric `rapl_consumed_energy`,
# - and the resource kind `"local_machine"`
# - and the attribute `domain` equal to `package_total`
cpu_energy = { metric = "rapl_consumed_energy", resource_kind = "local_machine", domain = "package_total" }
# Timeseries related to the resource consumers.
[plugins.energy-attribution.formulas.attributed_energy_cpu.per_consumer]
# Defines the timeseries `cpu_usage` that is used in the formula, as the measurements points that have:
# - the metric `cpu_percent`
# - the attribute `kind` equal to `total`
cpu_usage = { metric = "cpu_percent", kind = "total" }
AMD GPU example
In this example, we define an attribution formula that produces a new metric attributed_energy_amd_gpu by combining amd_gpu_energy and amd_gpu_usage.
[plugins.energy-attribution.formulas.attributed_energy_amd_gpu]
# the expression used to compute the final value
expr = "amd_gpu_energy * amd_gpu_usage / 100.0"
# the time reference: this is a timeseries, defined by a metric (and other criteria, see below), that will not change during the transformation. Other timeseries can be interpolated in order to have the same timestamps before applying the formula.
ref = "amd_gpu_energy"
# Timeseries related to the resources.
[plugins.energy-attribution.formulas.attributed_energy_amd_gpu.per_resource]
# Defines the timeseries `amd_gpu_energy` that is used in the formula, as the measurement points that have:
# - the metric `amd_gpu_energy_consumption`
amd_gpu_energy = { metric = "amd_gpu_energy_consumption" }
# Timeseries related to the resource consumers.
[plugins.energy-attribution.formulas.attributed_energy_amd_gpu.per_consumer]
# Defines the timeseries `amd_gpu_usage` that is used in the formula, as the measurements points that have:
# - the metric `amd_gpu_process_compute_unit_occupancy`
amd_gpu_usage = { metric = "amd_gpu_process_compute_unit_occupancy" }
More information
Here is how the interpolation used by this plugin works. Given a reference timeseries and some other timeseries, it synchronizes all the timeseries by interpolating the non-reference points at the timestamps of the reference. The reference is left untouched.
