Function type for masking sensitive data in spans before export.
Applied to the input and output of observations and traces, and to each
observation metadata value, one attribute at a time. Metadata keys are never
passed to the mask, so masked metadata keeps its keys. Trace metadata
propagated with propagateAttributes is not masked.
Observation metadata values are passed decoded, e.g. the string "prod",
the number 3 or an object, not their JSON encoding. The masked value is
JSON-encoded again before export; if it is null or undefined, the
metadata key is dropped.
Type declaration
(params:{data:any}):any|Promise<any>
Parameters
params: {data:any}
Object containing the data to be masked
data: any
The data that should be masked
Returns any|Promise<any>
The masked data, or a promise resolving to it
Example
constmaskFunction: MaskFunction = async ({ data }) => { if (typeofdata === 'string') { returndata.replace(/password=\w+/g, 'password=***'); } returndata; };
Function type for masking sensitive data in spans before export.
Applied to the input and output of observations and traces, and to each observation metadata value, one attribute at a time. Metadata keys are never passed to the mask, so masked metadata keeps its keys. Trace metadata propagated with
propagateAttributesis not masked.Observation metadata values are passed decoded, e.g. the string
"prod", the number3or an object, not their JSON encoding. The masked value is JSON-encoded again before export; if it isnullorundefined, the metadata key is dropped.