Create a MetricBase linear predictor trigger

  • Release version: Xanadu
  • Updated August 1, 2024
  • 4 minutes to read
  • Create a MetricBase linear predictor trigger to detect when a metric is likely to cross a specified threshold within a specified period of time.

    Before you begin

    Role required: admin

    About this task

    The linear predictor trigger uses past data to generate a line that predicts future values. When MetricBase predicts that the linear value reaches a threshold, the trigger executes.

    Figure 1. Linear predictor crosses the threshold
    Linear predictor crosses the threshold.

    If the most recent data point reaches the threshold, the trigger executes regardless of the linear prediction.

    Trigger parameters include how much past data to use in the calculation of the prediction, how far ahead to look, and the level of confidence that you accept.

    Procedure

    1. Navigate to All > MetricBase > MetricBase Triggers > Trigger Definitions.
    2. Select New.
    3. On the MetricBase Trigger Creation form, select the Linear Predictor Trigger option.
    4. On the form, fill in the fields.
      The trigger levels are not initially visible on this form. You configure the levels later.
      Table 1. MetricBase Linear Predictor Trigger form
      Field Description
      Name Name of the linear predictor trigger.
      Table name

      Table in the MetricBase database that contains the metric that you want to monitor. The only tables that appear when you click the search icon are the tables that you specified in the time-series metrics.

      If you select a metric before you select a table, only tables that have that metric appear in the Table name dialog box.

      Metric

      Table metric that you want to monitor that is specified by the Table name. The only metrics that appear when you click the search icon are the metrics in that table.

      If you select a metric before you specify a Table name, the metrics in all your time-series metrics appear. After you select a metric, only the tables that contain that metric appear when you click the search icon that is next to the Table name.

      Active Option to activate the trigger.
      Window Length of time used to calculate the line that predicts the future course of the value. For example, you might want to use the last 10 minutes of data to calculate the linear predictor. If the value is too long, the line does not reflect current trends. If the value is too short, the line might follow the raw values too closely and not accurately reflect the overall trend of the values. The value must be at least 10 times the sampling period that is defined by the sampling rate of your Metric.
      Warning:
      Do not confuse this value with the Window value in the trigger level. That value specifies how far into the future that you want the linear predictor to look to see if the Metric is likely to cross the Threshold.
      Confidence Level (%) A measure of how closely the real data fits the linear prediction of the data. A confidence level of 95% means that the real value must be within 5% of the predicted value to execute a trigger. If you only want to trigger when the real values are close to the predicted values, choose a high confidence percentage. If you are willing to accept real data that varies more significantly from the predicted values as being valid, select a lower confidence level, for example, 80%.
      Trend Direction of the trend: upward or downward. For example, the value is increasing or decreasing toward the Threshold.
      Threshold Target value that the metric is expected to reach before the trigger executes.
      Description Description of the trigger.
    5. Select Save.
      A new record is created.
    6. In the MetricBase Linear Predictor Trigger Levels section on the record you just created, double-click each cell to add values that specify trigger parameters.
      Table 2. MetricBase Linear Predictor Trigger Levels
      Field Description
      Level Numbers that indicate increasing severity. Each level should trigger a different flow. For example, you might define the following:
      Level 1
      Battery is predicted to reach 20% in 30 minutes.
      Level 2
      Battery is predicted to reach 20% in 5 minutes.

      Level is often used in Condition Scripts. See Execute triggers conditionally.

      Function Comparative function to use on the threshold value. Less than or is is the only available option. For example, battery life Less than or is 30 minutes.
      Window How far into the future that you want the linear predictor to look to see if the metric is predicted to cross the threshold.
      Warning:
      Do not confuse this value with the Window value in the trigger definition form. That value specifies how much data to use (measured in time) to calculate the slope of the predictor line.
    7. Optional: Add rows to the table to create multi-layered triggering behavior.
      Typically, each additional row (level) indicates a more severe condition. The Workflow Studio flow associated with the level should warn with increasing severity.
    8. Select Update.
    9. Optional: Add a triggering condition that determines whether a trigger executes a Workflow Studio flow.

    Linear Predictor form

    Linear predictor form

    What to do next

    Associate this trigger with a Workflow Studio flow. For more information, see Assign a trigger to a flow.