Exemple #1
0
def metrics_users_long_term():
    logger.debug('Counting long term users')
    threshold_connection = utc_now() - timedelta(days=conf.feed.stop_fetch)
    threshold_connection = utc_now() - timedelta(days=conf.feed.stop_fetch)
    threshold_created = utc_now() - timedelta(days=conf.feed.stop_fetch + 1)
    long_term = UserController().read(is_active=True,
                                      last_connection__ge=threshold_connection,
                                      date_created__lt=threshold_created)
    USER.labels(status='long_term').set(long_term.count())
Exemple #2
0
def metrics_users_active():
    logger.debug('Counting active users')
    threshold_connection = utc_now() - timedelta(days=conf.feed.stop_fetch)
    active = UserController().read(is_active=True,
                                   last_connection__ge=threshold_connection)
    USER.labels(status='active').set(active.count())