The Insights feature provided by Function Compute collects metrics about each execution of a function and delivers these metrics to the Logstore that you specified when you configured logging. You can use service and analysis logs to create custom monitoring dashboards, which are Grafana dashboards. This topic describes how to create Grafana dashboards for functions based on request-level metrics in the Application Real-Time Monitoring Service (ARMS) console.

Background information

You can store function execution logs in Log Service. Log monitoring of ARMS integrates with Log Service and supports custom monitoring tasks. This applies to highly customized business scenarios where you use Function Compute. You can create a log monitoring task to obtain the statistics of the specified metrics, generate the data and reports that you require, and flexibly configure alerts. The metrics about function executions are displayed in a visualized way.

For more information about the metrics collected by Insights, see Overview.

Procedure

  1. Log on to the ARMS console.
  2. In the left-side navigation pane, choose Scenario-based Traces > Log-Based Metric.
  3. On the Log-Based Metric page, click Create Log-Based Metric in the upper-right corner.
  4. On the Create Log-Based Metric page, set the parameters in the Log source configuration section. function-log
    Parameter Description
    Task name The name of the log monitoring task.
    Application (optional) The application to which the log monitoring task applies. After you specify an application, you can filter log monitoring tasks by application on the Log-Based Metric page.
    Select a log source If no log source is available in the drop-down list, click Synchronize LogHub.

    After you select a log source, logs are automatically captured for preview. You can also click Log preview in the upper-right corner of the Preview of log section to preview the logs.

  5. In the Metric configuration section, configure the timestamp field and metric. Then, click Save.

    In the Configure the metric name step, click Add Metric. Set the metric name, metric value field, and aggregation dimension. Click Add Filter and add a filter condition for the metric.

    indicator_name
    Parameter Description
    Configure the timestamp field The field that indicates the timestamp in the log data. If the log data does not have a timestamp field, you can select Use the system timestamp to monitor log data that is generated at the current time point.
    Configure the metric name To add metrics, click Add Metric.
    Metric name The name of the metric.
    value field The measure that you want to use to monitor the application. Select a NUMERIC field from the log data. An ARMS metric provides real-time computing results returned by aggregate functions such as Count, Max, Min, Sum, and Avg. If you want to count only the number of log entries, select count only.
    GroupBy The dimension that you want to use to monitor the application. Select a non-NUMERIC field from the log data. For example, you can specify the brand name as an aggregation dimension to count the sales of each brand. You can select up to eight aggregation dimensions.
    Filters To add filter conditions, click Add Filter.

    Select a field from the log data as the key in the filter condition. For example, you can set a filter condition where the value of the log_type parameter is engine.

You can customize the configurations based on request-level metrics and business metrics of functions to obtain your custom Grafana dashboards.

View the Grafana dashboards

On the Log-Based Metric page, you can view all the created log monitoring tasks.

grafana-edit
  • Find the log monitoring task that you require and click Dashboard in the upper-right corner to view the monitoring data in a dashboard. grafana-dashboard
  • Click the name of a log monitoring task to hide or show the metrics involved in the task.
  • Find the log monitoring task that you want and click Edit in the upper-right corner. On the Log-Based Metric Settings page, modify the task on the Rule configuration tab or delete the task on the Delete tab.
    Notice If you delete a log monitoring task, all data of the task is deleted and cannot be restored.
  • Find the log monitoring task that you want, click More in the upper-right corner, and then select an option from the shortcut menu to start or stop the task.

References

Get started with log monitoring