(self, *labelvalues: Any)
| 203 | return self._metrics[labelvalues] |
| 204 | |
| 205 | def remove(self, *labelvalues: Any) -> None: |
| 206 | if 'prometheus_multiproc_dir' in os.environ or 'PROMETHEUS_MULTIPROC_DIR' in os.environ: |
| 207 | warnings.warn( |
| 208 | "Removal of labels has not been implemented in multi-process mode yet.", |
| 209 | UserWarning) |
| 210 | |
| 211 | if not self._labelnames: |
| 212 | raise ValueError('No label names were set when constructing %s' % self) |
| 213 | |
| 214 | """Remove the given labelset from the metric.""" |
| 215 | if len(labelvalues) != len(self._labelnames): |
| 216 | raise ValueError('Incorrect label count (expected %d, got %s)' % (len(self._labelnames), labelvalues)) |
| 217 | labelvalues = tuple(str(l) for l in labelvalues) |
| 218 | with self._lock: |
| 219 | if labelvalues in self._metrics: |
| 220 | del self._metrics[labelvalues] |
| 221 | |
| 222 | def remove_by_labels(self, labels: dict[str, str]) -> None: |
| 223 | """Remove all series whose labelset partially matches the given labels.""" |
no outgoing calls