def operation(self):

        try:
            stat_sum = dict(external_counted_events)
            for segment in GLSetting.anomalies_list:
                for key in external_counted_events.keys():
                    stat_sum[key] += segment[key]

            yield acquire_statistics(stat_sum)

        except Exception as excep:
            log.err("Unable to dump the anomalies in to the stats: %s" % excep)
            sys.excepthook(*sys.exc_info())
Exemple #2
0
def admin_serialize_stats(store, language=GLSetting.memory_copy.default_language):

    stats = store.find(Stats)
    stats.order_by(Desc(Stats.creation_date))

    full_stats = []
    limit  =0
    for stat in stats:

        limit += 1
        if limit >= GLSetting.anomalies_report_limit:
            break

        single_stat = { 'creation_date' : datetime_to_ISO8601(stat.creation_date) }

        for element in external_counted_events.keys():
            single_stat.update({element : stat.content[element] })

        full_stats.append(single_stat)

    return full_stats
Exemple #3
0
def admin_serialize_stats(store,
                          language=GLSetting.memory_copy.default_language):

    stats = store.find(Stats)
    stats.order_by(Desc(Stats.creation_date))

    full_stats = []
    limit = 0
    for stat in stats:

        limit += 1
        if limit >= GLSetting.anomalies_report_limit:
            break

        single_stat = {
            'creation_date': datetime_to_ISO8601(stat.creation_date)
        }

        for element in external_counted_events.keys():
            single_stat.update({element: stat.content[element]})

        full_stats.append(single_stat)

    return full_stats
    def increment_accesses(self, amount):

        for element in external_counted_events.keys():
            GLSetting.anomalies_counter[element] = amount
Exemple #5
0
    def increment_accesses(self, amount):

        for element in external_counted_events.keys():
            GLSetting.anomalies_counter[element] = amount