Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return tracer.scoped(() => {
const traceId: TraceId = instrumentation.recordRequest(
requestMethod,
Core.formatUrl(url.format(request.url)),
(header: string): option.IOption => {
const val = normalHeaders[header.toLowerCase()]
if (val !== null && val !== undefined) {
return new option.Some(val)
} else {
return option.None
}
},
)
const traceHeaders: Core.IRequestHeaders = headersForTraceId(
traceId,
)
// Update headers on request object
for (const key in traceHeaders) {
return tracer.scoped(() => {
const updatedHeaders: IRequestHeaders = instrumentation.recordRequest(
{ headers: {} },
formatUrl(request.uri),
request.methodName || '',
).headers
const traceId: TraceId = tracer.id
const withLD5Headers: IRequestHeaders = applyL5DHeaders(
requestHeaders,
updatedHeaders,
)
return next(request.data, { headers: withLD5Headers }).then(
(res: IRequestResponse) => {
instrumentation.recordResponse(
traceId as any,
`${res.statusCode}`,
)
return res
return tracer.scoped(() => {
const {
headers,
}: any = instrumentation.recordRequest(
{ headers: {} },
formatUrl(request.uri),
request.methodName || 'post',
)
const normalHeaders: any = Object.keys(
headers,
).reduce((acc: any, name: string) => {
acc[name.toLowerCase()] = headers[name]
return acc
}, {})
const requestHeader: TTwitter.IRequestHeader = {
trace_id: new Int64(
`0x${normalHeaders[ZipkinHeaders.TraceId]}`,
),
span_id: new Int64(
`0x${normalHeaders[ZipkinHeaders.SpanId]}`,