]> git.proxmox.com Git - ceph.git/blob - ceph/src/pybind/mgr/restful/api/perf.py
update ceph source to reef 18.2.1
[ceph.git] / ceph / src / pybind / mgr / restful / api / perf.py
1 from pecan import expose, request, response
2 from pecan.rest import RestController
3
4 from restful import context
5 from restful.decorators import auth, lock, paginate
6
7 import re
8
9 class Perf(RestController):
10 @expose(template='json')
11 @paginate
12 @auth
13 def get(self, **kwargs):
14 """
15 List all the available performance counters
16
17 Options:
18 - 'daemon' -- filter by daemon, accepts Python regexp
19 """
20
21 counters = context.instance.get_unlabeled_perf_counters()
22
23 if 'daemon' in kwargs:
24 _re = re.compile(kwargs['daemon'])
25 counters = {k: v for k, v in counters.items() if _re.match(k)}
26
27 return counters