Updated on 2025-08-19 GMT+08:00

Heartbeat Function

This section describes how to configure a heartbeat function on the FunctionGraph console to detect function exceptions.

Scenarios

The heartbeat function monitors user functions for issues like deadlocks, memory overflow, or network errors.

After a heartbeat function is configured, FunctionGraph sends a heartbeat request to the function instance every 5 seconds. If the response is abnormal, FunctionGraph terminates the function instance.

The heartbeat request timeout is 3s. If no response is returned for six consecutive times, the function instance will be stopped.

Notes and Constraints

  • Currently, heartbeat functions can be configured only for Java functions.
  • The heartbeat function entry must be in the same file as your function handler.

    Java heartbeat function format:

    public boolean heartbeat() {
    	// Custom detection logic
    	return true
  • The heartbeat function has no input parameter and its return value is Boolean.

Configuring Heartbeat Function

  1. Log in to the FunctionGraph console. In the navigation pane, choose Functions > Function List.
  2. Click the name of a function.
  3. Choose Configuration > Advanced Settings.
  4. Enable Heartbeat Function and set the function entry.
    The heartbeat function entry must be in the same file as the handler. Format: [package name].[class name].[execution function name]. The value can contain a maximum of 128 characters.
    Figure 1 Configuring Heartbeat Function
  5. Click Save.