def get_throttled_by_consumed_write_percent(
        table_name, lookback_window_start=15, lookback_period=5):
    """ Returns the number of throttled write events in percent of consumption

    :type table_name: str
    :param table_name: Name of the DynamoDB table
    :type lookback_window_start: int
    :param lookback_window_start: Relative start time for the CloudWatch metric
    :type lookback_period: int
    :param lookback_period: Number of minutes to look at
    :returns: float -- Percent of throttled write events by consumption
    """

    try:
        metrics1 = __get_aws_metric(
            table_name,
            lookback_window_start,
            lookback_period,
            'ConsumedWriteCapacityUnits')
        metrics2 = __get_aws_metric(
            table_name,
            lookback_window_start,
            lookback_period,
            'WriteThrottleEvents')

    except BotoServerError:
        raise

    if metrics1 and metrics2:
        lookback_seconds = lookback_period * 60
        throttled_by_consumed_write_percent = (
            (
                (float(metrics2[0]['Sum']) / float(lookback_seconds)) /
                (float(metrics1[0]['Sum']) / float(lookback_seconds))
            ) * 100)
    else:
        throttled_by_consumed_write_percent = 0

    logger.info(
        '{0} - Throttled write percent by consumption: {1:.2f}%'.format(
            table_name, throttled_by_consumed_write_percent))
    return throttled_by_consumed_write_percent
def get_throttled_by_consumed_write_percent ( table_name , lookback_window_start = 15 , lookback_period = 5 ) : try : metrics1 = __get_aws_metric ( table_name , lookback_window_start , lookback_period , 'ConsumedWriteCapacityUnits' ) metrics2 = __get_aws_metric ( table_name , lookback_window_start , lookback_period , 'WriteThrottleEvents' ) except BotoServerError : raise if metrics1 and metrics2 : lookback_seconds = lookback_period * 60 throttled_by_consumed_write_percent = ( ( ( float ( metrics2 [ 0 ] [ 'Sum' ] ) / float ( lookback_seconds ) ) / ( float ( metrics1 [ 0 ] [ 'Sum' ] ) / float ( lookback_seconds ) ) ) * 100 ) else : throttled_by_consumed_write_percent = 0 logger . info ( '{0} - Throttled write percent by consumption: {1:.2f}%' . format ( table_name , throttled_by_consumed_write_percent ) ) return throttled_by_consumed_write_percent
Returns the number of throttled write events in percent of consumption

    :type table_name: str
    :param table_name: Name of the DynamoDB table
    :type lookback_window_start: int
    :param lookback_window_start: Relative start time for the CloudWatch metric
    :type lookback_period: int
    :param lookback_period: Number of minutes to look at
    :returns: float -- Percent of throttled write events by consumption