mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-11-17 23:50:11 -05:00
Create the concept of a cachecounter metric; generating two counters specific to caches
This commit is contained in:
parent
7d72e44eb9
commit
ce8b5769f7
3 changed files with 73 additions and 8 deletions
|
|
@ -13,7 +13,7 @@
|
|||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
from .metric import CounterMetric
|
||||
from .metric import CounterMetric, CacheCounterMetric
|
||||
|
||||
|
||||
# We'll keep all the available metrics in a single toplevel dict, one shared
|
||||
|
|
@ -43,6 +43,15 @@ class Metrics(object):
|
|||
|
||||
return metric
|
||||
|
||||
def register_cachecounter(self, name, *args, **kwargs):
|
||||
full_name = "%s.%s" % (self.name_prefix, name)
|
||||
|
||||
metric = CacheCounterMetric(full_name, *args, **kwargs)
|
||||
|
||||
self._register(metric)
|
||||
|
||||
return metric
|
||||
|
||||
def counted(self, func):
|
||||
""" A method decorator that registers a counter, to count invocations
|
||||
of this method. """
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue