コード例 #1
0
ファイル: performance.py プロジェクト: etel/PGObserver
    def detailed(self, selected_hostname=None, **params):
        schemagraphs = []
        from_date = params.get('from_date', (datetime.datetime.now() - datetime.timedelta(7)).strftime('%Y-%m-%d'))
        to_date = params.get('to_date', (datetime.datetime.now() + datetime.timedelta(1)).strftime('%Y-%m-%d'))
        filter = params.get('filter', '')

        if selected_hostname:
            if selected_hostname not in hosts.getAllHostNames():
                selected_hostname = hosts.uiShortNameToHostName(selected_hostname)
            data = reportdata.get_schema_usage_for_host(selected_hostname, from_date, to_date, filter)
            for schema_name, data in data.iteritems():
                g_calls = flotgraph.Graph (schema_name + "_calls")
                g_calls.addSeries('Sproc calls', 'calls')
                g_iud = flotgraph.Graph (schema_name + "_iud")
                g_iud.addSeries('IUD', 'iud')
                g_scans = flotgraph.Graph (schema_name + "_scans")
                g_scans.addSeries('Seq+Ind Scans', 'scans')
                for p in data:
                    g_calls.addPoint('calls', int(time.mktime(p[0].timetuple()) * 1000) , p[1][0])
                    g_iud.addPoint('iud', int(time.mktime(p[0].timetuple()) * 1000) , p[1][2]+p[1][3]+p[1][4])
                    g_scans.addPoint('scans', int(time.mktime(p[0].timetuple()) * 1000) , p[1][1])
                schemagraphs.append((schema_name, [g_calls.render(), g_iud.render(), g_scans.render()]))

        table = tplE.env.get_template('perf_schemas_detailed.html')
        return table.render(schemagraphs=schemagraphs, from_date=from_date, to_date=to_date, selected_hostname=selected_hostname, host_names=hosts.getAllHostNames(), filter=filter)
コード例 #2
0
    def detailed(self, selected_hostname=None, **params):
        schemagraphs = []
        from_date = params.get('from_date', (datetime.datetime.now() - datetime.timedelta(7)).strftime('%Y-%m-%d'))
        to_date = params.get('to_date', (datetime.datetime.now() + datetime.timedelta(1)).strftime('%Y-%m-%d'))
        filter = params.get('filter', '')

        if selected_hostname:
            if selected_hostname not in hosts.getAllHostNames():
                selected_hostname = hosts.uiShortNameToHostName(selected_hostname)
            data = reportdata.get_schema_usage_for_host(selected_hostname, from_date, to_date, filter)
            for schema_name, data in data.iteritems():
                g_calls = flotgraph.Graph (schema_name + "_calls")
                g_calls.addSeries('Sproc calls', 'calls')
                g_iud = flotgraph.Graph (schema_name + "_iud")
                g_iud.addSeries('IUD', 'iud')
                g_scans = flotgraph.Graph (schema_name + "_scans")
                g_scans.addSeries('Seq+Ind Scans', 'scans')
                for p in data:
                    g_calls.addPoint('calls', int(time.mktime(p[0].timetuple()) * 1000) , p[1][0])
                    g_iud.addPoint('iud', int(time.mktime(p[0].timetuple()) * 1000) , p[1][2]+p[1][3]+p[1][4])
                    g_scans.addPoint('scans', int(time.mktime(p[0].timetuple()) * 1000) , p[1][1])
                schemagraphs.append((schema_name, [g_calls.render(), g_iud.render(), g_scans.render()]))

        table = tplE.env.get_template('perf_schemas_detailed.html')
        return table.render(schemagraphs=schemagraphs, from_date=from_date, to_date=to_date, selected_hostname=selected_hostname, host_names=hosts.getAllHostNames(), filter=filter)
コード例 #3
0
ファイル: performance.py プロジェクト: etel/PGObserver
    def get_data(self, selected_hostname=None, **params):
        hostnames = hosts.getAllHostNames()
        bloat_type = params.get('bloat_type', 'table')
        order_by = params.get('order_by', 'wasted_bytes')
        limit = params.get('limit', '50')
        data = []
        hostuiname = None
        if selected_hostname:
            if bloat_type == 'table':
                msg, data = reportdata.getBloatedTablesForHostname(selected_hostname, order_by, limit)
            else:
                msg, data = reportdata.getBloatedIndexesForHostname(selected_hostname, order_by, limit)
            if msg:
                raise Exception('Failed to get data: ' + msg)
            hostuiname = hosts.getHostUIShortnameByHostname(selected_hostname)

        return data, hostnames, bloat_type, order_by, limit, hostuiname
コード例 #4
0
    def get_data(self, selected_hostname=None, **params):
        hostnames = hosts.getAllHostNames()
        bloat_type = params.get('bloat_type', 'table')
        order_by = params.get('order_by', 'wasted_bytes')
        limit = params.get('limit', '50')
        data = []
        hostuiname = None
        if selected_hostname:
            if bloat_type == 'table':
                msg, data = reportdata.getBloatedTablesForHostname(selected_hostname, order_by, limit)
            else:
                msg, data = reportdata.getBloatedIndexesForHostname(selected_hostname, order_by, limit)
            if msg:
                raise Exception('Failed to get data: ' + msg)
            hostuiname = hosts.getHostUIShortnameByHostname(selected_hostname)

        return data, hostnames, bloat_type, order_by, limit, hostuiname