Function Monitoring

After creating a function and trigger, you can monitor the real-time invocation and running statuses of the function.

Viewing Function Metrics

FunctionGraph differentiates the metrics of a function by version, allowing you to query the metrics of a specific function version.

Procedure

  1. Log in to the FunctionGraph console, and choose Functions > Function List in the navigation pane.
  2. Click the name of the desired function to go to the function details page.
  3. Select a version or alias, and click the Monitoring tab.
  4. On the Monitoring tab page, select an interval (such as 5 minutes, 15 minutes, and 1 hour), and check the running status of the function.

    FunctionGraph presents the following metrics: invocation count, invocation errors, invocation duration (including the maximum, average, and minimum invocation durations), and throttled invocations.

Function metrics

Table 1 describes the function metrics.

Table 1 Function metrics

Metric

Unit

Description

Invocations

Count

Total number of invocation requests, including invocation errors and throttled invocations. In asynchronous invocation mode, the count starts only when a function is executed in response to a request.

Duration

ms

Maximum Duration: the maximum duration a function is executed within a period.

Minimum Duration: the minimum duration a function is executed within a period.

Average Duration: the average duration a function is executed within a period.

Errors

Count

Number of times that your functions failed with error code 200 being returned. Errors caused by function syntax or execution are also included.

Throttles

Count

Number of times that FunctionGraph throttles your functions due to the resource limit.

Viewing Monitoring Graphs

Create an alarm rule for a function to report metrics to Cloud Eye so that you can view monitoring graphs and alarm messages on the Cloud Eye console.

  1. Log in to the FunctionGraph console, and choose Functions > Function List in the navigation pane.
  2. Click the name of the desired function to go to the function details page.
  3. Select a version or alias, and click the Monitoring tab.
  4. Click Create Alarm Rule.
  5. In the Create Alarm Rule dialog box, set alarm parameters and click Next, as shown in Figure 1.

    Figure 1 Creating an alarm rule

  6. Set a rule name and click Create.

Function Metrics

Table 2 lists the function metrics that can be monitored by Cloud Eye.

Table 2 Function metrics

Metric

Display Name

Description

Unit

Upper Limit

Lower Limit

Recommended Threshold

Value Type

Dimension

count

Invocations

Number of function invocations

Count

-

0

-

int

package-functionname

failcount

Errors

Number of invocation errors

Count

-

0

-

int

package-functionname

rejectcount

Throttles

Number of function throttles

Count

-

0

-

int

package-functionname

duration

Average Duration

Average duration of function invocation

ms

-

0

-

int

package-functionname

maxDuration

Maximum Duration

Maximum duration of function invocation

ms

-

0

-

int

package-functionname

minDuration

Minimum Duration

Minimum duration of function invocation

ms

-

0

-

int

package-functionname

Querying Logs

After querying the logs of a function version within a specified date range, you can download the logs for further analysis.

  1. Log in to the FunctionGraph console, and choose Functions > Function List in the navigation pane.
  2. Click the name of the desired function to go to the function details page.
  3. Select a version or alias, and click the Logs tab.
  4. On the Logs tab page, set the search criteria.

    1. You can query logs by time and keyword.
    2. FunctionGraph allows you to query logs of the last 5 minutes, 30 minutes, 1 hour, or a custom time range.
    3. You can query the logs of a specific function version.

  5. Click to search for logs.

    • A log record includes an instance, a digest, and a context.
    • In the Operation column, click View Context to view the detailed running information of a log.

  6. If you select Show error logs only, only error logs are displayed.
  7. Enable LTS to facilitate function log management.

    1. On the Logs tab page, click Enable LTS.
    2. On the displayed page, click Enable.

    3. Search for logs by log type, time, request ID, instance ID, or keyword.

Downloading Logs

  1. Log in to the FunctionGraph console, and choose Functions > Function List in the navigation pane.
  2. Click the name of the desired function to go to the function details page.
  3. Click the Logs tab.
  4. Select a version and time range, and click Download Log.

    A maximum of 5000 logs can be downloaded at a time. When querying logs, select a proper time range to avoid the loss of logs.