Exemplo n.º 1
0
    def get_location_client_server_metrics(self, location_id, client_id,
                                           server_id, timebin, starttime,
                                           endtime):
        '''
        Get data for specific location + client + server at a specific
        frequency between start and stop times for a
        specific client ISP.

        location_id = id string of location.
        client_id = id of client.
        server_id = id of server.
        timebin = time aggregation key.
        starttime = start time for metric query.
        endtime = end time for metric query.
        '''
        # Create Row Key
        agg_name = "{0}_{1}_{2}".format(TABLE_KEYS["servers"],
                                        TABLE_KEYS["clients"],
                                        TABLE_KEYS["locations"])

        table_config = get_table_config(self.table_configs, timebin, agg_name)

        key_fields = du.get_key_fields([location_id, client_id, server_id],
                                       table_config)
        formatted = bt.get_time_metric_results(
            key_fields, self.get_pool(), timebin, starttime, endtime,
            table_config, "locations_clients_servers")

        # set the ID to be the Client ISP ID
        if formatted['meta']:
            formatted["meta"]["id"] = "_".join([location_id, client_id,
                                                server_id])

        return formatted
Exemplo n.º 2
0
    def get_location_metrics(self, location_id, timebin, starttime, endtime):
        '''
        Get data for specific location at a specific
        frequency between start and stop times.

        location_id = id string of location.
        timebin = time aggregation key.
        starttime = start time for metric query.
        endtime = end time for metric query.
        '''

        table_config = get_table_config(self.table_configs, timebin,
                                        TABLE_KEYS["locations"])

        location_key_fields = du.get_location_key_fields(location_id,
                                                         table_config)
        formatted = bt.get_time_metric_results(
            location_key_fields, self.get_pool(), timebin, starttime, endtime,
            table_config, "locations")

        # set the ID to be the location ID
        if formatted['meta']:
            formatted["meta"]["id"] = location_id

        return formatted
Exemplo n.º 3
0
    def get_location_server_metrics(self, location_id, server_id,
                                    timebin, starttime, endtime):
        '''
        Get data for specific location + server at a specific
        frequency between start and stop times for a
        specific client ISP.

        location_id = id string of location.
        server_id = id of server.
        timebin = time aggregation key.
        starttime = start time for metric query.
        endtime = end time for metric query.
        '''
        # Create Row Key
        agg_name = TABLE_KEYS["servers"] + '_' + TABLE_KEYS["locations"]

        table_config = get_table_config(self.table_configs, timebin, agg_name)

        # TODO: the direction of the keys don't match the table name
        key_fields = du.get_key_fields([location_id, server_id], table_config)
        formatted = bt.get_time_metric_results(
            key_fields, self.get_pool(), timebin, starttime, endtime,
            table_config, "locations_servers")

        # set the ID to be the Client ISP ID
        if formatted['meta']:
            formatted["meta"]["id"] = "_".join([location_id, server_id])

        return formatted
Exemplo n.º 4
0
    def get_client_metrics(self, client_id, timebin, starttime, endtime):
        '''
        Get data for client location at a specific
        timebin between start and stop times.

        client_id = id string of client.
        timebin = time aggregation key.
        starttime = start time for metric query.
        endtime = end time for metric query.
        '''

        table_config = get_table_config(self.table_configs, timebin, TABLE_KEYS["clients"])

        key_fields = du.get_key_fields([client_id], table_config)
        formatted = bt.get_time_metric_results(key_fields, self.get_pool(), timebin, starttime, endtime, table_config, "clients")

        return formatted
Exemplo n.º 5
0
    def get_server_metrics(self, server_id, timebin, starttime, endtime):
        '''
        Get data for specific location at a specific
        frequency between start and stop times.

        server_id = id of server.
        timebin = time aggregation key.
        starttime = start time for metric query.
        endtime = end time for metric query.
        '''

        table_config = get_table_config(self.table_configs, timebin,
                                        TABLE_KEYS["servers"])

        location_key_fields = du.get_key_fields([server_id], table_config)
        formatted = bt.get_time_metric_results(
            location_key_fields, self.get_pool(), timebin, starttime, endtime,
            table_config, "servers")

        return formatted
Exemplo n.º 6
0
    def get_client_server_metrics(self, client_id, server_id, timebin, starttime, endtime):
        '''
        Get data for a specific client + server at a
        timebin between start and stop times.

        client_id = id string of client.
        server_id = id of server.
        timebin = time aggregation key.
        starttime = start time for metric query.
        endtime = end time for metric query.
        '''

        agg_name = TABLE_KEYS["servers"] + '_' + TABLE_KEYS["clients"]

        table_config = get_table_config(self.table_configs, timebin, agg_name)

        key_fields = du.get_key_fields([server_id, client_id], table_config)
        formatted = bt.get_time_metric_results(key_fields, self.get_pool(), timebin, starttime, endtime, table_config, "clients")

        return formatted
Exemplo n.º 7
0
    def get_client_metrics(self, client_id, timebin, starttime, endtime):
        '''
        Get data for client location at a specific
        timebin between start and stop times.

        client_id = id string of client.
        timebin = time aggregation key.
        starttime = start time for metric query.
        endtime = end time for metric query.
        '''

        table_config = get_table_config(self.table_configs, timebin,
                                        TABLE_KEYS["clients"])

        key_fields = du.get_key_fields([client_id], table_config)
        formatted = bt.get_time_metric_results(
            key_fields, self.get_pool(), timebin, starttime, endtime,
            table_config, "clients")

        return formatted
Exemplo n.º 8
0
    def get_server_metrics(self, server_id, timebin, starttime, endtime):
        '''
        Get data for specific location at a specific
        frequency between start and stop times.

        server_id = id of server.
        timebin = time aggregation key.
        starttime = start time for metric query.
        endtime = end time for metric query.
        '''

        table_config = get_table_config(self.table_configs, timebin,
                                        TABLE_KEYS["servers"])

        location_key_fields = du.get_key_fields([server_id], table_config)
        formatted = bt.get_time_metric_results(location_key_fields,
                                               self.get_pool(), timebin,
                                               starttime, endtime,
                                               table_config, "servers")

        return formatted
Exemplo n.º 9
0
    def get_client_server_metrics(self, client_id, server_id, timebin,
                                  starttime, endtime):
        '''
        Get data for a specific client + server at a
        timebin between start and stop times.

        client_id = id string of client.
        server_id = id of server.
        timebin = time aggregation key.
        starttime = start time for metric query.
        endtime = end time for metric query.
        '''

        agg_name = TABLE_KEYS["servers"] + '_' + TABLE_KEYS["clients"]

        table_config = get_table_config(self.table_configs, timebin, agg_name)

        key_fields = du.get_key_fields([server_id, client_id], table_config)
        formatted = bt.get_time_metric_results(
            key_fields, self.get_pool(), timebin, starttime, endtime,
            table_config, "clients")

        return formatted