(frequency_conf)
Returns a function to compute the next event time for a metric timeseries, based on configuration

    There are two modes of operation:
    1. Fixed frequency intervals; in this case, the config should be a single string that
       can be parsed by parsedatetime (e.g., 1m, 2h, 3 months, etc).
    2. Randomly generated using functions from the python random library; the config should
       be a dict in the format

           {'distribution': <function_name>, 'params': <distribution_parameters>}

       where function_name is a function from random, and distribution_parameters is the
       kwargs for the distribution function.
       To ensure timestamp won't be duplicated, we use 1 second shift as the minimal interval.
Returns a function to compute the next event time for a metric timeseries, based on configuration
Returns a function to compute the next event time for a metric timeseries based on configuration
def get_frequency_function(frequency_conf):
    """ Returns a function to compute the next event time for a metric timeseries, based on configuration

    There are two modes of operation:
    1. Fixed frequency intervals; in this case, the config should be a single string that
       can be parsed by parsedatetime (e.g., 1m, 2h, 3 months, etc).
    2. Randomly generated using functions from the python random library; the config should
       be a dict in the format

           {'distribution': <function_name>, 'params': <distribution_parameters>}

       where function_name is a function from random, and distribution_parameters is the
       kwargs for the distribution function.
       To ensure timestamp won't be duplicated, we use 1 second shift as the minimal interval.
    """
    if isinstance(frequency_conf, str):
        f = parse_time_interval_seconds(frequency_conf)
        return lambda current_time: current_time.shift(seconds=f)
    else:
        gen_func = getattr(random, frequency_conf["distribution"])
        return lambda current_time: current_time.shift(seconds=int(gen_func(**frequency_conf["params"])) + 1)
def get_frequency_function ( frequency_conf ) : if isinstance ( frequency_conf , str ) : f = parse_time_interval_seconds ( frequency_conf ) return lambda current_time : current_time . shift ( seconds = f ) else : gen_func = getattr ( random , frequency_conf [ "distribution" ] ) return lambda current_time : current_time . shift ( seconds = int ( gen_func ( * * frequency_conf [ "params" ] ) ) + 1 )