Categories:

System Functions (System Information)

SYSTEM$ADD_EVENT (for Snowflake Scripting)¶

Add an event for trace.

Use SYSTEM$ADD_EVENT to add an event when using trace events from a handler written in Snowflake Scripting.

For more information, refer to Emitting Trace Events in Snowflake Scripting.

Syntax¶

SYSTEM$ADD_EVENT('<name>', '<object>');
Copy

Arguments¶

'name'

The name of the event to add.

'object'

An object containing name-value pairs representing the attributes to add.

Examples¶

Code in the following example uses the SYSTEM$ADD_EVENT function to add an event named name_a and an event named name_b. With name_b, it associates two attributes, score and pass. The code also sets two attributes for the span, attr1 and attr2.

create procedure MYPROC()
returns double
language sql
as
$$
begin
    -- Add an event without attributes
    SYSTEM$ADD_EVENT('name_a');

    -- Add an event with attributes
    let attr := {'score':89, 'pass':true};
    SYSTEM$ADD_EVENT('name_b', attr);

    -- Set attributes for the span
    SYSTEM$SET_SPAN_ATTRIBUTES('{'attr1':'value1', 'attr2':true}');

    return 3.14;
end;
$$
;
Copy