Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}`.slice(-32);
const high = traceId.slice(0, 16);
const low = traceId.slice(16);
const spanTags: ThriftTag[] = ThriftUtils.getThriftTags(tags);
const spanLogs: ThriftLog[] = ThriftUtils.getThriftLogs(logs);
return {
traceIdLow: Utils.encodeInt64(low),
traceIdHigh: Utils.encodeInt64(high),
spanId: Utils.encodeInt64(span.spanContext.spanId),
parentSpanId: parentSpan,
operationName: span.name,
references: getThriftReference(span.links),
flags: span.spanContext.options || 0x1,
startTime: Utils.encodeInt64(span.startTime.getTime() * 1000), // to microseconds
duration: Utils.encodeInt64(span.duration * 1000), // to microseconds
tags: spanTags,
logs: spanLogs,
};
}
const parentSpan: string | Buffer = span.parentSpanId
? Utils.encodeInt64(span.parentSpanId)
: ThriftUtils.emptyBuffer;
const traceId = `00000000000000000000000000000000${
span.spanContext.traceId
}`.slice(-32);
const high = traceId.slice(0, 16);
const low = traceId.slice(16);
const spanTags: ThriftTag[] = ThriftUtils.getThriftTags(tags);
const spanLogs: ThriftLog[] = ThriftUtils.getThriftLogs(logs);
return {
traceIdLow: Utils.encodeInt64(low),
traceIdHigh: Utils.encodeInt64(high),
spanId: Utils.encodeInt64(span.spanContext.spanId),
parentSpanId: parentSpan,
operationName: span.name,
references: getThriftReference(span.links),
flags: span.spanContext.options || 0x1,
startTime: Utils.encodeInt64(span.startTime.getTime() * 1000), // to microseconds
duration: Utils.encodeInt64(span.duration * 1000), // to microseconds
tags: spanTags,
logs: spanLogs,
};
}
? Utils.encodeInt64(span.parentSpanId)
: ThriftUtils.emptyBuffer;
const traceId = `00000000000000000000000000000000${
span.spanContext.traceId
}`.slice(-32);
const high = traceId.slice(0, 16);
const low = traceId.slice(16);
const spanTags: ThriftTag[] = ThriftUtils.getThriftTags(tags);
const spanLogs: ThriftLog[] = ThriftUtils.getThriftLogs(logs);
return {
traceIdLow: Utils.encodeInt64(low),
traceIdHigh: Utils.encodeInt64(high),
spanId: Utils.encodeInt64(span.spanContext.spanId),
parentSpanId: parentSpan,
operationName: span.name,
references: getThriftReference(span.links),
flags: span.spanContext.options || 0x1,
startTime: Utils.encodeInt64(span.startTime.getTime() * 1000), // to microseconds
duration: Utils.encodeInt64(span.duration * 1000), // to microseconds
tags: spanTags,
logs: spanLogs,
};
}
const parentSpan: string | Buffer = span.parentSpanId
? Utils.encodeInt64(span.parentSpanId)
: ThriftUtils.emptyBuffer;
const traceId = `00000000000000000000000000000000${
span.spanContext.traceId
}`.slice(-32);
const high = traceId.slice(0, 16);
const low = traceId.slice(16);
const spanTags: ThriftTag[] = ThriftUtils.getThriftTags(tags);
const spanLogs: ThriftLog[] = ThriftUtils.getThriftLogs(logs);
return {
traceIdLow: Utils.encodeInt64(low),
traceIdHigh: Utils.encodeInt64(high),
spanId: Utils.encodeInt64(span.spanContext.spanId),
parentSpanId: parentSpan,
operationName: span.name,
references: getThriftReference(span.links),
flags: span.spanContext.options || 0x1,
startTime: Utils.encodeInt64(span.startTime.getTime() * 1000), // to microseconds
duration: Utils.encodeInt64(span.duration * 1000), // to microseconds
tags: spanTags,
logs: spanLogs,
};
}
const high = traceId.slice(0, 16);
const low = traceId.slice(16);
const spanTags: ThriftTag[] = ThriftUtils.getThriftTags(tags);
const spanLogs: ThriftLog[] = ThriftUtils.getThriftLogs(logs);
return {
traceIdLow: Utils.encodeInt64(low),
traceIdHigh: Utils.encodeInt64(high),
spanId: Utils.encodeInt64(span.spanContext.spanId),
parentSpanId: parentSpan,
operationName: span.name,
references: getThriftReference(span.links),
flags: span.spanContext.options || 0x1,
startTime: Utils.encodeInt64(span.startTime.getTime() * 1000), // to microseconds
duration: Utils.encodeInt64(span.duration * 1000), // to microseconds
tags: spanTags,
logs: spanLogs,
};
}
(link): ThriftReference | null => {
const refType = getThriftType(link.type);
if (!refType) return null;
const traceId = `00000000000000000000000000000000${link.traceId}`.slice(
-32
);
const traceIdHigh = Utils.encodeInt64(traceId.slice(0, 16));
const traceIdLow = Utils.encodeInt64(traceId.slice(16));
const spanId = Utils.encodeInt64(link.spanId);
return { traceIdLow, traceIdHigh, spanId, refType };
}
)
(link): ThriftReference | null => {
const refType = getThriftType(link.type);
if (!refType) return null;
const traceId = `00000000000000000000000000000000${link.traceId}`.slice(
-32
);
const traceIdHigh = Utils.encodeInt64(traceId.slice(0, 16));
const traceIdLow = Utils.encodeInt64(traceId.slice(16));
const spanId = Utils.encodeInt64(link.spanId);
return { traceIdLow, traceIdHigh, spanId, refType };
}
)
(link): ThriftReference | null => {
const refType = getThriftType(link.type);
if (!refType) return null;
const traceId = `00000000000000000000000000000000${link.traceId}`.slice(
-32
);
const traceIdHigh = Utils.encodeInt64(traceId.slice(0, 16));
const traceIdLow = Utils.encodeInt64(traceId.slice(16));
const spanId = Utils.encodeInt64(link.spanId);
return { traceIdLow, traceIdHigh, spanId, refType };
}
)
if (span.annotations) {
span.annotations.forEach(ann => {
const tags: Tag[] = [];
Object.keys(ann.attributes).forEach(key => {
tags.push({ key, value: ann.attributes[key] });
});
tags.push({ key: 'description', value: ann.description });
logs.push({
timestamp: ann.timestamp,
fields: tags,
});
});
}
const parentSpan: string | Buffer = span.parentSpanId
? Utils.encodeInt64(span.parentSpanId)
: ThriftUtils.emptyBuffer;
const traceId = `00000000000000000000000000000000${
span.spanContext.traceId
}`.slice(-32);
const high = traceId.slice(0, 16);
const low = traceId.slice(16);
const spanTags: ThriftTag[] = ThriftUtils.getThriftTags(tags);
const spanLogs: ThriftLog[] = ThriftUtils.getThriftLogs(logs);
return {
traceIdLow: Utils.encodeInt64(low),
traceIdHigh: Utils.encodeInt64(high),
spanId: Utils.encodeInt64(span.spanContext.spanId),
parentSpanId: parentSpan,