How to debug edge functions on Data Streaming

The debugging process in edge functions’ code on Data Streaming helps you identify if errors are still occurring or if the process was successful.

Before analyzing the process, you need to apply the debugging code. Find out more on Debugging edge functions.

Setting up Data Streaming to debug edge functions

Section titled Setting up Data Streaming to debug edge functions

After applying the debugging code for edge functions:

  1. Access Azion Console.
  2. On the upper-left corner, select Data Streaming on the OBSERVE section.
  3. Click Add Streaming.
  4. Choose a name for your data streaming.
  5. On the Data Source dropdown menu, select Edge Functions.
  6. On the Template dropdown menu, select Custom Template.
  7. On the Data Set code box, add the following variables:
{
"time": "$time",
"global_id": "$global_id",
"edge_function_id": "$edge_function_id",
"request_id": "$request_id",
"log_level": "$log_level",
"log_message": "$log_message"
}
  1. On Options, select between Filter Domains or All Domains. See more about each option on How to associate domains on Data Streaming.
  2. On the Destination section, select an Endpoint Type on the dropdown menu. See more about setting an endpoint.
    • You’ll see different fields depending on the endpoint type you choose.

Finally, to finish your data streaming setup:

  1. Make sure the Active switch is turned on.
  2. Click the Save button.

Now, you’ll be able to analyze the behavior of the edge functions debugging process through the logs sent to your configured data streaming.

VariableDefinition
$timeRequest date and time. Example: Oct. 31st, 2022 - 19:30:41
$global_idSettings identifier.
$edge_function_idEdge Function identifier.
$request_idUnique request identifier. Example: 5f222ae5938482c32a822dbf15e19f0f
$log_levelLevel of the log generator: ERROR, WARN, INFO, DEBUG, or TRACE.
$log_messageEditable message used in the log function. Available for users to identify and report a given behavior.

Contributors