Compute > Cloud Functions > Console User Guide

This document describes how to create and manage functions in Cloud Functions console.

Manage functions

You can create, edit, delete, and copy functions.

Create functions

After setting up the function and writing the code, click the Create button to build the code and create the function.

console-guide-07 console-guide-08

Function settings

Category No. Item Description
Basic Information 1. Name Name of the function
Duplicate function names are not allowed.
Used as the function endpoint URL.
2. Description Description of the function, up to 250 characters
Function settings 3. Endpoint URL Function call HTTP endpoint URL
It changes automatically as you enter the function name.
4. Type Pool Manager
New Deployment
5. Resource Select function behavior environment resources
If it’s Pool Manager type, only the specified resources can be selected
New Deployment type allows you to enter custom resources
6. Execution timeout Specify how long the function will run (Time out). If the function runs and exceeds the specified time, the function is forced to abort and responds with an error
7. (Pool Manager) Concurrent execution settings Specify the number of concurrent executions of the function. When concurrent function calls occur, instances are executed concurrently as many times as the number of calls, and the maximum number of instances is limited.
8. (New Deployment) Minimum number of instances Specify the minimum number of instances to retain.
9. (New Deployment) Maximum number of instances Specify the maximum number of instances that can scale up automatically.
Log settings 10. Integrate with log service Choose to integrate using Log & Crash Search service
The logs of the function are available directly from Log & Crash Search service.
Logs are sent in 10-line units.

[Note]
(Pool Manager) Concurrent execution settings

console-guide-05


[Note]
(New Deployment) Number of instances - Depending on resource usage, the specified number of instances might not be created.


Code writing

console-guide-09 console-guide-10 console-guide-11

Category No. Item Description
Source code 1. Runtime Environment Select the function's runtime environment
2. Entry Point Specify the entry point for the function, such as function name
It is automatically completed to match the template in the runtime environment.
It must match the entry point in the source code that you wrote when you modified randomly.
If you entered it incorrectly, you cannot check it with deployment, but you can check it with with the log during testing.
Code 3. Code editor The template files in the runtime environment are loaded, and you modify them to write the function.
You cannot add directories on the code editor. To edit the directory structure, you must download the template file, edit it locally, and then upload the ZIP file.
4. User’s local environment Write function code in the local environment and upload as a ZIP file
5. Deployment Used to deploy user-written or uploaded code to verify that the build is normal.
Note: Functions are rebuilt with the latest updated source code at the time of creation, rather than using their distribution version.
Test 6. Test events Create a JSON Body to send to the function
7. Test Test the function by sending the JSON Body you created to the event. (This must be deployed first.)
You can verify function behavior with logs.
Call with the GET method.
8. Creation Use the Generate button to generate a function based on the function settings and the function you created.


[Note]
The Deploy button is only used to check the build of the source code you created, and when you create a function, it will be rebuilt with the latest source code, not the build you tested with Deploy.

Modify functions

To modify the function settings and code of an existing function, use the Edit button to modify the function.

Non-modifiable item

  • Name, runtime environment
    • You can edit everything except the item.

Source code

  • If you're using the code editor, the existing code is loaded.
  • If you created a function by uploading a ZIP file from the local environment, when you switch to the code editor, it loads the default template code without showing the ZIP file.

Delete a function

console-guide-14 Select an existing function to delete it. You can delete multiple functions at once.

Copy a function

console-guide-13 Copy a function that is identical to an existing function. The name cannot be duplicated, so you can rewrite the name before copying. - Triggers are not copied. (HTTP triggers are provided by default).

About functions

List of functions

console-guide-01 - You can see a list of functions that users have created. - The build status is automatically updated to confirm that the function is available.

Basic information of functions

console-guide-02 - You can see basic information about the function. - You can check the logs by going to Log & Crash Search service via the Log & Crash Search button in the log management topic. - You can check the build log by clicking the “Check build log” button in the build status item. - You can download the code you wrote as a ZIP file.

Manage function triggers

You can manage triggers that can perform functions. - HTTP triggers are built-in when creating a function. - You can set whether to use through the Enable/Disable features.

console-guid-12

  • You can execute the function you created via a given HTTP trigger.
    • Example: https://{userdomain}/{function name}
    • Method : GET, POST

Create/edit triggers

  • Timer
    • Value: Enter the cycle as a Cron string.
    • API Gateway
    • You can add HTTP Endpoint by using the API Gateway service.

Delete triggers

  • You can select multiple triggers to delete. You can't delete the HTTP trigger, which is the default trigger.

Monitor functions

console-guide-06 - You can check the usage of a function. - Provide metrics for the number of function calls, number of call rejections, number of errors, success rate, and function execution time. - Provide metrics within a set time. - If logs are integrated, you can navigate to the Log & Crash Search service using the Log & Crash Search button.

Item Description
Number of function calls Total number of function calls (per second)
Number of call rejections Number of function calls that failed as instances were not created (per second)
Number of errors Number of responses with a non-200 response code (per second)
Success rate Ratio of successful calls to the total number of function calls
Function execution time Response time for function calls

[Note]
The number of call rejections is only relevant if the type is Pool Manager.
The number of function calls, call rejections, and errors are displayed as an average number of times per second within the range of the metric step. For example, if the step is 15 seconds and 1 event occurred within the time period, it is displayed as 0.0667 (1÷15).
The average of the function execution time is the overall cumulative average, and the maximum is the maximum execution time during the period.

TOP