Function type for masking sensitive data in spans before export.
Applied to the input and output of observations and traces, and to each
top-level metadata value. Metadata keys are never passed to the mask, so
masked metadata keeps its keys. Non-string metadata values are passed as
JSON strings and parsed back if the masked result is still valid JSON.
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 top-level metadata value. Metadata keys are never passed to the mask, so masked metadata keeps its keys. Non-string metadata values are passed as JSON strings and parsed back if the masked result is still valid JSON.