EPSILON = 1e-7 COL_TIMESTAMP = 'timestamp' COL_DATE = 'date' COL_VALUE = 'value' COL_SPLUNK_TIME = '_time' NAB_TIMESTAMP_FORMAT = '%Y-%m-%d %H:%M:%S' ITSI_TIMESTAMP_FORMAT = '%Y-%m-%dT%H:%M:%S.000%z' ITSI_TIMESTAMP_FORMAT_PD = '%Y-%m-%d %H:%M:%S%z' # The default value of the threshold on the test statistic for window method of level drift detection LEVEL_DRIFT_THRESHOLD = 2.5 # The default window length for window_method of level drift detection WINDOW_LENGTH = 7 # For continuous PLA model fitting: # The smoothing factor regulate the balance of the smoothing spline: # being as smooth as possible, while # closely fitting the input data # This default value is empirically decided on available dataset in developing the solution. SMOOTH_FACTOR = 2.5 # The number of points for local LOWESS smoothing, used in SND calculation for drift detection LOWESS_POINTS = 7 # Heuristical parameters, for post-processing to avoid reporting small or temporary level drifts THRESHOLD_SMALL_DRIFT = 10.0 THRESHOLD_TEMPORARY_DRIFT_LENGTH = 14 THRESHOLD_TEMPORARY_DRIFT = 20.0 DEFAULT_THRESHOLD = 80 NO_DRIFT = 0 DRIFTED = 1 DRIFT_PART = 2 DRIFT_DIRECTION_BOTH = 'both' DRIFT_DIRECTION_UP = 'up' DRIFT_DIRECTION_DOWN = 'down' ZERO_LEVEL_TOLERANCE = 0.005 FEATURE_SCALED = False # Constants for Column and Field Names ALERT_VALUE = 'alert_value' PART_OR_WHOLE = 'part_or_whole' DRIFT_TYPE = 'drift_type' PERCENT_DRIFT = 'percent_drift' START_TIME = 'start_time' END_TIME = 'end_time' THRESHOLD_TIME = 'threshold_time' KPI_ID = 'itsi_kpi_id' SERVICE_ID = 'itsi_service_id' DRIFT_DETECTION_RESULTS_COLLECTION = 'drift_detection_results' DRIFT_TIME_WINDOWS = 'drift_time_windows' IS_DRIFT_DETECTED = 'is_drift_detected' END_TIMESTAMP = "end_timestamp" LAST_DRIFT_AT = "last_drift_at" ALERT_TYPE = "alert_type" # HTTP error messages MISSING_KPI_ID = "Missing kpi_id." METHOD_NOT_ALLOWED = "Method not allowed." PATH_INFO = "path_info" USER = "_user" KVSTORE_KEY = "_key" ITSI_DRIFT_DETECTION_CONFIGURATION = "drift_detection_configuration" START_TIME_MISSING_MSG = f"{START_TIME} is missing from the query parameters" START_TIME_INVALID_FORMAT_MSG = f"{START_TIME} is not in a valid epoch format" END_TIME_INVALID_FORMAT_MSG = f"{END_TIME} is not in a valid epoch format" START_TIME_GREATER_THAN_END_TIME_MSG = f"{START_TIME} can't be greater than {END_TIME}" # ITSI Base Endpoint URI ITSI_APP_NAME = 'SA-ITOA' ITSI_APP_OWNER = 'nobody' ITSI_BASE_URI = "itoa_interface" # Specific ITSI Endpoint URIs ITSI_DRIFT_DETECTION_KPIS_URI = f"{ITSI_BASE_URI}/get_drift_kpis" # ITSI Alerting Events Endpoint URI ITSI_ALERT_URI = "event_management_interface/drift_event_action" # Template Info Keys LOOKBACK_PERIOD = "lookback_period" AGGREGATION_SPAN = "aggregation_span" AGGREGATION_FUNCTION = "aggregation_function" TOLERANCE_IN_PERCENT = "tolerance_in_percent" THRESHOLD_DIRECTION = "threshold_direction" # Drift comparing hyper-parameters, used in comparing drift # The threshold for starting day difference; values larger than this are considered a different drift. DAYS_DIFFERENCE_THRESHOLD = 1 # The threshold for drift length difference; values larger than this are considered a different drift. LENS_DIFFERENCE_THRESHOLD = 3 # Used to convert an epoch time(in seconds) to days SECONDS_PER_DAY = 60 * 60 * 24 # 86400 seconds DEFAULT_DATA_SPAN = "1m" ADJUSTED_DATA_SPAN = "5m" DAYS_OF_TWO_YEARS = 365 * 2 class ComparisonStatusConstants: """ A class containing constants that represent the possible outcomes of the drift detection process. """ COLLECTION_NOT_FOUND = "collection_not_found" NO_EXISTING_DRIFTS = "no_existing_drift" NO_NEW_DRIFTS = "no_new_drifts" SAME_DRIFT_FOUND = "same_drift_found" NEW_DRIFT_DETECTED = "new_drift_detected" EXISTING_TREND_CLEARING = "existing_trend_clearing" class AlertTypeConstants: """ A class containing constants that represent the alert types, used for sending alerts to ITSI """ NEW_DRIFT_DETECTED = "new" CLEARING = "clearing" class PostReturnStatusConstants: """ A class containing constants that represent the status of posting, used for checking return status of sending alerts to ITSI """ SUCCESS = "success" FAILURE = "failure" EXCEPTION = "exception"