koatty_trace
Advanced tools
Comparing version 1.10.2 to 1.10.3
@@ -5,2 +5,9 @@ # Changelog | ||
### [1.10.3](https://github.com/koatty/koatty_trace/compare/v1.10.2...v1.10.3) (2023-12-14) | ||
### Bug Fixes | ||
* TraceOptions ([0a55cb0](https://github.com/koatty/koatty_trace/commit/0a55cb02e7878d8f7a3ce3f3d9f6179cb8005296)) | ||
### [1.10.1](https://github.com/koatty/koatty_trace/compare/v1.10.0...v1.10.1) (2023-11-10) | ||
@@ -7,0 +14,0 @@ |
/*! | ||
* @Author: richen | ||
* @Date: 2023-11-11 10:53:29 | ||
* @Date: 2023-12-14 22:44:39 | ||
* @License: BSD (3-Clause) | ||
@@ -43,4 +43,8 @@ * @Copyright (c) - <richenlin(at)gmail.com> | ||
IdFactory: any; | ||
Timeout: number; | ||
Encoding: string; | ||
OpenTrace: boolean; | ||
AsyncHooks: boolean; | ||
} | ||
export { } |
/*! | ||
* @Author: richen | ||
* @Date: 2023-11-11 10:53:17 | ||
* @Date: 2023-12-14 22:44:25 | ||
* @License: BSD (3-Clause) | ||
@@ -114,3 +114,3 @@ * @Copyright (c) - <richenlin(at)gmail.com> | ||
* @Date: 2022-02-21 11:32:03 | ||
* @LastEditTime: 2023-11-10 22:16:15 | ||
* @LastEditTime: 2023-12-14 21:49:11 | ||
*/ | ||
@@ -458,3 +458,3 @@ /** | ||
* @LastEditors: Please set LastEditors | ||
* @LastEditTime: 2023-08-21 16:13:02 | ||
* @LastEditTime: 2023-12-14 22:28:02 | ||
* @License: BSD (3-Clause) | ||
@@ -480,2 +480,6 @@ * @Copyright (c) - <richenlin(at)gmail.com> | ||
IdFactory: uuid.v4, | ||
Timeout: 10000, | ||
Encoding: 'utf-8', | ||
OpenTrace: false, | ||
AsyncHooks: false, | ||
}; | ||
@@ -491,9 +495,5 @@ /** | ||
options = { ...defaultOptions, ...options }; | ||
const timeout = (app.config('http_timeout') || 10) * 1000; | ||
const encoding = app.config('encoding') || 'utf-8'; | ||
const openTrace = app.config("open_trace") || false; | ||
const asyncHooks = app.config("async_hooks") || false; | ||
// | ||
let tracer; | ||
if (openTrace) { | ||
if (options.OpenTrace) { | ||
tracer = app.getMetaData("tracer")[0]; | ||
@@ -517,2 +517,5 @@ if (!tracer) { | ||
ctx.setMetaData(options.RequestIdName, requestId); | ||
const timeout = options.Timeout; | ||
const encoding = options.Encoding; | ||
// | ||
if (ctx.protocol === "grpc") { | ||
@@ -548,3 +551,3 @@ // allow bypassing koa | ||
let span; | ||
if (openTrace) { | ||
if (options.OpenTrace) { | ||
const serviceName = app.name || "unknownKoattyProject"; | ||
@@ -561,3 +564,3 @@ const wireCtx = tracer.extract(opentracing.FORMAT_HTTP_HEADERS, ctx.req.headers); | ||
} | ||
if (asyncHooks) { | ||
if (options.AsyncHooks) { | ||
return asyncLocalStorage.run(requestId, () => { | ||
@@ -564,0 +567,0 @@ const asyncResource = createAsyncResource(); |
{ | ||
"name": "koatty_trace", | ||
"version": "1.10.2", | ||
"version": "1.10.3", | ||
"description": "Full link tracking and error interception for koatty.", | ||
@@ -5,0 +5,0 @@ "scripts": { |
{ | ||
"name": "koatty_trace", | ||
"version": "1.10.2", | ||
"version": "1.10.3", | ||
"description": "Full link tracking and error interception for koatty.", | ||
@@ -5,0 +5,0 @@ "scripts": { |
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
53298
1207