Common service metrics
The Common service metrics feature lets you quickly configure five key statistics for a service: total requests, successful requests, failed requests, success rate, and average duration. You can apply these statistics to a single service or group them by different dimensions.
Scenarios
Imagine you want to analyze log data from toll stations to determine the number of vehicles processed per minute at each station, the number of successful and failed payments, and the average transaction time. To do this, you can use common service metrics to group the data by the toll station dimension, set the transaction time as the duration, and configure the transaction result. This setup provides minute-by-minute statistics for each station, including total transactions, successful transactions, failed transactions, success rate, and average duration.
Log content:
2012-11-11 11:11:11 GA-123XX,Guangzhou North Toll Station,G25,Guangzhou,¥50,2340 ms,Y
2012-11-11 11:11:12 GA-123XX,Guangzhou North Toll Station,G26,Guangzhou,¥50,3209 ms,Y
2012-11-11 11:11:13 GA-123XX,Guangzhou North Toll Station,G27,Guangzhou,¥50,4200 ms,Y
2012-11-11 11:11:14 GA-123XX,Guangzhou North Toll Station,G27,Guangzhou,¥50,5700 ms,Y
2012-11-11 11:11:15 GA-123XX,Guangzhou North Toll Station,G26,Guangzhou,¥50,8500 ms,Y
...
Configuration
Log on to the Real-Time Monitoring console.
In the navigation pane on the left, choose Custom Monitoring > New > New Monitoring Product.
On the Common tab, click Common Service Metrics.
Configure basic information. In the Basic Information section, enter a Monitoring Configuration Name, such as "Analysis of Service D", the Application, and the Log File to Collect.
Configure log filtering. You can configure a whitelist or a blacklist. For more information, see Configure log filtering.
(Optional) Configure Group by Column Value. Select the dimensions for grouping. The product calculates statistics for each key within each dimension.
NoteYou must select at least one dimension to group data. You can group by multiple columns.
Set the Service-specific Metric Columns. This feature is used to configure five statistics: total requests, successful requests, success rate, failed requests, and average duration. To calculate these statistics, you must specify the columns that contain the result and duration data.
Column for result: Required. This column indicates the outcome of the service request. The system identifies a request as successful if the value is "Y" and as failed if the value is "N". If your logs use different strings for success or failure, you can use Column Value Translation to convert them to "Y" or "N".
Column for duration: Optional. This column contains the request duration. If your logs do not have duration data, or if you do not need to calculate the average duration, select No duration statistics needed. For more information about Column Value Translation, see Column Value Translation.
Configure alerts. For more information, see Configure alerts.
Click Submit to save the configuration.
View data
In the navigation pane on the left, choose Custom Monitoring. Select the metric that you created, such as Analysis of Service D, to view its statistics.
Statistical data becomes available approximately two to three minutes after you save the configuration.
Sample data report preview:
If you configured Group by Column Value for the metric, note that the 1 hour, 3 hours, and 5 hours options for the Instance Index Range on the report page refer to the last 1, 3, or 5 hours in your local time zone, such as UTC+8. For example, if you set the Instance Index Range to 1 hour, the "Analysis of Service D" report shows only the interfaces that had traffic during that time.
To view data for an interface that had traffic only more than five hours ago, enter the interface name in the Interface search box under Search by Instance. You can click a value in the report, such as the total count for the gets interface in the preceding image, to view the historical data trend for that interface.
