Add a metric to the metric family. Args: labels: A list of label values value: The value of the metric created: Optional unix timestamp the child was created at.
(self,
labels: Sequence[str],
value: float,
created: Optional[float] = None,
timestamp: Optional[Union[Timestamp, float]] = None,
exemplar: Optional[Exemplar] = None,
)
| 127 | self.add_metric([], value, created, exemplar=exemplar) |
| 128 | |
| 129 | def add_metric(self, |
| 130 | labels: Sequence[str], |
| 131 | value: float, |
| 132 | created: Optional[float] = None, |
| 133 | timestamp: Optional[Union[Timestamp, float]] = None, |
| 134 | exemplar: Optional[Exemplar] = None, |
| 135 | ) -> None: |
| 136 | """Add a metric to the metric family. |
| 137 | |
| 138 | Args: |
| 139 | labels: A list of label values |
| 140 | value: The value of the metric |
| 141 | created: Optional unix timestamp the child was created at. |
| 142 | """ |
| 143 | self.samples.append(Sample(self.name + '_total', dict(zip(self._labelnames, labels)), value, timestamp, exemplar)) |
| 144 | if created is not None: |
| 145 | self.samples.append(Sample(self.name + '_created', dict(zip(self._labelnames, labels)), created, timestamp)) |
| 146 | |
| 147 | |
| 148 | class GaugeMetricFamily(Metric): |