Encapsulates derived statistical summaries of a single metric.
The message allows for the reporting of statistical summaries — minimum,
maximum, and average values - as well as the complete list of individual
samples if available.
This message represents derived metrics and contains fields for statistical
summaries—minimum, maximum, and average values. Individual measurements are
are optional, accommodating scenarios where only subsets of this information
are available.
Source code in frequenz/client/microgrid/metrics.py
| @dataclass(frozen=True, kw_only=True)
class AggregatedMetricValue:
"""Encapsulates derived statistical summaries of a single metric.
The message allows for the reporting of statistical summaries — minimum,
maximum, and average values - as well as the complete list of individual
samples if available.
This message represents derived metrics and contains fields for statistical
summaries—minimum, maximum, and average values. Individual measurements are
are optional, accommodating scenarios where only subsets of this information
are available.
"""
avg: float
"""The derived average value of the metric."""
min: float | None
"""The minimum measured value of the metric."""
max: float | None
"""The maximum measured value of the metric."""
raw_values: Sequence[float]
"""All the raw individual values (it might be empty if not provided by the component)."""
def __str__(self) -> str:
"""Return the short string representation of this instance."""
extra: list[str] = []
if self.min is not None:
extra.append(f"min:{self.min}")
if self.max is not None:
extra.append(f"max:{self.max}")
if len(self.raw_values) > 0:
extra.append(f"num_raw:{len(self.raw_values)}")
extra_str = f"<{' '.join(extra)}>" if extra else ""
return f"avg:{self.avg}{extra_str}"
|
Attributes
avg
instance-attribute
The derived average value of the metric.
max
instance-attribute
The maximum measured value of the metric.
min
instance-attribute
The minimum measured value of the metric.
raw_values
instance-attribute
All the raw individual values (it might be empty if not provided by the component).
Functions
__str__
Return the short string representation of this instance.
Source code in frequenz/client/microgrid/metrics.py
| def __str__(self) -> str:
"""Return the short string representation of this instance."""
extra: list[str] = []
if self.min is not None:
extra.append(f"min:{self.min}")
if self.max is not None:
extra.append(f"max:{self.max}")
if len(self.raw_values) > 0:
extra.append(f"num_raw:{len(self.raw_values)}")
extra_str = f"<{' '.join(extra)}>" if extra else ""
return f"avg:{self.avg}{extra_str}"
|