示例#1
0
 def __call__(self, path_info):
     splits = path_info.split('/')
     if len(splits) > 1 and splits[1]:
         if splits[1].isdigit(
         ) or splits[1] in hosts.getAllHostUinamesSorted():
             return Dispatcher.__call__(self, '/host' + path_info)
     return Dispatcher.__call__(self, path_info.lower())
示例#2
0
    def get_data(self, **params):
        data = []
        interval = {}
        if 'show' in params:
            uishortname = params.get('uishortname')
            if uishortname == 'all':
                uishortname = None
            data = reportdata.getApiPerformanceIssues(uishortname,
                                                      params['from'],
                                                      params['to'])

        if 'from' in params and 'to' in params:
            interval['from'] = params['from']
            interval['to'] = params['to']
            interval['uishortname'] = params['uishortname']
        else:
            curdate = datetime.datetime.now()
            interval['from'] = 'r{}_00_{:02}'.format(
                curdate.strftime('%y'),
                (datetime.datetime.now() -
                 datetime.timedelta(weeks=2)).isocalendar()[1])
            interval['to'] = 'r{}_00_{:02}'.format(
                curdate.strftime('%y'),
                (datetime.datetime.now() -
                 datetime.timedelta(weeks=1)).isocalendar()[1])
            interval['uishortname'] = 'all'
        uishortnames = hosts.getAllHostUinamesSorted()
        return data, interval, uishortnames
示例#3
0
    def get_data(self, **params):
        data = []
        interval = {}
        if 'show' in params:
            data = reportdata.getIndexIssues(params.get('uishortname'))

        if 'uishortname' in params:
            interval['uishortname'] = params['uishortname']
        else:
            interval['uishortname'] = 'all'

        uishortnames = hosts.getAllHostUinamesSorted()
        return data, interval, uishortnames
示例#4
0
    def get_data(self, **params):
        data = []
        interval = {}
        if 'show' in params:
            data = reportdata.getIndexIssues(params.get('uishortname'))

        if 'uishortname' in params:
            interval['uishortname'] = params['uishortname']
        else:
            interval['uishortname'] = 'all'

        uishortnames = hosts.getAllHostUinamesSorted()
        return data, interval, uishortnames
示例#5
0
    def get_data(self, uishortname=None, **params):
        uishortnames = hosts.getAllHostUinamesSorted()
        bloat_type = params.get('bloat_type', 'table')
        order_by = params.get('order_by', 'wasted_bytes')
        limit = params.get('limit', '50')
        data = []
        if uishortname:
            if bloat_type == 'table':
                msg, data = reportdata.getBloatedTablesForHostname(uishortname, order_by, limit)
            else:
                msg, data = reportdata.getBloatedIndexesForHostname(uishortname, order_by, limit)
            if msg:
                raise Exception('Failed to get data: ' + msg)

        return data, uishortnames, bloat_type, order_by, limit
示例#6
0
    def get_data(self, uishortname=None, **params):
        uishortnames = hosts.getAllHostUinamesSorted()
        bloat_type = params.get('bloat_type', 'table')
        order_by = params.get('order_by', 'wasted_bytes')
        limit = params.get('limit', '50')
        data = []
        if uishortname:
            if bloat_type == 'table':
                msg, data = reportdata.getBloatedTablesForHostname(
                    uishortname, order_by, limit)
            else:
                msg, data = reportdata.getBloatedIndexesForHostname(
                    uishortname, order_by, limit)
            if msg:
                raise Exception('Failed to get data: ' + msg)

        return data, uishortnames, bloat_type, order_by, limit
示例#7
0
    def get_data(self, **params):
        data = []
        if 'show' in params:
            uishortname = params.get('uishortname')
            if uishortname == 'all':
                uishortname = None
            data = reportdata.getTablePerformanceIssues(uishortname, params['from'], params['to'])

        interval = {}
        if 'from' in params and 'to' in params:
            interval['from'] = params['from']
            interval['to'] = params['to']
            interval['uishortname'] = params['uishortname']
        else:
            interval['from'] = (datetime.datetime.now() - datetime.timedelta(days=3)).strftime('%Y-%m-%d')
            interval['to'] = (datetime.datetime.now()).strftime('%Y-%m-%d')
            interval['uishortname'] = 'all'

        return data, interval, hosts.getAllHostUinamesSorted()
示例#8
0
    def get_data(self, **params):
        data = []
        interval = {}
        if 'show' in params:
            uishortname = params.get('uishortname')
            if uishortname == 'all':
                uishortname = None
            data = reportdata.getApiPerformanceIssues(uishortname, params['from'], params['to'])

        if 'from' in params and 'to' in params:
            interval['from'] = params['from']
            interval['to'] = params['to']
            interval['uishortname'] = params['uishortname']
        else:
            curdate = datetime.datetime.now()
            interval['from'] = 'r{}_00_{:02}'.format(curdate.strftime('%y'), (datetime.datetime.now()-datetime.timedelta(weeks=2)).isocalendar()[1])
            interval['to'] = 'r{}_00_{:02}'.format(curdate.strftime('%y'), (datetime.datetime.now()-datetime.timedelta(weeks=1)).isocalendar()[1])
            interval['uishortname'] = 'all'
        uishortnames = hosts.getAllHostUinamesSorted()
        return data, interval, uishortnames
示例#9
0
    def get_data(self, **params):
        data = []
        if 'show' in params:
            uishortname = params.get('uishortname')
            if uishortname == 'all':
                uishortname = None
            data = reportdata.getTablePerformanceIssues(
                uishortname, params['from'], params['to'])

        interval = {}
        if 'from' in params and 'to' in params:
            interval['from'] = params['from']
            interval['to'] = params['to']
            interval['uishortname'] = params['uishortname']
        else:
            interval['from'] = (
                datetime.datetime.now() -
                datetime.timedelta(days=3)).strftime('%Y-%m-%d')
            interval['to'] = (datetime.datetime.now()).strftime('%Y-%m-%d')
            interval['uishortname'] = 'all'

        return data, interval, hosts.getAllHostUinamesSorted()
示例#10
0
文件: web.py 项目: grofers/PGObserver
 def __call__(self, path_info):
     splits = path_info.split('/')
     if len(splits) > 1 and splits[1]:
         if splits[1].isdigit() or splits[1] in hosts.getAllHostUinamesSorted():
             return Dispatcher.__call__(self, '/host' + path_info)
     return Dispatcher.__call__(self, path_info.lower())