This document describes how to develop a simple Hello World
web service in the Serverless Cloud Function (SCF) Console.
helloworld
.helloworld
, press "Enter" to search for and select the "helloworld" template.index.py
file, compress it, and upload it to SCF for function creation.main_handler
in the sample code is the entry function, which has the following main parameters:event
parameter: gets information of the triggering source.context
parameter: gets the environment and configuration information of this function.Select Function code and click Test to run the code and return the test result as shown below:
Note:
- If you need to replace the test template or its content, you can directly edit the function content or select Current Test Template, replace it, and then click Save.
- Different test templates simulate different trigger message sources, and the messages passed between different triggers and SCF are data structures agreed upon in advance. For more information, please see Trigger Overview.
During this test, SCF will get the data structures of the "Hello world event template" in the event
parameter of the main_handler
.
{
"key1": "test value 1",
"key2": "test value 2"
}
On the details page of a created function, select Log Query on the left to view the detailed logs of the function as shown below:
For more information on logs, please see Viewing Execution Logs.
On the details page of a created function, select Monitoring information to view metrics such as function invocations and execution duration as shown below:
Note:
The minimal granularity of monitoring statistics collection is 1 minute. You need to wait for 1 minute before you can view the current monitoring record.
For more information on monitoring, please see Description of Monitoring Metrics.
On the details page of a created function, click click here to configure an alarm policy for the function to monitor its running status as shown below:
For more information on how to configure an alarm, please see Configuring Alarm.
Was this page helpful?