Add Function Parameters
For languages supported through our OpenTelemetry beta, it is possible to set function parameters. Function parameters are designated for background jobs and scripts, not for storing parameters for each function call in a trace.
For security and privacy we recommend filtering function parameters before sending them to our servers.
See the table below for a list of accepted root values per language. Each nested object can contain values that result in valid JSON (strings, integers, floats, booleans, nulls, etc.).
Language | Accepted root values |
---|---|
Go | JSON serialized string |
PHP | JSON serialized string |
The below code sample shows how to set custom request parameters:
// Additional setup is required to first fetch or create a new span import ( "encoding/json" "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/trace" ) params := map[string]interface{}{ "param1": "value1", "param2": "value2", "nested": map[string]interface{}{ "param3": "value3", "param4": "value4", }, } json, _ := json.Marshal(params) span.SetAttributes(attribute.String("appsignal.function.parameters", string(json)))
use OpenTelemetry\API\Trace\Span; $params = [ 'param1' => 'value1', 'param2' => 'value2', 'nested' => [ 'param3' => 'value3', 'param4' => 'value4', ], ]; $json = json_encode($params); $span = Span::getCurrent(); $span->setAttribute( 'appsignal.function.parameters', $json );
For certain languages, additional setup is required. Please follow the instructions for these languages:
Limitations
If the application sets function parameters multiple times, the latest set value is leading.