コード例 #1
0
def run(arguments):
    try:
        config = parse_config_file(arguments['<config_file>'])
        redis = get_redis(config)
        metrics_cache = RedisMetricsCache(redis)
        sdk_api = api_factory(config)
        report_metrics(metrics_cache, sdk_api)
    except:
        logger.exception('Exception caught posting metrics')
コード例 #2
0
def run(arguments):
    try:
        config = parse_config_file(arguments['<config_file>'])
        redis = get_redis(config)
        impressions_cache = RedisImpressionsCache(redis)
        sdk_api = api_factory(config)
        report_impressions(impressions_cache, sdk_api)
    except:
        logger.exception('Exception caught posting impressions')
コード例 #3
0
def run(arguments):
    try:
        config = parse_config_file(arguments['<config_file>'])
        redis = get_redis(config)
        segment_cache = RedisSegmentCache(redis)
        sdk_api = api_factory(config)
        segment_change_fetcher = ApiSegmentChangeFetcher(sdk_api)
        update_segments(segment_cache, segment_change_fetcher)
    except:
        logger.exception('Exception caught updating segments')
コード例 #4
0
def _report_metrics(seconds, config):
    try:
        while True:
            redis = get_redis(config)
            metrics_cache = RedisMetricsCache(redis)
            sdk_api = api_factory(config)
            report_metrics(metrics_cache, sdk_api)

            time.sleep(seconds)
    except:
        logger.exception('Exception caught posting metrics')
コード例 #5
0
def _report_impressions(seconds, config):
    try:
        while True:
            redis = get_redis(config)
            impressions_cache = RedisImpressionsCache(redis)
            sdk_api = api_factory(config)
            report_impressions(impressions_cache, sdk_api)

            time.sleep(seconds)
    except:
        logger.exception('Exception caught posting impressions')
コード例 #6
0
ファイル: uwsgi.py プロジェクト: engstrom/python-client
def uwsgi_report_metrics(user_config):
    try:
        config = _get_config(user_config)
        seconds = config['metricsRefreshRate']
        while True:
            metrics_cache = UWSGIMetricsCache(get_uwsgi())
            sdk_api = api_factory(config)
            report_metrics(metrics_cache, sdk_api)

            time.sleep(seconds)
    except:
        _logger.exception('Exception caught posting metrics')
コード例 #7
0
ファイル: uwsgi.py プロジェクト: engstrom/python-client
def uwsgi_report_impressions(user_config):
    try:
        config = _get_config(user_config)
        seconds = config['impressionsRefreshRate']
        while True:
            impressions_cache = UWSGIImpressionsCache(get_uwsgi())
            sdk_api = api_factory(config)
            report_impressions(impressions_cache, sdk_api)

            time.sleep(seconds)
    except:
        _logger.exception('Exception caught posting impressions')
コード例 #8
0
def _update_segments(seconds, config):
    try:
        while True:
            redis = get_redis(config)
            segment_cache = RedisSegmentCache(redis)
            sdk_api = api_factory(config)
            segment_change_fetcher = ApiSegmentChangeFetcher(sdk_api)
            update_segments(segment_cache, segment_change_fetcher)

            time.sleep(seconds)
    except:
        logger.exception('Exception caught updating segments')
コード例 #9
0
ファイル: uwsgi.py プロジェクト: engstrom/python-client
def uwsgi_update_segments(user_config):
    try:
        config = _get_config(user_config)
        seconds = config['segmentsRefreshRate']
        while True:
            segment_cache = UWSGISegmentCache(get_uwsgi())
            sdk_api = api_factory(config)
            segment_change_fetcher = ApiSegmentChangeFetcher(sdk_api)
            update_segments(segment_cache, segment_change_fetcher)

            time.sleep(seconds)
    except:
        _logger.exception('Exception caught updating segments')
コード例 #10
0
ファイル: uwsgi.py プロジェクト: jeis2497052/python-client
def uwsgi_report_events(user_config):
    try:
        config = _get_config(user_config)
        seconds = config.get('eventsRefreshRate', 30)
        events_cache = UWSGIEventsCache(get_uwsgi())
        sdk_api = api_factory(config)
        task = EventsSyncTask(sdk_api, events_cache, seconds, 500)
        while True:
            task._send_events()
            for _ in xrange(0, seconds):
                if uwsgi.cache_get(UWSGIEventsCache._EVENTS_FLUSH,
                                   _SPLITIO_STATS_CACHE_NAMESPACE):
                    uwsgi.cache_del(UWSGIEventsCache._EVENTS_FLUSH,
                                    _SPLITIO_STATS_CACHE_NAMESPACE)
                    break
                time.sleep(1)
    except:
        _logger.exception('Exception caught posting metrics')
コード例 #11
0
ファイル: uwsgi.py プロジェクト: engstrom/python-client
def uwsgi_update_splits(user_config):
    try:
        config = _get_config(user_config)
        seconds = config['featuresRefreshRate']
        while True:
            split_cache = UWSGISplitCache(get_uwsgi())

            sdk_api = api_factory(config)
            split_change_fetcher = ApiSplitChangeFetcher(sdk_api)

            segment_cache = UWSGISegmentCache(get_uwsgi())
            split_parser = UWSGISplitParser(segment_cache)

            added, removed = update_splits(split_cache, split_change_fetcher,
                                           split_parser)
            split_cache.update_split_list(added, removed)

            time.sleep(seconds)
    except:
        _logger.exception('Exception caught updating splits')