@eggjs/tracer 4.0.0-beta.20 → 4.0.0-beta.21
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 +3 -8
- package/dist/app/extend/agent.d.ts +2 -4
- package/dist/app/extend/agent.js +3 -4
- package/dist/app/extend/application.d.ts +9 -3
- package/dist/app/extend/application.js +19 -3
- package/dist/app/extend/context.d.ts +9 -3
- package/dist/app/extend/context.js +15 -3
- package/dist/app.d.ts +2 -2
- package/dist/app.js +3 -8
- package/dist/boot.d.ts +6 -2
- package/dist/boot.js +14 -4
- package/dist/config/config.default.d.ts +8 -3
- package/dist/config/config.default.js +7 -4
- package/dist/index.d.ts +7 -7
- package/dist/index.js +8 -8
- package/dist/lib/tracer.d.ts +7 -2
- package/dist/lib/tracer.js +15 -3
- package/dist/types.d.ts +19 -3
- package/dist/types.js +2 -3
- package/package.json +5 -5
- package/dist/agent-BIRzex1X.d.ts +0 -1
- package/dist/agent-DMs8TuGb.js +0 -7
- package/dist/application-Bpc_jS36.d.ts +0 -12
- package/dist/application-Do2tZ6Ff.js +0 -19
- package/dist/boot-BHzaa8zz.js +0 -18
- package/dist/boot-DuVOgs2H.d.ts +0 -10
- package/dist/config.default-Cp2e1RDe.d.ts +0 -11
- package/dist/config.default-i_jeaXdB.js +0 -7
- package/dist/context-CPCWK8N6.js +0 -17
- package/dist/context-Ck5bPugW.d.ts +0 -12
- package/dist/tracer-BevLwEkm.js +0 -17
- package/dist/tracer-afyJeed0.d.ts +0 -11
- package/dist/types-BnPNhHXc.d.ts +0 -21
- package/dist/types-DnJpiSJb.js +0 -1
package/dist/agent.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { TracerBoot } from
|
|
2
|
-
export
|
|
1
|
+
import { TracerBoot } from './boot.ts';
|
|
2
|
+
export default TracerBoot;
|
package/dist/agent.js
CHANGED
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
import "./
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
//#region src/agent.ts
|
|
5
|
-
var agent_default = TracerBoot;
|
|
6
|
-
|
|
7
|
-
//#endregion
|
|
8
|
-
export { agent_default as default };
|
|
1
|
+
import { TracerBoot } from "./boot.js";
|
|
2
|
+
export default TracerBoot;
|
|
3
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYWdlbnQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvYWdlbnQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLFVBQVUsRUFBRSxNQUFNLFdBQVcsQ0FBQztBQUV2QyxlQUFlLFVBQVUsQ0FBQyJ9
|
|
@@ -1,4 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
import "../../agent-BIRzex1X.js";
|
|
4
|
-
export { TracerApplication as default };
|
|
1
|
+
import TracerApplication from './application.ts';
|
|
2
|
+
export default TracerApplication;
|
package/dist/app/extend/agent.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import "
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export { agent_default as default };
|
|
1
|
+
import TracerApplication from "./application.js";
|
|
2
|
+
export default TracerApplication;
|
|
3
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYWdlbnQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvYXBwL2V4dGVuZC9hZ2VudC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLGlCQUFpQixNQUFNLGtCQUFrQixDQUFDO0FBRWpELGVBQWUsaUJBQWlCLENBQUMifQ==
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
|
|
1
|
+
import { Application } from 'egg';
|
|
2
|
+
import type { Tracer } from '../../lib/tracer.ts';
|
|
3
|
+
declare const cacheTracer: unique symbol;
|
|
4
|
+
export declare const isReady: unique symbol;
|
|
5
|
+
export default class TracerApplication extends Application {
|
|
6
|
+
[cacheTracer]: Tracer | undefined;
|
|
7
|
+
get tracer(): Tracer;
|
|
8
|
+
}
|
|
9
|
+
export {};
|
|
@@ -1,3 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { debuglog } from 'node:util';
|
|
2
|
+
import { Application } from 'egg';
|
|
3
|
+
const debug = debuglog('egg/tracer/app/extend/application');
|
|
4
|
+
const cacheTracer = Symbol('before_ready_tracer');
|
|
5
|
+
export const isReady = Symbol('egg_tracer_is_ready');
|
|
6
|
+
export default class TracerApplication extends Application {
|
|
7
|
+
[cacheTracer];
|
|
8
|
+
get tracer() {
|
|
9
|
+
if (this[isReady]) {
|
|
10
|
+
return new this.config.tracer.Class(this.createAnonymousContext());
|
|
11
|
+
}
|
|
12
|
+
if (!this[cacheTracer]) {
|
|
13
|
+
this[cacheTracer] = new this.config.tracer.Class(this.createAnonymousContext());
|
|
14
|
+
}
|
|
15
|
+
debug('use cached tracer before ready, type: %o', this.type);
|
|
16
|
+
return this[cacheTracer];
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXBwbGljYXRpb24uanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvYXBwL2V4dGVuZC9hcHBsaWNhdGlvbi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsUUFBUSxFQUFFLE1BQU0sV0FBVyxDQUFDO0FBRXJDLE9BQU8sRUFBRSxXQUFXLEVBQUUsTUFBTSxLQUFLLENBQUM7QUFJbEMsTUFBTSxLQUFLLEdBQUcsUUFBUSxDQUFDLG1DQUFtQyxDQUFDLENBQUM7QUFFNUQsTUFBTSxXQUFXLEdBQUcsTUFBTSxDQUFDLHFCQUFxQixDQUFDLENBQUM7QUFDbEQsTUFBTSxDQUFDLE1BQU0sT0FBTyxHQUFHLE1BQU0sQ0FBQyxxQkFBcUIsQ0FBQyxDQUFDO0FBRXJELE1BQU0sQ0FBQyxPQUFPLE9BQU8saUJBQWtCLFNBQVEsV0FBVztJQUN4RCxDQUFDLFdBQVcsQ0FBQyxDQUFxQjtJQUVsQyxJQUFJLE1BQU07UUFDUixJQUFJLElBQUksQ0FBQyxPQUFPLENBQUMsRUFBRSxDQUFDO1lBQ2xCLE9BQU8sSUFBSSxJQUFJLENBQUMsTUFBTSxDQUFDLE1BQU0sQ0FBQyxLQUFLLENBQUMsSUFBSSxDQUFDLHNCQUFzQixFQUFFLENBQUMsQ0FBQztRQUNyRSxDQUFDO1FBRUQsSUFBSSxDQUFDLElBQUksQ0FBQyxXQUFXLENBQUMsRUFBRSxDQUFDO1lBQ3ZCLElBQUksQ0FBQyxXQUFXLENBQUMsR0FBRyxJQUFJLElBQUksQ0FBQyxNQUFNLENBQUMsTUFBTSxDQUFDLEtBQUssQ0FBQyxJQUFJLENBQUMsc0JBQXNCLEVBQUUsQ0FBQyxDQUFDO1FBQ2xGLENBQUM7UUFFRCxLQUFLLENBQUMsMENBQTBDLEVBQUUsSUFBSSxDQUFDLElBQUksQ0FBQyxDQUFDO1FBQzdELE9BQU8sSUFBSSxDQUFDLFdBQVcsQ0FBQyxDQUFDO0lBQzNCLENBQUM7Q0FDRiJ9
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
|
|
1
|
+
import { Context } from 'egg';
|
|
2
|
+
import type { Tracer } from '../../lib/tracer.ts';
|
|
3
|
+
declare const TRACER: unique symbol;
|
|
4
|
+
export default class TracerContext extends Context {
|
|
5
|
+
[TRACER]: Tracer | undefined;
|
|
6
|
+
get tracer(): Tracer;
|
|
7
|
+
get traceId(): string;
|
|
8
|
+
}
|
|
9
|
+
export {};
|
|
@@ -1,3 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export
|
|
1
|
+
import { Context } from 'egg';
|
|
2
|
+
const TRACER = Symbol('context tracer');
|
|
3
|
+
export default class TracerContext extends Context {
|
|
4
|
+
[TRACER];
|
|
5
|
+
get tracer() {
|
|
6
|
+
if (!this[TRACER]) {
|
|
7
|
+
this[TRACER] = new this.app.config.tracer.Class(this);
|
|
8
|
+
}
|
|
9
|
+
return this[TRACER];
|
|
10
|
+
}
|
|
11
|
+
get traceId() {
|
|
12
|
+
return this.tracer.traceId;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29udGV4dC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9hcHAvZXh0ZW5kL2NvbnRleHQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLE9BQU8sRUFBRSxNQUFNLEtBQUssQ0FBQztBQUk5QixNQUFNLE1BQU0sR0FBRyxNQUFNLENBQUMsZ0JBQWdCLENBQUMsQ0FBQztBQUV4QyxNQUFNLENBQUMsT0FBTyxPQUFPLGFBQWMsU0FBUSxPQUFPO0lBQ2hELENBQUMsTUFBTSxDQUFDLENBQXFCO0lBRTdCLElBQUksTUFBTTtRQUNSLElBQUksQ0FBQyxJQUFJLENBQUMsTUFBTSxDQUFDLEVBQUUsQ0FBQztZQUNsQixJQUFJLENBQUMsTUFBTSxDQUFDLEdBQUcsSUFBSSxJQUFJLENBQUMsR0FBRyxDQUFDLE1BQU0sQ0FBQyxNQUFNLENBQUMsS0FBSyxDQUFDLElBQUksQ0FBQyxDQUFDO1FBQ3hELENBQUM7UUFDRCxPQUFPLElBQUksQ0FBQyxNQUFNLENBQUMsQ0FBQztJQUN0QixDQUFDO0lBRUQsSUFBSSxPQUFPO1FBQ1QsT0FBTyxJQUFJLENBQUMsTUFBTSxDQUFDLE9BQU8sQ0FBQztJQUM3QixDQUFDO0NBQ0YifQ==
|
package/dist/app.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { TracerBoot } from
|
|
2
|
-
export
|
|
1
|
+
import { TracerBoot } from './boot.ts';
|
|
2
|
+
export default TracerBoot;
|
package/dist/app.js
CHANGED
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
import "./
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
//#region src/app.ts
|
|
5
|
-
var app_default = TracerBoot;
|
|
6
|
-
|
|
7
|
-
//#endregion
|
|
8
|
-
export { app_default as default };
|
|
1
|
+
import { TracerBoot } from "./boot.js";
|
|
2
|
+
export default TracerBoot;
|
|
3
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXBwLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vc3JjL2FwcC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsVUFBVSxFQUFFLE1BQU0sV0FBVyxDQUFDO0FBRXZDLGVBQWUsVUFBVSxDQUFDIn0=
|
package/dist/boot.d.ts
CHANGED
|
@@ -1,2 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export
|
|
1
|
+
import type { ILifecycleBoot, Application } from 'egg';
|
|
2
|
+
export declare class TracerBoot implements ILifecycleBoot {
|
|
3
|
+
private readonly app;
|
|
4
|
+
constructor(app: Application);
|
|
5
|
+
didLoad(): Promise<void>;
|
|
6
|
+
}
|
package/dist/boot.js
CHANGED
|
@@ -1,4 +1,14 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
export
|
|
1
|
+
import { debuglog } from 'node:util';
|
|
2
|
+
import { isReady } from "./app/extend/application.js";
|
|
3
|
+
const debug = debuglog('egg/tracer/boot');
|
|
4
|
+
export class TracerBoot {
|
|
5
|
+
app;
|
|
6
|
+
constructor(app) {
|
|
7
|
+
this.app = app;
|
|
8
|
+
}
|
|
9
|
+
async didLoad() {
|
|
10
|
+
debug('didLoad %o', this.app.type);
|
|
11
|
+
this.app[isReady] = true;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYm9vdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3NyYy9ib290LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxRQUFRLEVBQUUsTUFBTSxXQUFXLENBQUM7QUFJckMsT0FBTyxFQUFFLE9BQU8sRUFBRSxNQUFNLDZCQUE2QixDQUFDO0FBRXRELE1BQU0sS0FBSyxHQUFHLFFBQVEsQ0FBQyxpQkFBaUIsQ0FBQyxDQUFDO0FBRTFDLE1BQU0sT0FBTyxVQUFVO0lBQ0osR0FBRyxDQUFDO0lBQ3JCLFlBQVksR0FBZ0I7UUFDMUIsSUFBSSxDQUFDLEdBQUcsR0FBRyxHQUFHLENBQUM7SUFDakIsQ0FBQztJQUVELEtBQUssQ0FBQyxPQUFPO1FBQ1gsS0FBSyxDQUFDLFlBQVksRUFBRSxJQUFJLENBQUMsR0FBRyxDQUFDLElBQUksQ0FBQyxDQUFDO1FBQ25DLElBQUksQ0FBQyxHQUFHLENBQUMsT0FBTyxDQUFDLEdBQUcsSUFBSSxDQUFDO0lBQzNCLENBQUM7Q0FDRiJ9
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { Tracer } from '../lib/tracer.ts';
|
|
2
|
+
export interface TracerConfig {
|
|
3
|
+
Class: typeof Tracer;
|
|
4
|
+
}
|
|
5
|
+
declare const _default: {
|
|
6
|
+
tracer: TracerConfig;
|
|
7
|
+
};
|
|
8
|
+
export default _default;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import "../tracer
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { Tracer } from "../lib/tracer.js";
|
|
2
|
+
export default {
|
|
3
|
+
tracer: {
|
|
4
|
+
Class: Tracer,
|
|
5
|
+
},
|
|
6
|
+
};
|
|
7
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29uZmlnLmRlZmF1bHQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvY29uZmlnL2NvbmZpZy5kZWZhdWx0LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxNQUFNLEVBQUUsTUFBTSxrQkFBa0IsQ0FBQztBQU0xQyxlQUFlO0lBQ2IsTUFBTSxFQUFFO1FBQ04sS0FBSyxFQUFFLE1BQU07S0FDRTtDQUNsQixDQUFDIn0=
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
export { Tracer };
|
|
1
|
+
import './config/config.default.ts';
|
|
2
|
+
import './app/extend/application.ts';
|
|
3
|
+
import './app/extend/agent.ts';
|
|
4
|
+
import './app/extend/context.ts';
|
|
5
|
+
import './types.ts';
|
|
6
|
+
import { Tracer } from './lib/tracer.ts';
|
|
7
|
+
export { Tracer };
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import "./
|
|
2
|
-
import
|
|
3
|
-
import "./
|
|
4
|
-
import "./
|
|
5
|
-
import "./
|
|
6
|
-
import "./
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import "./config/config.default.js";
|
|
2
|
+
import "./app/extend/application.js";
|
|
3
|
+
import "./app/extend/agent.js";
|
|
4
|
+
import "./app/extend/context.js";
|
|
5
|
+
import "./types.js";
|
|
6
|
+
import { Tracer } from "./lib/tracer.js";
|
|
7
|
+
export { Tracer };
|
|
8
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyw0QkFBNEIsQ0FBQztBQUNwQyxPQUFPLDZCQUE2QixDQUFDO0FBQ3JDLE9BQU8sdUJBQXVCLENBQUM7QUFDL0IsT0FBTyx5QkFBeUIsQ0FBQztBQUNqQyxPQUFPLFlBQVksQ0FBQztBQUVwQixPQUFPLEVBQUUsTUFBTSxFQUFFLE1BQU0saUJBQWlCLENBQUM7QUFFekMsT0FBTyxFQUFFLE1BQU0sRUFBRSxDQUFDIn0=
|
package/dist/lib/tracer.d.ts
CHANGED
package/dist/lib/tracer.js
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { randomUUID } from 'node:crypto';
|
|
2
|
+
export class Tracer {
|
|
3
|
+
ctx;
|
|
4
|
+
#traceId;
|
|
5
|
+
constructor(ctx) {
|
|
6
|
+
this.ctx = ctx;
|
|
7
|
+
}
|
|
8
|
+
get traceId() {
|
|
9
|
+
if (!this.#traceId) {
|
|
10
|
+
this.#traceId = randomUUID();
|
|
11
|
+
}
|
|
12
|
+
return this.#traceId;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHJhY2VyLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2xpYi90cmFjZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLFVBQVUsRUFBRSxNQUFNLGFBQWEsQ0FBQztBQUl6QyxNQUFNLE9BQU8sTUFBTTtJQUNSLEdBQUcsQ0FBVTtJQUN0QixRQUFRLENBQXFCO0lBRTdCLFlBQVksR0FBWTtRQUN0QixJQUFJLENBQUMsR0FBRyxHQUFHLEdBQUcsQ0FBQztJQUNqQixDQUFDO0lBRUQsSUFBSSxPQUFPO1FBQ1QsSUFBSSxDQUFDLElBQUksQ0FBQyxRQUFRLEVBQUUsQ0FBQztZQUNuQixJQUFJLENBQUMsUUFBUSxHQUFHLFVBQVUsRUFBRSxDQUFDO1FBQy9CLENBQUM7UUFDRCxPQUFPLElBQUksQ0FBQyxRQUFRLENBQUM7SUFDdkIsQ0FBQztDQUNGIn0=
|
package/dist/types.d.ts
CHANGED
|
@@ -1,3 +1,19 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
1
|
+
import type { TracerConfig } from './config/config.default.ts';
|
|
2
|
+
import type { Tracer } from './lib/tracer.ts';
|
|
3
|
+
declare module 'egg' {
|
|
4
|
+
interface EggAppConfig {
|
|
5
|
+
/**
|
|
6
|
+
* tracer config
|
|
7
|
+
* @member Config#tracer
|
|
8
|
+
* @property {Tracer} Class - tracer class name
|
|
9
|
+
*/
|
|
10
|
+
tracer: TracerConfig;
|
|
11
|
+
}
|
|
12
|
+
interface Application {
|
|
13
|
+
tracer: Tracer;
|
|
14
|
+
}
|
|
15
|
+
interface Context {
|
|
16
|
+
tracer: Tracer;
|
|
17
|
+
traceId: string;
|
|
18
|
+
}
|
|
19
|
+
}
|
package/dist/types.js
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export { };
|
|
1
|
+
export {};
|
|
2
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHlwZXMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvdHlwZXMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IiJ9
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eggjs/tracer",
|
|
3
|
-
"version": "4.0.0-beta.
|
|
3
|
+
"version": "4.0.0-beta.21",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -33,14 +33,14 @@
|
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {},
|
|
35
35
|
"peerDependencies": {
|
|
36
|
-
"egg": "4.1.0-beta.
|
|
36
|
+
"egg": "4.1.0-beta.21"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"tsdown": "^0.15.4",
|
|
40
40
|
"typescript": "^5.9.3",
|
|
41
41
|
"vitest": "4.0.0-beta.16",
|
|
42
|
-
"@eggjs/
|
|
43
|
-
"@eggjs/
|
|
42
|
+
"@eggjs/tsconfig": "3.1.0-beta.21",
|
|
43
|
+
"@eggjs/mock": "7.0.0-beta.21"
|
|
44
44
|
},
|
|
45
45
|
"type": "module",
|
|
46
46
|
"exports": {
|
|
@@ -66,6 +66,6 @@
|
|
|
66
66
|
"lint": "oxlint --type-aware",
|
|
67
67
|
"typecheck": "tsc --noEmit",
|
|
68
68
|
"test": "vitest run",
|
|
69
|
-
"build": "tsdown"
|
|
69
|
+
"build": "tsdown && rimraf dist && tsc -b --clean && tsc"
|
|
70
70
|
}
|
|
71
71
|
}
|
package/dist/agent-BIRzex1X.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { };
|
package/dist/agent-DMs8TuGb.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { Tracer } from "./tracer-afyJeed0.js";
|
|
2
|
-
import { Application } from "egg";
|
|
3
|
-
|
|
4
|
-
//#region src/app/extend/application.d.ts
|
|
5
|
-
declare const cacheTracer: unique symbol;
|
|
6
|
-
declare const isReady: unique symbol;
|
|
7
|
-
declare class TracerApplication extends Application {
|
|
8
|
-
[cacheTracer]: Tracer | undefined;
|
|
9
|
-
get tracer(): Tracer;
|
|
10
|
-
}
|
|
11
|
-
//#endregion
|
|
12
|
-
export { TracerApplication, isReady };
|
|
@@ -1,19 +0,0 @@
|
|
|
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
|
-
[cacheTracer];
|
|
10
|
-
get tracer() {
|
|
11
|
-
if (this[isReady]) return new this.config.tracer.Class(this.createAnonymousContext());
|
|
12
|
-
if (!this[cacheTracer]) this[cacheTracer] = new this.config.tracer.Class(this.createAnonymousContext());
|
|
13
|
-
debug("use cached tracer before ready, type: %o", this.type);
|
|
14
|
-
return this[cacheTracer];
|
|
15
|
-
}
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
//#endregion
|
|
19
|
-
export { TracerApplication, isReady };
|
package/dist/boot-BHzaa8zz.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { isReady } from "./application-Do2tZ6Ff.js";
|
|
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 };
|
package/dist/boot-DuVOgs2H.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
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>;
|
|
8
|
-
}
|
|
9
|
-
//#endregion
|
|
10
|
-
export { TracerBoot };
|
package/dist/context-CPCWK8N6.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
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
|
-
[TRACER];
|
|
7
|
-
get tracer() {
|
|
8
|
-
if (!this[TRACER]) this[TRACER] = new this.app.config.tracer.Class(this);
|
|
9
|
-
return this[TRACER];
|
|
10
|
-
}
|
|
11
|
-
get traceId() {
|
|
12
|
-
return this.tracer.traceId;
|
|
13
|
-
}
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
//#endregion
|
|
17
|
-
export { TracerContext };
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { Tracer } from "./tracer-afyJeed0.js";
|
|
2
|
-
import { Context } from "egg";
|
|
3
|
-
|
|
4
|
-
//#region src/app/extend/context.d.ts
|
|
5
|
-
declare const TRACER: unique symbol;
|
|
6
|
-
declare class TracerContext extends Context {
|
|
7
|
-
[TRACER]: Tracer | undefined;
|
|
8
|
-
get tracer(): Tracer;
|
|
9
|
-
get traceId(): string;
|
|
10
|
-
}
|
|
11
|
-
//#endregion
|
|
12
|
-
export { TracerContext };
|
package/dist/tracer-BevLwEkm.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
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-BnPNhHXc.d.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { Tracer } from "./tracer-afyJeed0.js";
|
|
2
|
-
import { TracerConfig } from "./config.default-Cp2e1RDe.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-DnJpiSJb.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { };
|