Module Import alias ImportFrom alias Import alias Import alias identifier Import alias ImportFrom alias Import alias Import alias Assign NameStore Call NameLoad Str Assign NameStore Call NameLoad Str TupleLoad Str Str Assign NameStore Num Assign NameStore Num Assign NameStore BinOpMult NameLoad Num Assign NameStore BinOpMult NameLoad Num Assign NameStore BinOpMult NameLoad Num Assign NameStore Dict Str Str Str Str Str Str Str Str Str Str Str Str NameLoad NameLoad BinOpMult NameLoad Num BinOpMult NameLoad Num BinOpMult NameLoad Num BinOpMult NameLoad Num NameLoad BinOpMult NameLoad Num BinOpMult NameLoad Num BinOpMult NameLoad Num NameLoad NameLoad ClassDef bases NameLoad body FunctionDef arguments args NameParam NameParam NameParam defaults body Expr Str Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults NameLoad body Expr Str Assign NameStore ListLoad Assign NameStore Dict If CompareIs NameLoad NameLoad body Assign NameStore Str Assign NameStore SubscriptLoad NameLoad Index NameLoad If UnaryOpNot NameLoad body Return ListLoad For NameStore NameLoad body Assign NameStore Call NameLoad SubscriptLoad NameLoad Index Num Assign NameStore Call NameLoad SubscriptLoad Call AttributeLoad SubscriptLoad NameLoad Index Num attr Str Index Num Assign NameStore BinOpDiv NameLoad NameLoad Assign SubscriptStore NameLoad Index NameLoad BinOpAdd Call AttributeLoad NameLoad attr NameLoad Num NameLoad Assign NameStore Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr For NameStore Call NameLoad SubscriptLoad NameLoad Index Num SubscriptLoad NameLoad Index Num body If CompareNotIn NameLoad NameLoad body Assign SubscriptStore NameLoad Index NameLoad Num Assign NameStore Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr For NameStore NameLoad body Expr Call AttributeLoad NameLoad attr Call NameLoad BinOpMult NameLoad NameLoad SubscriptLoad NameLoad Index NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults NameLoad body Expr Str Return Call AttributeLoad NameLoad attr Call AttributeLoad AttributeLoad NameLoad attr attr BinOpMod Str AttributeLoad NameLoad attr Num Num keyword NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam defaults NameLoad body Expr Str Return Call AttributeLoad NameLoad attr Call AttributeLoad AttributeLoad NameLoad attr attr BinOpMod Str AttributeLoad NameLoad attr NameLoad NameLoad keyword NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Return BinOpMod Str TupleLoad NameLoad NameLoad decorator_list NameLoad FunctionDef arguments args NameParam NameParam NameParam defaults NameLoad body Expr Str Assign NameStore BinOpMod Str TupleLoad AttributeLoad NameLoad attr Assign NameStore BinOpMod Str TupleLoad AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Assign NameStore ListLoad Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Assign NameStore ListComp NameLoad comprehension NameStore NameLoad CompareLt Call NameLoad NameLoad NameLoad For NameStore NameLoad body If CompareEq NameLoad NameLoad body Continue Assign NameStore SubscriptLoad NameLoad Index NameLoad If NameLoad body Assign NameStore Call AttributeLoad NameLoad attr NameLoad NameLoad If NameLoad body AugAssignAdd NameStore AttributeLoad SubscriptLoad NameLoad Index Num attr Expr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Call AttributeLoad NameLoad attr NameLoad NameLoad NameLoad Expr Call AttributeLoad NameLoad attr NameLoad For NameStore NameLoad body Expr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad NameLoad decorator_list decorator_list ClassDef bases NameLoad body FunctionDef arguments args NameParam NameParam NameParam defaults body Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam defaults NameLoad NameLoad NameLoad body Expr Str If CompareIs NameLoad NameLoad body Assign NameStore Call NameLoad Call AttributeLoad NameLoad attr Assign SubscriptStore NameLoad Index Str NameLoad If NameLoad body Expr Call AttributeLoad AttributeLoad NameLoad attr attr BinOpAdd Str AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr NameLoad NameLoad If NameLoad body Expr Call AttributeLoad AttributeLoad NameLoad attr attr BinOpAdd Str AttributeLoad NameLoad attr NameLoad Num decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Return Call AttributeLoad NameLoad attr Call AttributeLoad Call NameLoad NameLoad attr Num decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign NameStore Call AttributeLoad NameLoad attr NameLoad Return ListComp SubscriptLoad Call AttributeLoad NameLoad attr NameLoad Index Str comprehension NameStore NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults body Expr Str Return Call AttributeLoad AttributeLoad NameLoad attr attr BinOpMod Str TupleLoad AttributeLoad NameLoad attr NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults NameLoad body Expr Str Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr BinOpMod Str AttributeLoad NameLoad attr Num Num keyword NameLoad Assign NameStore BinOpMod Str TupleLoad AttributeLoad NameLoad attr Assign NameStore BinOpMod Str TupleLoad AttributeLoad NameLoad attr If NameLoad body Expr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad For TupleStore NameStore NameStore NameLoad body Expr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Call NameLoad NameLoad Num decorator_list FunctionDef arguments args NameParam defaults body Expr Str Expr Call AttributeLoad AttributeLoad NameLoad attr attr BinOpMod Str AttributeLoad NameLoad attr decorator_list decorator_list ClassDef bases NameLoad body Expr Str Assign NameStore Str Assign NameStore Str Assign NameStore Str Assign NameStore Str Assign NameStore Str Assign NameStore Str Assign NameStore Str Assign NameStore ListLoad NameLoad NameLoad NameLoad NameLoad NameLoad NameLoad NameLoad FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam defaults NameLoad NameLoad NameLoad body Expr Str Assign AttributeStore NameLoad attr NameLoad If NameLoad body Assign AttributeStore NameLoad attr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad orelse If NameLoad body Assign AttributeStore NameLoad attr NameLoad orelse Assign AttributeStore NameLoad attr NameLoad Assign TupleStore AttributeStore NameLoad attr AttributeStore NameLoad attr TupleLoad NameLoad NameLoad If AttributeLoad NameLoad attr body Assign AttributeStore NameLoad attr Call NameLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr Assign AttributeStore NameLoad attr Call NameLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr If BoolOpAnd NameLoad AttributeLoad NameLoad attr body Expr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults Num body Expr Str Return Dict AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr Str AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults NameLoad body Expr Str For NameStore AttributeLoad NameLoad attr body Expr Call AttributeLoad AttributeLoad NameLoad attr attr AttributeLoad NameLoad attr BinOpMod Str TupleLoad AttributeLoad NameLoad attr NameLoad Assign NameStore Call AttributeLoad NameLoad attr Assign NameStore Num Assign NameStore Num While Num body Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad BinOpSub BinOpAdd NameLoad NameLoad Num If UnaryOpNot NameLoad body Break For NameStore NameLoad body Assign NameStore Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr NameLoad NameLoad NameLoad AugAssignAdd NameStore NameLoad If NameLoad body For NameStore Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr body Expr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Expr Call AttributeLoad AttributeLoad NameLoad attr attr Expr Call AttributeLoad AttributeLoad NameLoad attr attr BinOpMod Str AttributeLoad NameLoad attr Expr Call AttributeLoad AttributeLoad NameLoad attr attr BinOpMod Str AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam defaults body Expr Str Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign NameStore NameLoad Assign NameStore Call AttributeLoad NameLoad attr For NameStore NameLoad body Assign NameStore NameLoad For NameStore NameLoad body If Call AttributeLoad NameLoad attr NameLoad NameLoad NameLoad body Expr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Assign NameStore NameLoad Assign NameStore NameLoad Break If NameLoad body Break orelse Assign NameStore SubscriptLoad NameLoad Index Str Assign NameStore Call AttributeLoad NameLoad attr NameLoad NameLoad keyword NameLoad Assign NameStore Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr BinOpMod Str TupleLoad BinOpSub NameLoad NameLoad AttributeLoad NameLoad attr Return NameLoad decorator_list NameLoad FunctionDef arguments args NameParam NameParam NameParam NameParam defaults NameLoad body Expr Str Expr Call AttributeLoad NameLoad attr Str NameLoad Num Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign NameStore TupleLoad TupleLoad AttributeLoad NameLoad attr NameLoad TupleLoad AttributeLoad NameLoad attr NameLoad TupleLoad AttributeLoad NameLoad attr Str For TupleStore NameStore NameStore NameLoad body Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr BinOpMod Str TupleLoad NameLoad NameLoad NameLoad Assign NameStore Dict Str NameLoad If NameLoad body Assign SubscriptStore NameLoad Index Str NameLoad Return Call NameLoad NameLoad NameLoad decorator_list NameLoad FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign NameStore ListLoad Assign NameStore Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr For NameStore NameLoad body If Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr body Expr Call AttributeLoad NameLoad attr Call NameLoad NameLoad keyword Call AttributeLoad NameLoad attr BinOpAdd Str AttributeLoad NameLoad attr Str Return NameLoad decorator_list NameLoad FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr NameLoad Return Call AttributeLoad NameLoad attr decorator_list NameLoad FunctionDef arguments args NameParam NameParam defaults body Return Call AttributeLoad AttributeLoad NameLoad attr attr AttributeLoad NameLoad attr BinOpMod Str TupleLoad AttributeLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults body Return Call AttributeLoad AttributeLoad NameLoad attr attr AttributeLoad NameLoad attr BinOpMod Str TupleLoad AttributeLoad NameLoad attr NameLoad NameLoad decorator_list FunctionDef arguments args NameParam defaults body Return Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam NameParam defaults body Return Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr NameLoad decorator_list Assign NameStore Call NameLoad NameLoad NameLoad FunctionDef arguments args NameParam defaults body Return Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam NameParam defaults body Return Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr NameLoad decorator_list Assign NameStore Call NameLoad NameLoad NameLoad FunctionDef arguments args NameParam defaults body Return Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam NameParam defaults body Return Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr NameLoad decorator_list Assign NameStore Call NameLoad NameLoad NameLoad FunctionDef arguments args NameParam defaults body Return Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam NameParam defaults body Return Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr decorator_list Assign NameStore Call NameLoad NameLoad NameLoad FunctionDef arguments args NameParam defaults body Return Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam NameParam defaults body Return Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr NameLoad decorator_list Assign NameStore Call NameLoad NameLoad NameLoad FunctionDef arguments args NameParam defaults body Return Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam NameParam defaults body Return Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr NameLoad decorator_list Assign NameStore Call NameLoad NameLoad NameLoad decorator_list
N/A N/A calendar collections namedtuple N/A hashlib N/A simplejson json N/A time logbook Logger N/A classifier N/A redis_util N/A log N/A Logger Firetower-category N/A TSTuple N/A namedtuple TimeSeriesTuple N/A timestamp count N/A SECOND 1 N/A MINUTE 60 N/A HOUR N/A MINUTE 60 N/A DAY N/A HOUR 24 N/A WEEK N/A DAY 7 N/A TIME_SLICES N/A second minute 5_minute 10_minute 15_minute 30_minute hour 3_hour 6_hour 12_hour day week SECOND MINUTE N/A MINUTE 5 N/A MINUTE 10 N/A MINUTE 15 N/A MINUTE 30 HOUR N/A HOUR 3 N/A HOUR 6 N/A HOUR 12 DAY WEEK TimeSeries N/A object N/A __init__ N/A N/A self redis_conn cat_id N/A N/A N/A Create a time series instance for a category

        Args:
            redis_conn: redis.Redis connection.
            cat_id: str, identifier for category.

        This object exposes the time series data stored in the sorted set
        ts_{cat_id}.

         N/A N/A self cat_id cat_id N/A N/A self redis_conn redis_conn N/A convert_ts_list N/A N/A self ts_list time_slice N/A None N/A N/A Process lists from timeseries sorted sets.

        Args:
            ts_list: List of tuples from the ts_ sorted set.
            time_slice: Optional. Name of a key in TIME_SLICES. The value of
                that key sets the size of the bucket the time series data
                is sorted into. Defaults to minute buckets.


        Takes a list of scores and values from a time series sorted set and
        return a list of entries in the form ({TIMESTAMP}, {COUNT}). This is
        required because the TS sorted set doesn't hold the raw count, to make
        the values unique it stores them as '{TIMESTAMP}:{COUNT}'

         N/A ret N/A N/A slice_dict N/A N/A N/A time_slice None N/A N/A time_slice minute N/A time_slice N/A TIME_SLICES N/A time_slice N/A N/A ts_list N/A N/A N/A N/A ts_entry ts_list N/A N/A ts N/A int N/A ts_entry N/A 1 N/A count N/A int N/A N/A N/A N/A ts_entry N/A 0 split : N/A 1 N/A key N/A ts time_slice N/A N/A slice_dict N/A key N/A N/A N/A slice_dict get key 0 count N/A keys N/A N/A slice_dict keys N/A N/A N/A keys sort N/A i N/A range N/A keys N/A 0 N/A keys N/A -1 N/A N/A N/A i slice_dict N/A N/A N/A slice_dict N/A i 0 N/A keys N/A N/A slice_dict keys N/A N/A N/A keys sort N/A key keys N/A N/A N/A N/A ret append N/A TSTuple N/A key time_slice N/A slice_dict N/A key N/A ret N/A all N/A N/A self time_slice N/A None N/A N/A Return all timeseries data for the category.

        The data will be returned as a sequence of sequences.
        Each sub-sequence is of the form (VALUE, TIMESTAMP) where TIMESTAMP is
        a number of seconds since epoch and VALUE is the number of times the
        category appeared in that second.
         N/A N/A N/A self convert_ts_list N/A N/A N/A self redis_conn zrange N/A ts_%s N/A self cat_id 0 -1 withscores True time_slice N/A range N/A N/A self start end time_slice N/A None N/A N/A Return all timeseries data for the category between start and end.

        start and end are assumed to be seconds since the epoch.

        The data will be returned as a sequence of sequences.
        Each sub-sequence is of the form (VALUE, TIMESTAMP) where TIMESTAMP is
        a number of seconds since epoch and VALUE is the number of times the
        category appeared in that second.
         N/A N/A N/A self convert_ts_list N/A N/A N/A self redis_conn zrevrangebyscore N/A ts_%s N/A self cat_id end start withscores True time_slice N/A generate_ts_value N/A N/A ts count N/A N/A N/A Turn a timestamp and cat count into a value for storage in a set N/A N/A %s:%s N/A ts count N/A staticmethod archive_cat_counts N/A N/A self start_time preserve N/A True N/A N/A Move everything before start_time into a Sorted Set.

        Args:
            start_time: datetime, utc timezone.
            preserve: boolean, if set will add to existing ts counts rather than
                over-writing them. Useful when archiving counts that already
                have entries in the ts set (e.g. backfilling)
         N/A ts_key N/A ts_%s N/A N/A self cat_id N/A counter_key N/A counter_%s N/A N/A self cat_id N/A check_mark N/A N/A calendar timegm N/A N/A start_time timetuple N/A now N/A N/A calendar timegm N/A N/A time gmtime N/A counters_to_delete N/A N/A count_dict N/A N/A N/A self redis_conn hgetall counter_key N/A interesting_ts N/A x N/A x count_dict N/A N/A int x check_mark N/A ts interesting_ts N/A N/A N/A ts now N/A N/A N/A new_value N/A count_dict N/A ts N/A preserve N/A N/A existing_entry N/A N/A self range ts ts N/A existing_entry N/A N/A new_value N/A N/A existing_entry N/A 0 count N/A N/A N/A N/A self redis_conn zadd ts_key N/A N/A self generate_ts_value ts new_value ts N/A N/A N/A counters_to_delete append ts N/A counter counters_to_delete N/A N/A N/A N/A N/A self redis_conn hdel counter_key counter N/A N/A Events N/A object N/A __init__ N/A N/A self redis_conn cat_id N/A N/A N/A N/A self cat_id cat_id N/A N/A self redis_conn redis_conn N/A add_event N/A N/A self event timestamp event_increment ts_increment N/A None True True N/A N/A Add an event to the event list.

        Args:
            event: the event dictionary to save into the event set
            timestamp: Optional time stamp to use when inserting the event.
                Defaults to now.
            event_increment: Optional. boolean - adds event to event series.
            ts_increment: Optional. boolean - Increments the counter for this category.

         N/A N/A timestamp None N/A N/A timestamp N/A int N/A N/A time time N/A N/A event N/A ts timestamp N/A event_increment N/A N/A N/A N/A N/A self redis_conn zadd N/A data_ N/A self cat_id N/A N/A json dumps event timestamp N/A ts_increment N/A N/A N/A N/A N/A self redis_conn hincrby N/A counter_ N/A self cat_id timestamp 1 N/A get_recent N/A N/A self num_events N/A N/A N/A Return a list of recent events up to the num specified.

        Args:
            num_events: int, number of events to return.
        Returns:
            list, the most recent events up to num_events.
         N/A N/A N/A self range N/A N/A N/A int num_events __neg__ -1 N/A recent_signatures N/A N/A self num_sigs N/A N/A N/A Return a list of recent sigatures. N/A events N/A N/A self get_recent num_sigs N/A N/A N/A N/A N/A json loads event N/A sig N/A event events N/A range N/A N/A self start end N/A N/A N/A Return a range of events

        Args:
            start: Start index to return from.
            end: End index to return to.

        Both start and end are inclusive.
         N/A N/A N/A N/A self redis_conn zrange N/A data_%s N/A N/A self cat_id start end N/A _backfill_timeseries N/A N/A self delete N/A False N/A N/A This is for pulling data out an event stream and putting in ts.

        Args:
            delete: bool, whether or not to delete the archived ts.
         N/A events N/A N/A N/A self redis_conn zrange N/A data_%s N/A self cat_id 0 -1 withscores True N/A cat_counter_id N/A counter_%s N/A N/A self cat_id N/A cat_ts_id N/A ts_%s N/A N/A self cat_id N/A delete N/A N/A N/A N/A N/A self redis_conn delete cat_ts_id N/A N/A _sig ts events N/A N/A N/A N/A N/A self redis_conn hincrby cat_counter_id N/A int ts 1 N/A delete N/A N/A self N/A N/A N/A Delete an entire set of data N/A N/A N/A N/A self redis_conn delete N/A data_%s N/A self cat_id N/A N/A Category N/A object N/A N/A A class to encapsulate operations involving categories and their metadata

    Currently exposes 3 read/write properties: signature, human_name, and
    threshold.

     N/A CAT_META_HASH category_ids N/A SIGNATURE_KEY signature N/A HUMAN_NAME_KEY human_name N/A THRESHOLD_KEY threshold N/A STDEV_KEY stdev N/A MEAN_KEY mean N/A RE_KEY regex N/A keys N/A CAT_META_HASH SIGNATURE_KEY HUMAN_NAME_KEY THRESHOLD_KEY STDEV_KEY MEAN_KEY RE_KEY __init__ N/A N/A self redis_conn signature cat_id event N/A None None None N/A N/A  Init.

        Args:
            redis_conn: redis.Redis instance.
            signature: str.
            cat_id: str, used to fetch existing category if it exists.
            event: dict, added to existing set of events.
         N/A N/A self conn redis_conn N/A signature N/A N/A N/A self cat_id N/A N/A N/A redis_util Redis construct_cat_id signature N/A N/A cat_id N/A N/A N/A self cat_id cat_id N/A N/A N/A self cat_id None N/A N/A N/A self timeseries N/A self events N/A None None N/A N/A self cat_id N/A N/A N/A self timeseries N/A TimeSeries N/A self conn N/A self cat_id N/A N/A self events N/A Events N/A self conn N/A self cat_id N/A N/A event N/A self events N/A N/A N/A N/A N/A self events add_event event N/A to_dict N/A N/A self num_recent N/A 5 N/A N/A Return a dictionary representation of this cats metadata

        Args:
            num_recent: int, number of recent categorizations to include.
            defaults to five.
        Returns:
            dict, containing string value of signature, human readbable name
            of the category, the classification threshold, and a list of the
            most recent event signatures classified as this category.
         N/A N/A N/A self SIGNATURE_KEY N/A self HUMAN_NAME_KEY N/A self THRESHOLD_KEY recent_signatures N/A self signature N/A self human_name N/A self threshold N/A N/A N/A self events recent_signatures num_recent N/A recategorise N/A N/A self default_threshold archive_time N/A None N/A N/A WARNING: Will remove this category and re-sort its events

        Args:
            default_threshold: Default threshold to try and reclassify on.
                This takes the place of what is pulled from the config in
                firetower-server.
            archive_time: Optional. After reclassification if this is set
                everything before this time will be archived from this point
                back.

         N/A key N/A self keys N/A N/A N/A N/A N/A self conn hdel N/A self CAT_META_HASH N/A %s:%s N/A N/A self cat_id key N/A comp N/A N/A classifier Levenshtein N/A event_chunk 1000 N/A curr_count 0 N/A 1 N/A N/A events N/A N/A N/A self events range curr_count N/A N/A curr_count event_chunk 1 N/A N/A events N/A N/A N/A event events N/A N/A event_dict N/A N/A json loads event N/A N/A N/A self classify N/A self conn comp event_dict default_threshold N/A curr_count event_chunk N/A archive_time N/A N/A cat N/A N/A self get_all_categories N/A self conn N/A N/A N/A N/A N/A cat timeseries archive_cat_counts archive_time N/A N/A N/A N/A self events delete N/A N/A N/A N/A self conn delete N/A counter_%s N/A self cat_id N/A N/A N/A N/A self conn delete N/A ts_%s N/A self cat_id N/A classify N/A N/A cls queue classifiers error threshold N/A N/A N/A Determine which category, if any, a signature belongs to.

        If it doesn't find a match, then it'll save the error into a new
        category, which subsequent errors are checked against.

        Args:
            queue: redis connection instance.
            classifiers: list of Classifier instances.
            error: dict of json payload with a 'sig' key.
            threshold: float, classification threshold to match.
         N/A categories N/A N/A cls get_all_categories queue N/A matched_cat None N/A start N/A N/A time time N/A classifier classifiers N/A N/A matched False N/A cat categories N/A N/A N/A N/A classifier check_message cat error threshold N/A N/A N/A N/A N/A cat events add_event error N/A matched_cat cat N/A matched True N/A N/A matched N/A N/A N/A N/A cat_sig N/A error N/A sig N/A matched_cat N/A N/A cls create queue cat_sig event error N/A end N/A N/A time time N/A N/A N/A log info N/A Classification took %.2f seconds for matched category %s N/A N/A end start N/A matched_cat cat_id N/A matched_cat N/A classmethod create N/A N/A cls redis_conn signature event N/A None N/A N/A Adds category metadata.

        Args:
            redis_conn: Redis connection to use.
            signature: Signature of the new category.
            event: Optional. Event to save under the new category.

        This method will set 3 metadata fields for the category hash:
        * category is the full text of the original cateory.
        * verbose_name is the human readable name for this category (used for
            display purposes)
        * threshold is the custom threshold for this category

        The key values are in the form {category_hash}:{metadata_name} e.g.
        a909ede39c09d84ed1839c5ca0f9b9876113770b:category
         N/A N/A N/A redis_conn zadd categories signature 0 N/A cat_id N/A N/A cls construct_cat_id signature N/A cat_fields N/A N/A N/A cls SIGNATURE_KEY signature N/A N/A cls HUMAN_NAME_KEY cat_id N/A N/A cls THRESHOLD_KEY N/A N/A key value cat_fields N/A N/A N/A N/A redis_conn hset N/A cls CAT_META_HASH N/A %s:%s N/A cat_id key value N/A kwargs N/A cat_id cat_id N/A event N/A N/A N/A kwargs N/A event event N/A N/A cls redis_conn kwargs N/A classmethod get_all_categories N/A N/A cls redis_conn N/A N/A N/A Return a list of all currently defined categories N/A categories N/A N/A hash_map N/A N/A redis_conn hgetall N/A cls CAT_META_HASH N/A key hash_map N/A N/A N/A N/A key endswith N/A cls SIGNATURE_KEY N/A N/A N/A N/A categories append N/A cls redis_conn cat_id N/A N/A key replace N/A : N/A cls SIGNATURE_KEY N/A categories N/A classmethod construct_cat_id N/A N/A signature N/A N/A N/A Create Category ID hash from a category signature.

        Args:
            signature: str, signature of category.
        Returns:
            str, sha1 hash.
         N/A cat_id N/A N/A hashlib sha1 N/A N/A N/A cat_id update signature N/A N/A N/A cat_id hexdigest N/A staticmethod _get_key N/A N/A self key N/A N/A N/A N/A N/A N/A self conn hget N/A self CAT_META_HASH N/A %s:%s N/A N/A self cat_id key N/A _set_key N/A N/A self key value N/A N/A N/A N/A N/A N/A self conn hset N/A self CAT_META_HASH N/A %s:%s N/A N/A self cat_id key value N/A _get_signature N/A N/A self N/A N/A N/A N/A N/A self _get_key N/A self SIGNATURE_KEY N/A _set_signature N/A N/A self value N/A N/A N/A N/A N/A self _set_key N/A self SIGNATURE_KEY value N/A N/A signature N/A property _get_signature _set_signature _get_human N/A N/A self N/A N/A N/A N/A N/A self _get_key N/A self HUMAN_NAME_KEY N/A _set_human N/A N/A self value N/A N/A N/A N/A N/A self _set_key N/A self HUMAN_NAME_KEY value N/A N/A human_name N/A property _get_human _set_human _get_threshold N/A N/A self N/A N/A N/A N/A N/A self _get_key N/A self THRESHOLD_KEY N/A _set_threshold N/A N/A self value N/A N/A N/A N/A N/A self _set_key N/A self THRESHOLD_KEY value N/A N/A threshold N/A property _get_threshold _set_threshold _get_stdev N/A N/A self N/A N/A N/A N/A N/A self _get_key N/A self STDEV_KEY N/A _set_stdev N/A N/A self value N/A N/A N/A N/A N/A self _set_key N/A self STDEV_KEY N/A N/A stdev N/A property _get_stdev _set_stdev _get_mean N/A N/A self N/A N/A N/A N/A N/A self _get_key N/A self MEAN_KEY N/A _set_mean N/A N/A self value N/A N/A N/A N/A N/A self _set_key N/A self MEAN_KEY value N/A N/A mean N/A property _get_mean _set_mean _get_regex N/A N/A self N/A N/A N/A N/A N/A self _get_key N/A self RE_KEY N/A _set_regex N/A N/A self value N/A N/A N/A N/A N/A self _set_key N/A self RE_KEY value N/A N/A regex N/A property _get_regex _set_regex N/A