Best practices for data analytics in Network Quality Analyzer
This topic provides examples of data query and analysis, dashboards, and alerts to help you get started with Network Quality Analyzer.
Prerequisites
Create a client application and set network probing rules. For more information, see Create a client application and Set network probing rules.
Background information
The Network Quality Analyzer in Alibaba Cloud Simple Log Service is a tool for real-time network quality analysis and monitoring. After data is collected through the analyzer, you can analyze it, view it, and set alerts. This topic explains how to customize dashboards, configure alerts, and view analytical data.
Step 1: Find the Logstore that stores the probing data
Log on to the Simple Log Service console.
In the Log Applications area, click Network Quality Analyzer.
In the upper-right corner of the page, click Client Management.
On the Client Management page, find the target client application in the list and click the icon.
In the Application Details panel, click the target Logstore.
The application details panel contains two Logstores: the raw detection data Logstore (such as ipa-xxx-raw) and the analysis summary data Logstore (such as ipa-xxx-summary).
In the target Logstore, view the network probing data.
For more information about the network probing data fields, see Network probing field descriptions.
NoteAlternatively, in the project that contains the client application, find the Logstore named ipa-${Application ID}-raw to view the raw probing data.
In the raw logs of the Logstore, you can find that the
tfield of a network detection log isnet_d, and the detection data is stored in JSON format in thenet.originfield. The field contains fields such as method (ping/mtr), host, host_ip, interface (4G/Wi-Fi), loss, avg, deviceInfo, and appInfo.
Step 2: Custom query and analysis
Indexes are preset for all data. Use the `json_extract_scalar` function to extract fields from `attribute.net.origin`.
Example 1
Query requirement: View the total number of probes per second for the ping probing method.
Search statement:
* and attribute.net.origin: ping | select date_trunc('second', __time__) as time, sum(cast(json_extract_scalar("attribute.net.origin",'$.count') as bigint)) as total group by time order by time asc limit 10000000
Example 2
Query requirement: Count the distinct device IDs for all probing methods.
Search statement:
* | select DISTINCT json_extract_scalar("attribute.net.origin",'$.deviceId')
Example 3
Query requirement: View the average packet loss rate per minute for the TCP ping probing method.
Search statement:
* and attribute.net.origin: tcpping | select date_trunc('minute', __time__) as time, avg(cast(json_extract_scalar("attribute.net.origin",'$.loss') as double)) as total group by time order by time asc limit 10000000
Step 3: Add a dashboard
On the Statistical Chart tab of the query results, click Add to Dashboard.
In the dashboard, view the custom report for Network Quality Analyzer.
Step 4: Set an alert
On the Dashboard page, choose Alert > Create Alert in the upper-right corner. The following example shows how to create an alert for a TCP ping packet loss rate that is greater than 0.1.
On the Alert Rule configuration page, click the Add Query Statistics button.
Set Associated Report to the Network Quality Analyzer report, or click Advanced Configuration to customize the configuration for query statistics. For more information, see Create a log-based alert monitoring rule. In the Query Statistics dialog box, click the Associated Report tab, set the report to TCPPING average packet loss rate under the Network Quality Analyzer report, set Dedicated SQL to Off, and set the Query Interval to 15 minutes (relative). In the query editing section, enter a SQL statement that uses functions such as date_trunc, avg, and json_extract_scalar to aggregate the packet loss rate by minute.
Click OK on the Alert Rule configuration page.
After the configuration takes effect, the system sends an alert notification when the packet loss rate is abnormal.
Configure the alert rule: set Rule Name to Network Quality Analyzer alert, set the check frequency to a fixed interval of 15 minutes, and use the tcpping detection method in the query statement. Select Query Result Matches for Trigger Condition, set the condition expression to
$0.total>0.1, and select Critical for Severity. In the Add Annotation section, set both title and desc to${alert_name} alert triggered, and turn on Auto Add Annotation. In the Advanced Configuration section, select Normal Mode for Alert Policy, and set Repeat Wait to 1 minute.