Increment a set of counters. Args: **counts: keyword arguments specifying count increments. Returns: The [name, value] mapping of all counters stored, i.e. this will also include counts that were not updated by this call to increment.
(self, **counts: Number)
| 61 | self._return_only_prefixed = return_only_prefixed |
| 62 | |
| 63 | def increment(self, **counts: Number) -> Dict[str, Number]: |
| 64 | """Increment a set of counters. |
| 65 | |
| 66 | Args: |
| 67 | **counts: keyword arguments specifying count increments. |
| 68 | |
| 69 | Returns: |
| 70 | The [name, value] mapping of all counters stored, i.e. this will also |
| 71 | include counts that were not updated by this call to increment. |
| 72 | """ |
| 73 | with self._lock: |
| 74 | for key, value in counts.items(): |
| 75 | self._counts.setdefault(key, 0) |
| 76 | self._counts[key] += value |
| 77 | return self.get_counts() |
| 78 | |
| 79 | def get_counts(self) -> Dict[str, Number]: |
| 80 | """Return all counts tracked by this counter.""" |