Increment counter by the given amount.
(self, amount: float = 1, exemplar: Optional[Dict[str, str]] = None)
| 333 | self._created = time.time() |
| 334 | |
| 335 | def inc(self, amount: float = 1, exemplar: Optional[Dict[str, str]] = None) -> None: |
| 336 | """Increment counter by the given amount.""" |
| 337 | self._raise_if_not_observable() |
| 338 | if amount < 0: |
| 339 | raise ValueError('Counters can only be incremented by non-negative amounts.') |
| 340 | self._value.inc(amount) |
| 341 | if exemplar: |
| 342 | _validate_exemplar(exemplar) |
| 343 | self._value.set_exemplar(Exemplar(exemplar, amount, time.time())) |
| 344 | |
| 345 | def reset(self) -> None: |
| 346 | """Reset the counter to zero. Use this when a logical process restarts without restarting the actual python process.""" |