You need to enable JavaScript to run this app.
Torch Log Service

Torch Log Service

Copy page
Download PDF
Machine learning function
Threshold recommendation function
Copy page
Download PDF
Threshold recommendation function
This topic introduces the syntax of threshold functions supported by TLS and usage examples for common scenarios.​
Notice​
Currently, machine learning functions are in public beta.​
ts_threshold_recommendation​
When monitoring SLA-related metrics with traditional manual alarm rule configuration, issues may exist in the results, including insufficient metric coverage and inaccurate alarm thresholds. If anomaly detection thresholds are set too loosely, it reduces active fault detection rate, leading to increased user loss and compensation. If anomaly detection thresholds are set too strictly, it results in a large number of false alarms. Consequently, the operation team may short of time to handle the actual exceptions.​
The ts_threshold_recommendation function enables clustering analysis of historical time series data, quickly identifies the distribution of normal data, and automatically recommends exception detection thresholds. It is suitable for alarm threshold settings and similar scenarios.​
Function syntax​
  • Syntax format​
  • ​
    select ts_threshold_recommendation(x, y,metricType) ​
    ​
  • Parameters description​
  • ​
    Parameters​
    Data type​
    Description​
    x​
    double​
    Time column, sorted in ascending order. Format: Unix time timestamp; unit: second.​
    y​
    double​
    Value column. It represents values for each corresponding time. The array length must match x, and contain at least 500 elements.​
    metricType​
    varchar​
    ​
    • SuccessRate: success rate. The input range for y is 0 to 1. If the success rate is below recommended threshold, exception exists.​
    • SuccessRate100: success rate. The input range for y is 0 to 100. If the success rate is below recommended threshold, exception exists.​
    • ErrorRate: error rate. The input range for y is 0 to 1. If the error rate exceeds recommended threshold, exception exists.​
    • ErrorRate100: error rate. The input range for y is 0 to 100. If the error rate exceeds recommended threshold, exception exists.​
    • Count: count statistics. The input range for y is integers. If the count is below recommended threshold, exception exists.​
    • ErrorCount: indicates error count statistics. The input range for y is integers. If the count exceeds recommended threshold, exception exists.​
    • Latency: latency in milliseconds. The input type for y is a floating-point number in milliseconds. If the latency exceeds the recommended threshold, exception exists.​
    • LatencySecond: latency in seconds. The input type for y is a floating-point number in seconds. If the latency exceeds the recommended threshold, exception exists.​
    • ResourceUtilizationRate: resource utilization rate. The input range for y is 0 to 1. If the rate exceeds the recommended threshold.​
    • ResourceUtilizationRate100: Resource utilization rate. The input value for y must be within the range 0–100. If the values is above recommended threshold, exception exists.​
    • Throughput: The input type for y must be a floating point number. If the values is above recommended threshold, exception exists.​
    Notice​
    How to choose between xxxRate and xxxRate100: if the data contains decimals, choose xxxRate; if the data contains integers, choose xxxRate100.​
    ​
  • Return values​
  • The return value is of Double type.​
Function examples​
  • Scenarios​
  • Calculate the millisecond delay threshold based on time and request size.​
  • Query and analysis statements​
  • ​
    *|select ts_threshold_recommendation(stamp, value, 'Latency') from (select __time__ as stamp, ReqSize as value limit 1000)​
    ​
  • Query and analysis results​
  • ​​​
​
Last updated: 2026.05.08 14:32:46