MCPcopy Index your code
hub / github.com/prometheus/client_python / remove

Method remove

prometheus_client/metrics.py:205–220  ·  view source on GitHub ↗
(self, *labelvalues: Any)

Source from the content-addressed store, hash-verified

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."""

Callers 6

mark_process_deadFunction · 0.45
write_to_textfileFunction · 0.45
tearDownMethod · 0.45
test_removeMethod · 0.45

Calls

no outgoing calls

Tested by 4

tearDownMethod · 0.36
test_removeMethod · 0.36