koatty_trace
Advanced tools
Comparing version 1.2.8 to 1.3.0
@@ -5,3 +5,3 @@ /// <reference types="node" /> | ||
import { Namespace } from "cls-hooked"; | ||
import { Application, Context } from "koatty_container"; | ||
import { Koatty, KoattyContext } from "koatty_core"; | ||
export * from "./Exception"; | ||
@@ -14,3 +14,3 @@ /** | ||
*/ | ||
export declare function TraceServerSetup(app: Application): Namespace; | ||
export declare function TraceServerSetup(app: Koatty): Namespace; | ||
/** | ||
@@ -24,3 +24,3 @@ * debug/trace server handle binding | ||
*/ | ||
export declare function TraceBinding(app: Application, req: IncomingMessage | Http2ServerRequest, res: ServerResponse | Http2ServerResponse, openTrace: boolean): void; | ||
export declare function TraceBinding(app: Koatty, req: IncomingMessage | Http2ServerRequest, res: ServerResponse | Http2ServerResponse, openTrace: boolean): void; | ||
/** | ||
@@ -33,2 +33,2 @@ * Trace middleware handler | ||
*/ | ||
export declare function TraceHandler(app: Application): (ctx: Context, next: Function) => Promise<any>; | ||
export declare function TraceHandler(app: Koatty): (ctx: KoattyContext, next: Function) => Promise<any>; |
@@ -36,6 +36,6 @@ "use strict"; | ||
if (openTrace) { | ||
app.trace.run(() => { | ||
app.tracer.run(() => { | ||
// event binding | ||
app.trace.bindEmitter(req); | ||
app.trace.bindEmitter(res); | ||
app.tracer.bindEmitter(req); | ||
app.tracer.bindEmitter(res); | ||
// execute app.callback | ||
@@ -75,3 +75,3 @@ app.callback()(req, res); | ||
let currTraceId = ''; | ||
if (app.trace) { | ||
if (app.tracer) { | ||
// some key | ||
@@ -84,5 +84,5 @@ const traceId = ctx.headers.traceId || ctx.query.traceId; | ||
currTraceId = parentId || `koatty-${uuid_1.v4()}`; | ||
app.trace.set('parentId', parentId !== null && parentId !== void 0 ? parentId : ''); | ||
app.trace.set('traceId', currTraceId); | ||
app.trace.set('ctx', ctx); | ||
app.tracer.set('parentId', parentId !== null && parentId !== void 0 ? parentId : ''); | ||
app.tracer.set('traceId', currTraceId); | ||
app.tracer.set('ctx', ctx); | ||
ctx.set('X-Trace-Id', currTraceId); | ||
@@ -89,0 +89,0 @@ } |
{ | ||
"name": "koatty_trace", | ||
"version": "1.2.8", | ||
"version": "1.3.0", | ||
"description": "Full link tracking and error interception for koatty.", | ||
@@ -74,2 +74,3 @@ "scripts": { | ||
"koatty_container": "^1.x.x", | ||
"koatty_core": "^1.x.x", | ||
"koatty_lib": "^1.x.x", | ||
@@ -83,2 +84,2 @@ "uuid": "^8.3.2" | ||
} | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1838654
5
+ Addedkoatty_core@^1.x.x
+ Addedaccepts@1.3.8(transitive)
+ Addedcache-content-type@1.0.1(transitive)
+ Addedcontent-disposition@0.5.4(transitive)
+ Addedcontent-type@1.0.5(transitive)
+ Addedcookies@0.9.1(transitive)
+ Addeddebug@4.3.7(transitive)
+ Addeddeep-equal@1.0.1(transitive)
+ Addeddelegates@1.0.0(transitive)
+ Addeddepd@1.1.22.0.0(transitive)
+ Addeddestroy@1.2.0(transitive)
+ Addedee-first@1.1.1(transitive)
+ Addedencodeurl@1.0.2(transitive)
+ Addedescape-html@1.0.3(transitive)
+ Addedfresh@0.5.2(transitive)
+ Addedhas-symbols@1.0.3(transitive)
+ Addedhas-tostringtag@1.0.2(transitive)
+ Addedhttp-assert@1.5.0(transitive)
+ Addedhttp-errors@1.8.1(transitive)
+ Addedis-generator-function@1.0.10(transitive)
+ Addedkeygrip@1.1.0(transitive)
+ Addedkoa@2.15.3(transitive)
+ Addedkoa-compose@4.2.0(transitive)
+ Addedkoa-convert@2.0.0(transitive)
+ Addedkoatty_core@1.10.1(transitive)
+ Addedkoatty_exception@1.5.3(transitive)
+ Addedmedia-typer@0.3.0(transitive)
+ Addedmime-db@1.52.0(transitive)
+ Addedmime-types@2.1.35(transitive)
+ Addednegotiator@0.6.3(transitive)
+ Addedon-finished@2.4.1(transitive)
+ Addedonly@0.0.2(transitive)
+ Addedopentracing@0.14.7(transitive)
+ Addedparseurl@1.3.3(transitive)
+ Addedsetprototypeof@1.2.0(transitive)
+ Addedstatuses@1.5.0(transitive)
+ Addedtoidentifier@1.0.1(transitive)
+ Addedtsscmp@1.0.6(transitive)
+ Addedtype-is@1.6.18(transitive)
+ Addedvary@1.1.2(transitive)
+ Addedylru@1.4.0(transitive)