Ejemplo n.º 1
0
    def detailed(self, uishortname=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 uishortname:
            data = reportdata.get_schema_usage_for_host(uishortname, 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()]))

        uishortnames = hosts.getHostsWithFeatureAsShortnames('schemaStatsGatherInterval')
        table = tplE.env.get_template('perf_schemas_detailed.html')
        return table.render(schemagraphs=schemagraphs, from_date=from_date, to_date=to_date,
                            uishortname=uishortname, uishortnames=uishortnames, filter=filter)
Ejemplo n.º 2
0
    def get_data(self, uishortname, **params):
        data = {}
        filter = params.get('filter', 'api')
        from_date = params.get('from_date', (datetime.datetime.now() - datetime.timedelta(14)).strftime('%Y-%m-%d'))
        to_date = params.get('to_date', (datetime.datetime.now() + datetime.timedelta(1)).strftime('%Y-%m-%d'))

        if uishortname:
            data = reportdata.get_unused_schemas(uishortname, from_date, to_date, filter)

        uishortnames = hosts.getHostsWithFeatureAsShortnames('schemaStatsGatherInterval')

        return data, from_date, to_date, uishortnames, filter
Ejemplo n.º 3
0
    def get_data(self, uishortname, **params):
        data = []
        from_date = params.get('from_date', datetime.datetime.now().strftime('%Y-%m-%d'))
        to_date = params.get('to_date', (datetime.datetime.now() + datetime.timedelta(1)).strftime('%Y-%m-%d'))

        if 'show' in params:
            if not is_sproc_installed('blocking_last_day_by_shortname'):
                raise Exception('Required additional module is not installed, see - https://github.com/zalando/PGObserver/blob/master/extra_features/blocking_monitor/FEAT_DESC.md')
            if uishortname == 'all':
                uishortname = None
            data = reportdata.getLocksReport(uishortname, from_date, to_date)
        uishortnames = hosts.getHostsWithFeatureAsShortnames('blockingStatsGatherInterval')
        return data, from_date, to_date, uishortnames
Ejemplo n.º 4
0
    def get_data(self, **params):
        data = []
        uishortname = params.get('uishortname', '')
        order_by = params.get('order_by', '1')
        limit = params.get('limit', '50')
        from_date = params.get('from_date', datetime.datetime.now().strftime('%Y-%m-%d'))
        to_date = params.get('to_date', (datetime.datetime.now() + datetime.timedelta(1)).strftime('%Y-%m-%d'))
        no_copy_ddl = params.get('no_copy_ddl', True)
        min_calls = params.get('min_calls', '3')

        if 'show' in params and uishortname:
            data = reportdata.getStatStatements(uishortname, from_date, to_date, order_by, limit, no_copy_ddl, min_calls)
        for d in data:
            d['query_short'] = d['query'][:60].replace('\n',' ').replace('\t',' ') + ('...' if len(d['query']) > 60 else '')

        uishortnames = hosts.getHostsWithFeatureAsShortnames('statStatementsGatherInterval')
        return uishortname, uishortnames, data, from_date, to_date, order_by, limit, no_copy_ddl, min_calls
Ejemplo n.º 5
0
    def detailed(self, uishortname=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 uishortname:
            data = reportdata.get_schema_usage_for_host(
                uishortname, 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()]))

        uishortnames = hosts.getHostsWithFeatureAsShortnames(
            'schemaStatsGatherInterval')
        table = tplE.env.get_template('perf_schemas_detailed.html')
        return table.render(schemagraphs=schemagraphs,
                            from_date=from_date,
                            to_date=to_date,
                            uishortname=uishortname,
                            uishortnames=uishortnames,
                            filter=filter)
Ejemplo n.º 6
0
    def get_data(self, uishortname, **params):
        data = {}
        filter = params.get('filter', 'api')
        from_date = params.get('from_date',
                               (datetime.datetime.now() -
                                datetime.timedelta(14)).strftime('%Y-%m-%d'))
        to_date = params.get('to_date',
                             (datetime.datetime.now() +
                              datetime.timedelta(1)).strftime('%Y-%m-%d'))

        if uishortname:
            data = reportdata.get_unused_schemas(uishortname, from_date,
                                                 to_date, filter)

        uishortnames = hosts.getHostsWithFeatureAsShortnames(
            'schemaStatsGatherInterval')

        return data, from_date, to_date, uishortnames, filter
Ejemplo n.º 7
0
    def get_data(self, uishortname, **params):
        data = []
        from_date = params.get('from_date',
                               datetime.datetime.now().strftime('%Y-%m-%d'))
        to_date = params.get('to_date',
                             (datetime.datetime.now() +
                              datetime.timedelta(1)).strftime('%Y-%m-%d'))

        if 'show' in params:
            if not is_sproc_installed('blocking_last_day_by_shortname'):
                raise Exception(
                    'Required additional module is not installed, see - https://github.com/zalando/PGObserver/blob/master/extra_features/blocking_monitor/FEAT_DESC.md'
                )
            if uishortname == 'all':
                uishortname = None
            data = reportdata.getLocksReport(uishortname, from_date, to_date)
        uishortnames = hosts.getHostsWithFeatureAsShortnames(
            'blockingStatsGatherInterval')
        return data, from_date, to_date, uishortnames
Ejemplo n.º 8
0
    def get_data(self, **params):
        data = []
        uishortname = params.get('uishortname', '')
        order_by = params.get('order_by', '1')
        limit = params.get('limit', '50')
        from_date = params.get('from_date',
                               datetime.datetime.now().strftime('%Y-%m-%d'))
        to_date = params.get('to_date',
                             (datetime.datetime.now() +
                              datetime.timedelta(1)).strftime('%Y-%m-%d'))
        no_copy_ddl = params.get('no_copy_ddl', True)
        min_calls = params.get('min_calls', '3')

        if 'show' in params and uishortname:
            data = reportdata.getStatStatements(uishortname, from_date,
                                                to_date, order_by, limit,
                                                no_copy_ddl, min_calls)
        for d in data:
            d['query_short'] = d['query'][:60].replace('\n', ' ').replace(
                '\t', ' ') + ('...' if len(d['query']) > 60 else '')

        uishortnames = hosts.getHostsWithFeatureAsShortnames(
            'statStatementsGatherInterval')
        return uishortname, uishortnames, data, from_date, to_date, order_by, limit, no_copy_ddl, min_calls