@eggjs/tracer 4.0.0-beta.35 → 4.0.0-beta.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent.d.ts +2 -2
- package/dist/agent.js +6 -2
- package/dist/app/extend/agent.d.ts +2 -2
- package/dist/app/extend/agent.js +6 -2
- package/dist/app/extend/application.d.ts +9 -5
- package/dist/app/extend/application.js +18 -18
- package/dist/app/extend/context.d.ts +9 -5
- package/dist/app/extend/context.js +16 -14
- package/dist/app.d.ts +2 -2
- package/dist/app.js +6 -2
- package/dist/boot.d.ts +9 -5
- package/dist/boot.js +17 -13
- package/dist/config/config.default.d.ts +8 -5
- package/dist/config/config.default.js +6 -6
- package/dist/index.d.ts +18 -15
- package/dist/index.js +20 -18
- package/dist/lib/tracer.d.ts +10 -6
- package/dist/lib/tracer.js +17 -15
- package/dist/types.d.ts +21 -19
- package/dist/types.js +1 -2
- package/package.json +32 -37
package/dist/agent.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { TracerBoot } from
|
|
2
|
-
export default
|
|
1
|
+
import { TracerBoot } from "./boot.js";
|
|
2
|
+
export { TracerBoot as default };
|
package/dist/agent.js
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
1
|
import { TracerBoot } from "./boot.js";
|
|
2
|
-
|
|
3
|
-
//#
|
|
2
|
+
|
|
3
|
+
//#region src/agent.ts
|
|
4
|
+
var agent_default = TracerBoot;
|
|
5
|
+
|
|
6
|
+
//#endregion
|
|
7
|
+
export { agent_default as default };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import TracerApplication from
|
|
2
|
-
export default
|
|
1
|
+
import TracerApplication from "./application.js";
|
|
2
|
+
export { TracerApplication as default };
|
package/dist/app/extend/agent.js
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
1
|
import TracerApplication from "./application.js";
|
|
2
|
-
|
|
3
|
-
//#
|
|
2
|
+
|
|
3
|
+
//#region src/app/extend/agent.ts
|
|
4
|
+
var agent_default = TracerApplication;
|
|
5
|
+
|
|
6
|
+
//#endregion
|
|
7
|
+
export { agent_default as default };
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { Tracer } from "../../lib/tracer.js";
|
|
2
|
+
import { Application } from "egg";
|
|
3
|
+
|
|
4
|
+
//#region src/app/extend/application.d.ts
|
|
5
|
+
declare const isReady: unique symbol;
|
|
6
|
+
declare class TracerApplication extends Application {
|
|
7
|
+
get tracer(): Tracer;
|
|
6
8
|
}
|
|
9
|
+
//#endregion
|
|
10
|
+
export { TracerApplication as default, isReady };
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { debuglog } from
|
|
2
|
-
import { Application } from
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
1
|
+
import { debuglog } from "node:util";
|
|
2
|
+
import { Application } from "egg";
|
|
3
|
+
|
|
4
|
+
//#region src/app/extend/application.ts
|
|
5
|
+
const debug = debuglog("egg/tracer/app/extend/application");
|
|
6
|
+
const cacheTracer = Symbol("before_ready_tracer");
|
|
7
|
+
const isReady = Symbol("egg_tracer_is_ready");
|
|
8
|
+
var TracerApplication = class extends Application {
|
|
9
|
+
get tracer() {
|
|
10
|
+
if (this[isReady]) return new this.config.tracer.Class(this.createAnonymousContext());
|
|
11
|
+
if (!this[cacheTracer]) this[cacheTracer] = new this.config.tracer.Class(this.createAnonymousContext());
|
|
12
|
+
debug("use cached tracer before ready, type: %o", this.type);
|
|
13
|
+
return this[cacheTracer];
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
//#endregion
|
|
18
|
+
export { TracerApplication as default, isReady };
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { Tracer } from "../../lib/tracer.js";
|
|
2
|
+
import { Context } from "egg";
|
|
3
|
+
|
|
4
|
+
//#region src/app/extend/context.d.ts
|
|
5
|
+
declare class TracerContext extends Context {
|
|
6
|
+
get tracer(): Tracer;
|
|
7
|
+
get traceId(): string;
|
|
6
8
|
}
|
|
9
|
+
//#endregion
|
|
10
|
+
export { TracerContext as default };
|
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
import { Context } from
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
|
|
1
|
+
import { Context } from "egg";
|
|
2
|
+
|
|
3
|
+
//#region src/app/extend/context.ts
|
|
4
|
+
const TRACER = Symbol("context tracer");
|
|
5
|
+
var TracerContext = class extends Context {
|
|
6
|
+
get tracer() {
|
|
7
|
+
if (!this[TRACER]) this[TRACER] = new this.app.config.tracer.Class(this);
|
|
8
|
+
return this[TRACER];
|
|
9
|
+
}
|
|
10
|
+
get traceId() {
|
|
11
|
+
return this.tracer.traceId;
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
//#endregion
|
|
16
|
+
export { TracerContext as default };
|
package/dist/app.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { TracerBoot } from
|
|
2
|
-
export default
|
|
1
|
+
import { TracerBoot } from "./boot.js";
|
|
2
|
+
export { TracerBoot as default };
|
package/dist/app.js
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
1
|
import { TracerBoot } from "./boot.js";
|
|
2
|
-
|
|
3
|
-
//#
|
|
2
|
+
|
|
3
|
+
//#region src/app.ts
|
|
4
|
+
var app_default = TracerBoot;
|
|
5
|
+
|
|
6
|
+
//#endregion
|
|
7
|
+
export { app_default as default };
|
package/dist/boot.d.ts
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { Application, ILifecycleBoot } from "egg";
|
|
2
|
+
|
|
3
|
+
//#region src/boot.d.ts
|
|
4
|
+
declare class TracerBoot implements ILifecycleBoot {
|
|
5
|
+
private readonly app;
|
|
6
|
+
constructor(app: Application);
|
|
7
|
+
didLoad(): Promise<void>;
|
|
6
8
|
}
|
|
9
|
+
//#endregion
|
|
10
|
+
export { TracerBoot };
|
package/dist/boot.js
CHANGED
|
@@ -1,14 +1,18 @@
|
|
|
1
|
-
import { debuglog } from 'node:util';
|
|
2
1
|
import { isReady } from "./app/extend/application.js";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
2
|
+
import { debuglog } from "node:util";
|
|
3
|
+
|
|
4
|
+
//#region src/boot.ts
|
|
5
|
+
const debug = debuglog("egg/tracer/boot");
|
|
6
|
+
var TracerBoot = class {
|
|
7
|
+
app;
|
|
8
|
+
constructor(app) {
|
|
9
|
+
this.app = app;
|
|
10
|
+
}
|
|
11
|
+
async didLoad() {
|
|
12
|
+
debug("didLoad %o", this.app.type);
|
|
13
|
+
this.app[isReady] = true;
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
//#endregion
|
|
18
|
+
export { TracerBoot };
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
import { Tracer } from
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { Tracer } from "../lib/tracer.js";
|
|
2
|
+
|
|
3
|
+
//#region src/config/config.default.d.ts
|
|
4
|
+
interface TracerConfig {
|
|
5
|
+
Class: typeof Tracer;
|
|
4
6
|
}
|
|
5
7
|
declare const _default: {
|
|
6
|
-
|
|
8
|
+
tracer: TracerConfig;
|
|
7
9
|
};
|
|
8
|
-
|
|
10
|
+
//#endregion
|
|
11
|
+
export { TracerConfig, _default as default };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Tracer } from "../lib/tracer.js";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
|
|
3
|
+
//#region src/config/config.default.ts
|
|
4
|
+
var config_default_default = { tracer: { Class: Tracer } };
|
|
5
|
+
|
|
6
|
+
//#endregion
|
|
7
|
+
export { config_default_default as default };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,17 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
|
|
1
|
+
import { Tracer } from "./lib/tracer.js";
|
|
2
|
+
import "./types.js";
|
|
3
|
+
import { EggPluginFactory } from "egg";
|
|
4
|
+
|
|
5
|
+
//#region src/index.d.ts
|
|
6
|
+
|
|
5
7
|
/**
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
8
|
+
* Usage:
|
|
9
|
+
* ```ts
|
|
10
|
+
* // config/plugin.ts
|
|
11
|
+
* import tracerPlugin from '@eggjs/tracer';
|
|
12
|
+
*
|
|
13
|
+
* export default {
|
|
14
|
+
* ...tracerPlugin(),
|
|
15
|
+
* };
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
16
18
|
declare const _default: EggPluginFactory;
|
|
17
|
-
|
|
19
|
+
//#endregion
|
|
20
|
+
export { Tracer, _default as default };
|
package/dist/index.js
CHANGED
|
@@ -1,21 +1,23 @@
|
|
|
1
|
-
import { definePluginFactory } from 'egg';
|
|
2
|
-
import "./types.js";
|
|
3
1
|
import { Tracer } from "./lib/tracer.js";
|
|
4
|
-
|
|
2
|
+
import { definePluginFactory } from "egg";
|
|
3
|
+
|
|
4
|
+
//#region src/index.ts
|
|
5
5
|
/**
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
6
|
+
* Usage:
|
|
7
|
+
* ```ts
|
|
8
|
+
* // config/plugin.ts
|
|
9
|
+
* import tracerPlugin from '@eggjs/tracer';
|
|
10
|
+
*
|
|
11
|
+
* export default {
|
|
12
|
+
* ...tracerPlugin(),
|
|
13
|
+
* };
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
var src_default = definePluginFactory({
|
|
17
|
+
name: "tracer",
|
|
18
|
+
enable: true,
|
|
19
|
+
path: import.meta.dirname
|
|
20
20
|
});
|
|
21
|
-
|
|
21
|
+
|
|
22
|
+
//#endregion
|
|
23
|
+
export { Tracer, src_default as default };
|
package/dist/lib/tracer.d.ts
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { Context } from "egg";
|
|
2
|
+
|
|
3
|
+
//#region src/lib/tracer.d.ts
|
|
4
|
+
declare class Tracer {
|
|
5
|
+
#private;
|
|
6
|
+
readonly ctx: Context;
|
|
7
|
+
constructor(ctx: Context);
|
|
8
|
+
get traceId(): string;
|
|
7
9
|
}
|
|
10
|
+
//#endregion
|
|
11
|
+
export { Tracer };
|
package/dist/lib/tracer.js
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
import { randomUUID } from
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
15
|
-
|
|
1
|
+
import { randomUUID } from "node:crypto";
|
|
2
|
+
|
|
3
|
+
//#region src/lib/tracer.ts
|
|
4
|
+
var Tracer = class {
|
|
5
|
+
ctx;
|
|
6
|
+
#traceId;
|
|
7
|
+
constructor(ctx) {
|
|
8
|
+
this.ctx = ctx;
|
|
9
|
+
}
|
|
10
|
+
get traceId() {
|
|
11
|
+
if (!this.#traceId) this.#traceId = randomUUID();
|
|
12
|
+
return this.#traceId;
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
//#endregion
|
|
17
|
+
export { Tracer };
|
package/dist/types.d.ts
CHANGED
|
@@ -1,19 +1,21 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
1
|
+
import { Tracer } from "./lib/tracer.js";
|
|
2
|
+
import { TracerConfig } from "./config/config.default.js";
|
|
3
|
+
|
|
4
|
+
//#region src/types.d.ts
|
|
5
|
+
declare module "egg" {
|
|
6
|
+
interface EggAppConfig {
|
|
7
|
+
/**
|
|
8
|
+
* tracer config
|
|
9
|
+
* @member Config#tracer
|
|
10
|
+
* @property {Tracer} Class - tracer class name
|
|
11
|
+
*/
|
|
12
|
+
tracer: TracerConfig;
|
|
13
|
+
}
|
|
14
|
+
interface Application {
|
|
15
|
+
tracer: Tracer;
|
|
16
|
+
}
|
|
17
|
+
interface Context {
|
|
18
|
+
tracer: Tracer;
|
|
19
|
+
traceId: string;
|
|
20
|
+
}
|
|
21
|
+
}
|
package/dist/types.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export {};
|
|
2
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHlwZXMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvdHlwZXMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IiJ9
|
|
1
|
+
export { };
|
package/package.json
CHANGED
|
@@ -1,45 +1,34 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eggjs/tracer",
|
|
3
|
-
"version": "4.0.0-beta.
|
|
4
|
-
"publishConfig": {
|
|
5
|
-
"access": "public"
|
|
6
|
-
},
|
|
3
|
+
"version": "4.0.0-beta.36",
|
|
7
4
|
"description": "tracer for egg",
|
|
8
5
|
"keywords": [
|
|
9
6
|
"egg",
|
|
10
7
|
"egg-plugin",
|
|
11
8
|
"eggPlugin",
|
|
12
|
-
"
|
|
13
|
-
"traceId",
|
|
9
|
+
"parentSpanId",
|
|
14
10
|
"spanId",
|
|
15
|
-
"
|
|
11
|
+
"traceId",
|
|
12
|
+
"tracer"
|
|
16
13
|
],
|
|
17
|
-
"
|
|
18
|
-
"type": "git",
|
|
19
|
-
"url": "git+https://github.com/eggjs/egg.git",
|
|
20
|
-
"directory": "plugins/tracer"
|
|
21
|
-
},
|
|
14
|
+
"homepage": "https://github.com/eggjs/egg/tree/next/plugins/tracer",
|
|
22
15
|
"bugs": {
|
|
23
16
|
"url": "https://github.com/eggjs/egg/issues"
|
|
24
17
|
},
|
|
25
|
-
"homepage": "https://github.com/eggjs/egg/tree/next/plugins/tracer",
|
|
26
|
-
"author": "fengmk2 <fengmk2@gmail.com> (https://github.com/fengmk2)",
|
|
27
18
|
"license": "MIT",
|
|
28
|
-
"
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
"
|
|
33
|
-
},
|
|
34
|
-
"devDependencies": {
|
|
35
|
-
"tsdown": "^0.17.0",
|
|
36
|
-
"typescript": "^5.9.3",
|
|
37
|
-
"vitest": "^4.0.15",
|
|
38
|
-
"@eggjs/mock": "7.0.0-beta.35",
|
|
39
|
-
"@eggjs/tsconfig": "3.1.0-beta.35",
|
|
40
|
-
"egg": "4.1.0-beta.35"
|
|
19
|
+
"author": "fengmk2 <fengmk2@gmail.com> (https://github.com/fengmk2)",
|
|
20
|
+
"repository": {
|
|
21
|
+
"type": "git",
|
|
22
|
+
"url": "git+https://github.com/eggjs/egg.git",
|
|
23
|
+
"directory": "plugins/tracer"
|
|
41
24
|
},
|
|
25
|
+
"files": [
|
|
26
|
+
"dist"
|
|
27
|
+
],
|
|
42
28
|
"type": "module",
|
|
29
|
+
"main": "./dist/index.js",
|
|
30
|
+
"module": "./dist/index.js",
|
|
31
|
+
"types": "./dist/index.d.ts",
|
|
43
32
|
"exports": {
|
|
44
33
|
".": "./dist/index.js",
|
|
45
34
|
"./agent": "./dist/agent.js",
|
|
@@ -53,16 +42,22 @@
|
|
|
53
42
|
"./types": "./dist/types.js",
|
|
54
43
|
"./package.json": "./package.json"
|
|
55
44
|
},
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
|
|
59
|
-
"
|
|
60
|
-
|
|
61
|
-
|
|
45
|
+
"publishConfig": {
|
|
46
|
+
"access": "public"
|
|
47
|
+
},
|
|
48
|
+
"devDependencies": {
|
|
49
|
+
"typescript": "^5.9.3",
|
|
50
|
+
"@eggjs/mock": "7.0.0-beta.36",
|
|
51
|
+
"egg": "4.1.0-beta.36",
|
|
52
|
+
"@eggjs/tsconfig": "3.1.0-beta.36"
|
|
53
|
+
},
|
|
54
|
+
"peerDependencies": {
|
|
55
|
+
"egg": "4.1.0-beta.36"
|
|
56
|
+
},
|
|
57
|
+
"engines": {
|
|
58
|
+
"node": ">=22.18.0"
|
|
59
|
+
},
|
|
62
60
|
"scripts": {
|
|
63
|
-
"
|
|
64
|
-
"typecheck": "tsc --noEmit",
|
|
65
|
-
"test": "vitest run",
|
|
66
|
-
"build": "tsdown && rimraf dist *.tsbuildinfo && tsc -p tsconfig.build.json"
|
|
61
|
+
"typecheck": "tsgo --noEmit"
|
|
67
62
|
}
|
|
68
63
|
}
|