-
Notifications
You must be signed in to change notification settings - Fork 173
/
Copy pathindex.d.ts
23 lines (21 loc) · 936 Bytes
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// Copyright 2020 The OpenZipkin Authors; licensed to You under the Apache License, Version 2.0.
import {Middleware} from 'koa';
import {Tracer} from 'zipkin';
/**
* Creates a span id from the headers of an incoming request, or creates
* a root span id if appropriate headers are not present in the request.
*
* Prior to invocation of next middleware records ServerRecv annotation.
* When the final middleware finishes, records ServerSend annotation.
*
* Stores created span id in `_trace_id` property of `ctx.request`. If
* {ExplicitContext} implementation is used, be sure to pass the context
* to asynchronous callbacks that appear in other middleware using the
* `ctx.request._trace_id` property. This is necessary to have annotations
* recorded in correct spans.
*
* Alternatively, use {CLSContext} implementation.
*/
export declare function koaMiddleware(
options: {tracer: Tracer, port?: number}
): Middleware;