import { authFields , sanitizeAuth } from '@vtex/node-error-report' ; import { Span } from 'opentracing' ; export interface TraceInfo { traceId : string ; isSampled : boolean ; } export function getTraceInfo ( span ) { const spanContext = span . context ( ) ; return { isSampled : ( spanContext as any ) . isSampled ?. ( ) ?? false , traceId : spanContext . toTraceId ( ) , } ; } param headersObj param resultFieldsPrefix export const cloneAndSanitizeHeaders = ( headersObj , resultFieldsPrefix = '' ) => { const ret = { } ; const entries = Object . entries ( headersObj ) ; for ( const [ key , val ] of entries ) { ret [ `${ resultFieldsPrefix }${ key }` ] = authFields . includes ( key ) ? sanitizeAuth ( val ) : val ; } return ret ; } ;