@webtypen/webframez-core 0.3.15 → 0.3.16
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/ConsoleApplication.js +3 -4
- package/dist/Telemetry/SigNozTelemetry.d.ts +0 -33
- package/dist/Telemetry/SigNozTelemetry.js +234 -252
- package/dist/WebApplication.js +7 -7
- package/dist/index.d.ts +0 -2
- package/dist/index.js +2 -2
- package/package.json +1 -1
- package/src/ConsoleApplication.ts +3 -4
- package/src/Telemetry/SigNozTelemetry.ts +268 -260
- package/src/WebApplication.ts +7 -7
- package/src/index.ts +2 -2
|
@@ -23,7 +23,6 @@ const QueueStopCommand_1 = require("./Commands/QueueStopCommand");
|
|
|
23
23
|
const QueueLogCommand_1 = require("./Commands/QueueLogCommand");
|
|
24
24
|
const QueueWorkerAutorestartCommand_1 = require("./Commands/QueueWorkerAutorestartCommand");
|
|
25
25
|
const info_1 = require("./info");
|
|
26
|
-
const SigNozTelemetry_1 = require("./Telemetry/SigNozTelemetry");
|
|
27
26
|
class ConsoleApplication {
|
|
28
27
|
constructor() {
|
|
29
28
|
this.systemCommands = [
|
|
@@ -45,9 +44,9 @@ class ConsoleApplication {
|
|
|
45
44
|
Config_1.Config.register(key, options.config[key]);
|
|
46
45
|
}
|
|
47
46
|
}
|
|
48
|
-
if (options && options.signoz) {
|
|
49
|
-
|
|
50
|
-
}
|
|
47
|
+
// if (options && options.signoz) {
|
|
48
|
+
// void SigNozTelemetry.init(options.signoz);
|
|
49
|
+
// }
|
|
51
50
|
if (options && options.datatables) {
|
|
52
51
|
DatatableRegistry_1.DatatableRegistry.registerMany(options.datatables);
|
|
53
52
|
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
export interface SigNozOptions {
|
|
2
|
-
enabled?: boolean;
|
|
3
|
-
serviceName?: string;
|
|
4
|
-
endpoint?: string;
|
|
5
|
-
apiKey?: string;
|
|
6
|
-
headers?: Record<string, string>;
|
|
7
|
-
environment?: string;
|
|
8
|
-
resourceAttributes?: Record<string, unknown>;
|
|
9
|
-
samplingRatio?: number;
|
|
10
|
-
instrumentations?: any[];
|
|
11
|
-
autoInstrumentations?: boolean;
|
|
12
|
-
autoInstrumentationConfig?: Record<string, unknown>;
|
|
13
|
-
logInitialization?: boolean;
|
|
14
|
-
}
|
|
15
|
-
export declare class SigNozTelemetry {
|
|
16
|
-
private static sdk;
|
|
17
|
-
private static initPromise;
|
|
18
|
-
private static shutdownRegistered;
|
|
19
|
-
private static readonly missingDependencies;
|
|
20
|
-
private static readonly shutdownListener;
|
|
21
|
-
static init(options?: SigNozOptions): Promise<void>;
|
|
22
|
-
private static initialize;
|
|
23
|
-
static shutdown(): Promise<void>;
|
|
24
|
-
private static safeImport;
|
|
25
|
-
private static ensureEndpoint;
|
|
26
|
-
private static warnMissingDependency;
|
|
27
|
-
private static registerShutdownHooks;
|
|
28
|
-
private static getProcess;
|
|
29
|
-
private static getEnv;
|
|
30
|
-
private static getConsole;
|
|
31
|
-
private static logInfo;
|
|
32
|
-
private static logWarn;
|
|
33
|
-
}
|
|
@@ -1,253 +1,235 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
target.info(...args);
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
static logWarn(...args) {
|
|
240
|
-
const target = this.getConsole();
|
|
241
|
-
if (target && typeof target.warn === "function") {
|
|
242
|
-
target.warn(...args);
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
exports.SigNozTelemetry = SigNozTelemetry;
|
|
247
|
-
SigNozTelemetry.sdk = null;
|
|
248
|
-
SigNozTelemetry.initPromise = null;
|
|
249
|
-
SigNozTelemetry.shutdownRegistered = false;
|
|
250
|
-
SigNozTelemetry.missingDependencies = new Set();
|
|
251
|
-
SigNozTelemetry.shutdownListener = () => {
|
|
252
|
-
void SigNozTelemetry.shutdown();
|
|
253
|
-
};
|
|
2
|
+
// import { NodeSDK } from "@opentelemetry/sdk-node";
|
|
3
|
+
// import { OTLPTraceExporter } from "@opentelemetry/exporter-trace-otlp-http";
|
|
4
|
+
// import { Resource } from "@opentelemetry/resources";
|
|
5
|
+
// import { SemanticResourceAttributes } from "@opentelemetry/semantic-conventions";
|
|
6
|
+
// import { ParentBasedSampler, TraceIdRatioBasedSampler } from "@opentelemetry/sdk-trace-base";
|
|
7
|
+
// import { Config } from "../Config";
|
|
8
|
+
// export interface SigNozOptions {
|
|
9
|
+
// enabled?: boolean;
|
|
10
|
+
// serviceName?: string;
|
|
11
|
+
// endpoint?: string;
|
|
12
|
+
// apiKey?: string;
|
|
13
|
+
// headers?: Record<string, string>;
|
|
14
|
+
// environment?: string;
|
|
15
|
+
// resourceAttributes?: Record<string, unknown>;
|
|
16
|
+
// samplingRatio?: number;
|
|
17
|
+
// instrumentations?: any[];
|
|
18
|
+
// autoInstrumentations?: boolean;
|
|
19
|
+
// autoInstrumentationConfig?: Record<string, unknown>;
|
|
20
|
+
// logInitialization?: boolean;
|
|
21
|
+
// }
|
|
22
|
+
// export class SigNozTelemetry {
|
|
23
|
+
// private static sdk: NodeSDK | null = null;
|
|
24
|
+
// private static initPromise: Promise<void> | null = null;
|
|
25
|
+
// private static shutdownRegistered = false;
|
|
26
|
+
// private static readonly missingDependencies = new Set<string>();
|
|
27
|
+
// private static readonly shutdownListener = () => {
|
|
28
|
+
// void SigNozTelemetry.shutdown();
|
|
29
|
+
// };
|
|
30
|
+
// static async init(options?: SigNozOptions): Promise<void> {
|
|
31
|
+
// if (!options || options.enabled === false) {
|
|
32
|
+
// return;
|
|
33
|
+
// }
|
|
34
|
+
// if (this.sdk) {
|
|
35
|
+
// return;
|
|
36
|
+
// }
|
|
37
|
+
// if (this.initPromise) {
|
|
38
|
+
// await this.initPromise;
|
|
39
|
+
// return;
|
|
40
|
+
// }
|
|
41
|
+
// console.log("signoz init 1");
|
|
42
|
+
// const initialization = (async () => {
|
|
43
|
+
// try {
|
|
44
|
+
// await this.initialize(options);
|
|
45
|
+
// } catch (error) {
|
|
46
|
+
// this.logWarn("[SigNoz] Initialization failed:", error);
|
|
47
|
+
// }
|
|
48
|
+
// })();
|
|
49
|
+
// console.log("signoz init 2");
|
|
50
|
+
// this.initPromise = initialization;
|
|
51
|
+
// try {
|
|
52
|
+
// await initialization;
|
|
53
|
+
// } finally {
|
|
54
|
+
// this.initPromise = null;
|
|
55
|
+
// }
|
|
56
|
+
// console.log("signoz init finish");
|
|
57
|
+
// }
|
|
58
|
+
// private static async initialize(options: SigNozOptions): Promise<void> {
|
|
59
|
+
// console.log("signoz initialize 1");
|
|
60
|
+
// const serviceName =
|
|
61
|
+
// options.serviceName ||
|
|
62
|
+
// (Config.get("application.serviceName") as string) ||
|
|
63
|
+
// (Config.get("application.name") as string) ||
|
|
64
|
+
// this.getEnv("SIGNOZ_SERVICE_NAME") ||
|
|
65
|
+
// this.getEnv("OTEL_SERVICE_NAME") ||
|
|
66
|
+
// "webframez-service";
|
|
67
|
+
// const environment =
|
|
68
|
+
// options.environment ||
|
|
69
|
+
// (Config.get("application.environment") as string) ||
|
|
70
|
+
// this.getEnv("SIGNOZ_ENVIRONMENT") ||
|
|
71
|
+
// this.getEnv("NODE_ENV") ||
|
|
72
|
+
// "development";
|
|
73
|
+
// const traceEndpoint = this.ensureEndpoint(
|
|
74
|
+
// options.endpoint ||
|
|
75
|
+
// this.getEnv("SIGNOZ_ENDPOINT") ||
|
|
76
|
+
// this.getEnv("OTEL_EXPORTER_OTLP_TRACES_ENDPOINT") ||
|
|
77
|
+
// this.getEnv("OTEL_EXPORTER_OTLP_ENDPOINT"),
|
|
78
|
+
// "http://localhost:4318",
|
|
79
|
+
// "/v1/traces"
|
|
80
|
+
// );
|
|
81
|
+
// console.log("signoz initialize 2");
|
|
82
|
+
// const headers = { ...(options.headers || {}) };
|
|
83
|
+
// const apiKey = options.apiKey || this.getEnv("SIGNOZ_API_KEY");
|
|
84
|
+
// if (apiKey && !headers["signoz-access-token"]) {
|
|
85
|
+
// headers["signoz-access-token"] = apiKey;
|
|
86
|
+
// }
|
|
87
|
+
// const resourceAttributes: Record<string, unknown> = {
|
|
88
|
+
// [SemanticResourceAttributes.SERVICE_NAME]: serviceName,
|
|
89
|
+
// [SemanticResourceAttributes.DEPLOYMENT_ENVIRONMENT]: environment,
|
|
90
|
+
// };
|
|
91
|
+
// if (options.resourceAttributes) {
|
|
92
|
+
// Object.assign(resourceAttributes, options.resourceAttributes);
|
|
93
|
+
// }
|
|
94
|
+
// console.log("signoz initialize 3");
|
|
95
|
+
// const resource = new Resource(resourceAttributes);
|
|
96
|
+
// let instrumentations = options.instrumentations ? [...options.instrumentations] : [];
|
|
97
|
+
// if (instrumentations.length === 0 && options.autoInstrumentations !== false) {
|
|
98
|
+
// const autoInstrumentation = this.loadAutoInstrumentations(options.autoInstrumentationConfig || {});
|
|
99
|
+
// if (autoInstrumentation) {
|
|
100
|
+
// instrumentations = [autoInstrumentation];
|
|
101
|
+
// }
|
|
102
|
+
// }
|
|
103
|
+
// console.log("signoz initialize 4");
|
|
104
|
+
// let traceSampler: ParentBasedSampler | undefined;
|
|
105
|
+
// if (typeof options.samplingRatio === "number") {
|
|
106
|
+
// const ratio = Math.min(Math.max(options.samplingRatio, 0), 1);
|
|
107
|
+
// traceSampler = new ParentBasedSampler({
|
|
108
|
+
// root: new TraceIdRatioBasedSampler(ratio),
|
|
109
|
+
// });
|
|
110
|
+
// }
|
|
111
|
+
// console.log("signoz initialize 5");
|
|
112
|
+
// const traceExporter = new OTLPTraceExporter({
|
|
113
|
+
// url: traceEndpoint,
|
|
114
|
+
// headers,
|
|
115
|
+
// });
|
|
116
|
+
// const sdkOptions: {
|
|
117
|
+
// resource: Resource;
|
|
118
|
+
// traceExporter: OTLPTraceExporter;
|
|
119
|
+
// instrumentations?: any[];
|
|
120
|
+
// traceSampler?: ParentBasedSampler;
|
|
121
|
+
// } = {
|
|
122
|
+
// resource,
|
|
123
|
+
// traceExporter,
|
|
124
|
+
// };
|
|
125
|
+
// if (instrumentations.length > 0) {
|
|
126
|
+
// sdkOptions.instrumentations = instrumentations;
|
|
127
|
+
// }
|
|
128
|
+
// if (traceSampler) {
|
|
129
|
+
// sdkOptions.traceSampler = traceSampler;
|
|
130
|
+
// }
|
|
131
|
+
// console.log("signoz initialize 6");
|
|
132
|
+
// this.sdk = new NodeSDK(sdkOptions as any);
|
|
133
|
+
// await this.sdk.start();
|
|
134
|
+
// if (options.logInitialization !== false) {
|
|
135
|
+
// this.logInfo(`[SigNoz] Telemetry enabled (service="${serviceName}", endpoint="${traceEndpoint}")`);
|
|
136
|
+
// }
|
|
137
|
+
// console.log("signoz initialize 7");
|
|
138
|
+
// this.registerShutdownHooks();
|
|
139
|
+
// console.log("signoz initialize 8");
|
|
140
|
+
// }
|
|
141
|
+
// static async shutdown(): Promise<void> {
|
|
142
|
+
// if (!this.sdk) {
|
|
143
|
+
// return;
|
|
144
|
+
// }
|
|
145
|
+
// const sdkToShutdown = this.sdk;
|
|
146
|
+
// this.sdk = null;
|
|
147
|
+
// try {
|
|
148
|
+
// await sdkToShutdown.shutdown();
|
|
149
|
+
// } catch (error) {
|
|
150
|
+
// this.logWarn("[SigNoz] Shutdown failed:", error);
|
|
151
|
+
// }
|
|
152
|
+
// }
|
|
153
|
+
// private static ensureEndpoint(value: string | undefined, fallbackHost: string, defaultPath: string): string {
|
|
154
|
+
// const base = value && value.trim() !== "" ? value.trim() : fallbackHost;
|
|
155
|
+
// if (base.includes("/v1/") || base.endsWith(defaultPath)) {
|
|
156
|
+
// return base;
|
|
157
|
+
// }
|
|
158
|
+
// return `${base.replace(/\/$/, "")}${defaultPath}`;
|
|
159
|
+
// }
|
|
160
|
+
// private static warnMissingDependency(name: string) {
|
|
161
|
+
// if (this.missingDependencies.has(name)) {
|
|
162
|
+
// return;
|
|
163
|
+
// }
|
|
164
|
+
// this.missingDependencies.add(name);
|
|
165
|
+
// this.logWarn(`[SigNoz] Optional package "${name}" not found. Install it to enable the related feature.`);
|
|
166
|
+
// }
|
|
167
|
+
// private static loadAutoInstrumentations(config: Record<string, unknown>): any | null {
|
|
168
|
+
// if (typeof require !== "function") {
|
|
169
|
+
// return null;
|
|
170
|
+
// }
|
|
171
|
+
// try {
|
|
172
|
+
// // eslint-disable-next-line @typescript-eslint/no-var-requires,@typescript-eslint/no-unsafe-assignment
|
|
173
|
+
// const module = require("@opentelemetry/auto-instrumentations-node");
|
|
174
|
+
// if (module && typeof module.getNodeAutoInstrumentations === "function") {
|
|
175
|
+
// return module.getNodeAutoInstrumentations(config);
|
|
176
|
+
// }
|
|
177
|
+
// this.warnMissingDependency("@opentelemetry/auto-instrumentations-node");
|
|
178
|
+
// return null;
|
|
179
|
+
// } catch (error: any) {
|
|
180
|
+
// if (error && (error.code === "MODULE_NOT_FOUND" || error.code === "ERR_MODULE_NOT_FOUND")) {
|
|
181
|
+
// this.warnMissingDependency("@opentelemetry/auto-instrumentations-node");
|
|
182
|
+
// return null;
|
|
183
|
+
// }
|
|
184
|
+
// throw error;
|
|
185
|
+
// }
|
|
186
|
+
// }
|
|
187
|
+
// private static registerShutdownHooks() {
|
|
188
|
+
// if (this.shutdownRegistered) {
|
|
189
|
+
// return;
|
|
190
|
+
// }
|
|
191
|
+
// const nodeProcess = this.getProcess();
|
|
192
|
+
// if (!nodeProcess) {
|
|
193
|
+
// return;
|
|
194
|
+
// }
|
|
195
|
+
// nodeProcess.once("beforeExit", this.shutdownListener);
|
|
196
|
+
// nodeProcess.once("exit", this.shutdownListener);
|
|
197
|
+
// this.shutdownRegistered = true;
|
|
198
|
+
// }
|
|
199
|
+
// private static getProcess(): any {
|
|
200
|
+
// if (typeof globalThis === "undefined") {
|
|
201
|
+
// return undefined;
|
|
202
|
+
// }
|
|
203
|
+
// const candidate = (globalThis as any).process;
|
|
204
|
+
// if (candidate && typeof candidate.once === "function") {
|
|
205
|
+
// return candidate;
|
|
206
|
+
// }
|
|
207
|
+
// return undefined;
|
|
208
|
+
// }
|
|
209
|
+
// private static getEnv(key: string): string | undefined {
|
|
210
|
+
// const nodeProcess = this.getProcess();
|
|
211
|
+
// if (!nodeProcess || !nodeProcess.env) {
|
|
212
|
+
// return undefined;
|
|
213
|
+
// }
|
|
214
|
+
// const value = nodeProcess.env[key];
|
|
215
|
+
// return typeof value === "string" ? value : undefined;
|
|
216
|
+
// }
|
|
217
|
+
// private static getConsole(): any {
|
|
218
|
+
// if (typeof globalThis === "undefined") {
|
|
219
|
+
// return undefined;
|
|
220
|
+
// }
|
|
221
|
+
// return (globalThis as any).console;
|
|
222
|
+
// }
|
|
223
|
+
// private static logInfo(...args: unknown[]) {
|
|
224
|
+
// const target = this.getConsole();
|
|
225
|
+
// if (target && typeof target.info === "function") {
|
|
226
|
+
// target.info(...args);
|
|
227
|
+
// }
|
|
228
|
+
// }
|
|
229
|
+
// private static logWarn(...args: unknown[]) {
|
|
230
|
+
// const target = this.getConsole();
|
|
231
|
+
// if (target && typeof target.warn === "function") {
|
|
232
|
+
// target.warn(...args);
|
|
233
|
+
// }
|
|
234
|
+
// }
|
|
235
|
+
// }
|
package/dist/WebApplication.js
CHANGED
|
@@ -11,7 +11,7 @@ const Router_1 = require("./Router/Router");
|
|
|
11
11
|
const QueueJobsRegisty_1 = require("./Queue/QueueJobsRegisty");
|
|
12
12
|
const DatatableRegistry_1 = require("./Datatable/DatatableRegistry");
|
|
13
13
|
const ModulesLoader_1 = require("./Modules/ModulesLoader");
|
|
14
|
-
|
|
14
|
+
// import { SigNozTelemetry } from "./Telemetry/SigNozTelemetry";
|
|
15
15
|
class WebApplication {
|
|
16
16
|
constructor() {
|
|
17
17
|
this.modulesLoader = null;
|
|
@@ -25,9 +25,9 @@ class WebApplication {
|
|
|
25
25
|
Config_1.Config.register(key, options.config[key]);
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
|
-
if (options && options.signoz) {
|
|
29
|
-
|
|
30
|
-
}
|
|
28
|
+
// if (options && options.signoz) {
|
|
29
|
+
// void SigNozTelemetry.init(options.signoz);
|
|
30
|
+
// }
|
|
31
31
|
this.modulesLoader = new ModulesLoader_1.ModulesLoader();
|
|
32
32
|
this.modulesLoader.load(options && options.modules ? options.modules : []);
|
|
33
33
|
if (options && options.kernel) {
|
|
@@ -51,9 +51,9 @@ class WebApplication {
|
|
|
51
51
|
this.server = http_1.default.createServer((req, res) => {
|
|
52
52
|
Router_1.Router.handleRequest(req, res);
|
|
53
53
|
});
|
|
54
|
-
this.server.on("close", () => {
|
|
55
|
-
|
|
56
|
-
});
|
|
54
|
+
// this.server.on("close", () => {
|
|
55
|
+
// void SigNozTelemetry.shutdown();
|
|
56
|
+
// });
|
|
57
57
|
this.server.listen(port, () => {
|
|
58
58
|
const runtimeConsole = typeof globalThis !== "undefined" ? globalThis.console : undefined;
|
|
59
59
|
if (runtimeConsole && typeof runtimeConsole.log === "function") {
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -47,5 +47,5 @@ __exportStar(require("./Queue/QueueJob"), exports);
|
|
|
47
47
|
__exportStar(require("./Queue/QueueJobsRegisty"), exports);
|
|
48
48
|
__exportStar(require("./Commands/ConsoleOutputHelper"), exports);
|
|
49
49
|
__exportStar(require("./Modules/ModuleProvider"), exports);
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
// export * from "./Telemetry/SigNozTelemetry";
|
|
51
|
+
// export * from "./info";
|
package/package.json
CHANGED
|
@@ -11,7 +11,6 @@ import { QueueStopCommand } from "./Commands/QueueStopCommand";
|
|
|
11
11
|
import { QueueLogCommand } from "./Commands/QueueLogCommand";
|
|
12
12
|
import { QueueWorkerAutorestartCommand } from "./Commands/QueueWorkerAutorestartCommand";
|
|
13
13
|
import { WebframezInfo } from "./info";
|
|
14
|
-
import { SigNozTelemetry } from "./Telemetry/SigNozTelemetry";
|
|
15
14
|
|
|
16
15
|
export class ConsoleApplication {
|
|
17
16
|
systemCommands: any = [
|
|
@@ -34,9 +33,9 @@ export class ConsoleApplication {
|
|
|
34
33
|
}
|
|
35
34
|
}
|
|
36
35
|
|
|
37
|
-
if (options && options.signoz) {
|
|
38
|
-
|
|
39
|
-
}
|
|
36
|
+
// if (options && options.signoz) {
|
|
37
|
+
// void SigNozTelemetry.init(options.signoz);
|
|
38
|
+
// }
|
|
40
39
|
|
|
41
40
|
if (options && options.datatables) {
|
|
42
41
|
DatatableRegistry.registerMany(options.datatables);
|
|
@@ -1,260 +1,268 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
}
|
|
1
|
+
// import { NodeSDK } from "@opentelemetry/sdk-node";
|
|
2
|
+
// import { OTLPTraceExporter } from "@opentelemetry/exporter-trace-otlp-http";
|
|
3
|
+
// import { Resource } from "@opentelemetry/resources";
|
|
4
|
+
// import { SemanticResourceAttributes } from "@opentelemetry/semantic-conventions";
|
|
5
|
+
// import { ParentBasedSampler, TraceIdRatioBasedSampler } from "@opentelemetry/sdk-trace-base";
|
|
6
|
+
// import { Config } from "../Config";
|
|
7
|
+
|
|
8
|
+
// export interface SigNozOptions {
|
|
9
|
+
// enabled?: boolean;
|
|
10
|
+
// serviceName?: string;
|
|
11
|
+
// endpoint?: string;
|
|
12
|
+
// apiKey?: string;
|
|
13
|
+
// headers?: Record<string, string>;
|
|
14
|
+
// environment?: string;
|
|
15
|
+
// resourceAttributes?: Record<string, unknown>;
|
|
16
|
+
// samplingRatio?: number;
|
|
17
|
+
// instrumentations?: any[];
|
|
18
|
+
// autoInstrumentations?: boolean;
|
|
19
|
+
// autoInstrumentationConfig?: Record<string, unknown>;
|
|
20
|
+
// logInitialization?: boolean;
|
|
21
|
+
// }
|
|
22
|
+
|
|
23
|
+
// export class SigNozTelemetry {
|
|
24
|
+
// private static sdk: NodeSDK | null = null;
|
|
25
|
+
// private static initPromise: Promise<void> | null = null;
|
|
26
|
+
// private static shutdownRegistered = false;
|
|
27
|
+
// private static readonly missingDependencies = new Set<string>();
|
|
28
|
+
// private static readonly shutdownListener = () => {
|
|
29
|
+
// void SigNozTelemetry.shutdown();
|
|
30
|
+
// };
|
|
31
|
+
|
|
32
|
+
// static async init(options?: SigNozOptions): Promise<void> {
|
|
33
|
+
// if (!options || options.enabled === false) {
|
|
34
|
+
// return;
|
|
35
|
+
// }
|
|
36
|
+
// if (this.sdk) {
|
|
37
|
+
// return;
|
|
38
|
+
// }
|
|
39
|
+
// if (this.initPromise) {
|
|
40
|
+
// await this.initPromise;
|
|
41
|
+
// return;
|
|
42
|
+
// }
|
|
43
|
+
|
|
44
|
+
// console.log("signoz init 1");
|
|
45
|
+
// const initialization = (async () => {
|
|
46
|
+
// try {
|
|
47
|
+
// await this.initialize(options);
|
|
48
|
+
// } catch (error) {
|
|
49
|
+
// this.logWarn("[SigNoz] Initialization failed:", error);
|
|
50
|
+
// }
|
|
51
|
+
// })();
|
|
52
|
+
// console.log("signoz init 2");
|
|
53
|
+
|
|
54
|
+
// this.initPromise = initialization;
|
|
55
|
+
|
|
56
|
+
// try {
|
|
57
|
+
// await initialization;
|
|
58
|
+
// } finally {
|
|
59
|
+
// this.initPromise = null;
|
|
60
|
+
// }
|
|
61
|
+
// console.log("signoz init finish");
|
|
62
|
+
// }
|
|
63
|
+
|
|
64
|
+
// private static async initialize(options: SigNozOptions): Promise<void> {
|
|
65
|
+
// console.log("signoz initialize 1");
|
|
66
|
+
// const serviceName =
|
|
67
|
+
// options.serviceName ||
|
|
68
|
+
// (Config.get("application.serviceName") as string) ||
|
|
69
|
+
// (Config.get("application.name") as string) ||
|
|
70
|
+
// this.getEnv("SIGNOZ_SERVICE_NAME") ||
|
|
71
|
+
// this.getEnv("OTEL_SERVICE_NAME") ||
|
|
72
|
+
// "webframez-service";
|
|
73
|
+
|
|
74
|
+
// const environment =
|
|
75
|
+
// options.environment ||
|
|
76
|
+
// (Config.get("application.environment") as string) ||
|
|
77
|
+
// this.getEnv("SIGNOZ_ENVIRONMENT") ||
|
|
78
|
+
// this.getEnv("NODE_ENV") ||
|
|
79
|
+
// "development";
|
|
80
|
+
|
|
81
|
+
// const traceEndpoint = this.ensureEndpoint(
|
|
82
|
+
// options.endpoint ||
|
|
83
|
+
// this.getEnv("SIGNOZ_ENDPOINT") ||
|
|
84
|
+
// this.getEnv("OTEL_EXPORTER_OTLP_TRACES_ENDPOINT") ||
|
|
85
|
+
// this.getEnv("OTEL_EXPORTER_OTLP_ENDPOINT"),
|
|
86
|
+
// "http://localhost:4318",
|
|
87
|
+
// "/v1/traces"
|
|
88
|
+
// );
|
|
89
|
+
// console.log("signoz initialize 2");
|
|
90
|
+
|
|
91
|
+
// const headers = { ...(options.headers || {}) };
|
|
92
|
+
// const apiKey = options.apiKey || this.getEnv("SIGNOZ_API_KEY");
|
|
93
|
+
// if (apiKey && !headers["signoz-access-token"]) {
|
|
94
|
+
// headers["signoz-access-token"] = apiKey;
|
|
95
|
+
// }
|
|
96
|
+
|
|
97
|
+
// const resourceAttributes: Record<string, unknown> = {
|
|
98
|
+
// [SemanticResourceAttributes.SERVICE_NAME]: serviceName,
|
|
99
|
+
// [SemanticResourceAttributes.DEPLOYMENT_ENVIRONMENT]: environment,
|
|
100
|
+
// };
|
|
101
|
+
|
|
102
|
+
// if (options.resourceAttributes) {
|
|
103
|
+
// Object.assign(resourceAttributes, options.resourceAttributes);
|
|
104
|
+
// }
|
|
105
|
+
|
|
106
|
+
// console.log("signoz initialize 3");
|
|
107
|
+
// const resource = new Resource(resourceAttributes);
|
|
108
|
+
|
|
109
|
+
// let instrumentations = options.instrumentations ? [...options.instrumentations] : [];
|
|
110
|
+
// if (instrumentations.length === 0 && options.autoInstrumentations !== false) {
|
|
111
|
+
// const autoInstrumentation = this.loadAutoInstrumentations(options.autoInstrumentationConfig || {});
|
|
112
|
+
// if (autoInstrumentation) {
|
|
113
|
+
// instrumentations = [autoInstrumentation];
|
|
114
|
+
// }
|
|
115
|
+
// }
|
|
116
|
+
// console.log("signoz initialize 4");
|
|
117
|
+
|
|
118
|
+
// let traceSampler: ParentBasedSampler | undefined;
|
|
119
|
+
// if (typeof options.samplingRatio === "number") {
|
|
120
|
+
// const ratio = Math.min(Math.max(options.samplingRatio, 0), 1);
|
|
121
|
+
// traceSampler = new ParentBasedSampler({
|
|
122
|
+
// root: new TraceIdRatioBasedSampler(ratio),
|
|
123
|
+
// });
|
|
124
|
+
// }
|
|
125
|
+
// console.log("signoz initialize 5");
|
|
126
|
+
|
|
127
|
+
// const traceExporter = new OTLPTraceExporter({
|
|
128
|
+
// url: traceEndpoint,
|
|
129
|
+
// headers,
|
|
130
|
+
// });
|
|
131
|
+
|
|
132
|
+
// const sdkOptions: {
|
|
133
|
+
// resource: Resource;
|
|
134
|
+
// traceExporter: OTLPTraceExporter;
|
|
135
|
+
// instrumentations?: any[];
|
|
136
|
+
// traceSampler?: ParentBasedSampler;
|
|
137
|
+
// } = {
|
|
138
|
+
// resource,
|
|
139
|
+
// traceExporter,
|
|
140
|
+
// };
|
|
141
|
+
|
|
142
|
+
// if (instrumentations.length > 0) {
|
|
143
|
+
// sdkOptions.instrumentations = instrumentations;
|
|
144
|
+
// }
|
|
145
|
+
// if (traceSampler) {
|
|
146
|
+
// sdkOptions.traceSampler = traceSampler;
|
|
147
|
+
// }
|
|
148
|
+
|
|
149
|
+
// console.log("signoz initialize 6");
|
|
150
|
+
// this.sdk = new NodeSDK(sdkOptions as any);
|
|
151
|
+
// await this.sdk.start();
|
|
152
|
+
|
|
153
|
+
// if (options.logInitialization !== false) {
|
|
154
|
+
// this.logInfo(`[SigNoz] Telemetry enabled (service="${serviceName}", endpoint="${traceEndpoint}")`);
|
|
155
|
+
// }
|
|
156
|
+
|
|
157
|
+
// console.log("signoz initialize 7");
|
|
158
|
+
// this.registerShutdownHooks();
|
|
159
|
+
|
|
160
|
+
// console.log("signoz initialize 8");
|
|
161
|
+
// }
|
|
162
|
+
|
|
163
|
+
// static async shutdown(): Promise<void> {
|
|
164
|
+
// if (!this.sdk) {
|
|
165
|
+
// return;
|
|
166
|
+
// }
|
|
167
|
+
|
|
168
|
+
// const sdkToShutdown = this.sdk;
|
|
169
|
+
// this.sdk = null;
|
|
170
|
+
|
|
171
|
+
// try {
|
|
172
|
+
// await sdkToShutdown.shutdown();
|
|
173
|
+
// } catch (error) {
|
|
174
|
+
// this.logWarn("[SigNoz] Shutdown failed:", error);
|
|
175
|
+
// }
|
|
176
|
+
// }
|
|
177
|
+
|
|
178
|
+
// private static ensureEndpoint(value: string | undefined, fallbackHost: string, defaultPath: string): string {
|
|
179
|
+
// const base = value && value.trim() !== "" ? value.trim() : fallbackHost;
|
|
180
|
+
// if (base.includes("/v1/") || base.endsWith(defaultPath)) {
|
|
181
|
+
// return base;
|
|
182
|
+
// }
|
|
183
|
+
// return `${base.replace(/\/$/, "")}${defaultPath}`;
|
|
184
|
+
// }
|
|
185
|
+
|
|
186
|
+
// private static warnMissingDependency(name: string) {
|
|
187
|
+
// if (this.missingDependencies.has(name)) {
|
|
188
|
+
// return;
|
|
189
|
+
// }
|
|
190
|
+
// this.missingDependencies.add(name);
|
|
191
|
+
// this.logWarn(`[SigNoz] Optional package "${name}" not found. Install it to enable the related feature.`);
|
|
192
|
+
// }
|
|
193
|
+
|
|
194
|
+
// private static loadAutoInstrumentations(config: Record<string, unknown>): any | null {
|
|
195
|
+
// if (typeof require !== "function") {
|
|
196
|
+
// return null;
|
|
197
|
+
// }
|
|
198
|
+
// try {
|
|
199
|
+
// // eslint-disable-next-line @typescript-eslint/no-var-requires,@typescript-eslint/no-unsafe-assignment
|
|
200
|
+
// const module = require("@opentelemetry/auto-instrumentations-node");
|
|
201
|
+
// if (module && typeof module.getNodeAutoInstrumentations === "function") {
|
|
202
|
+
// return module.getNodeAutoInstrumentations(config);
|
|
203
|
+
// }
|
|
204
|
+
// this.warnMissingDependency("@opentelemetry/auto-instrumentations-node");
|
|
205
|
+
// return null;
|
|
206
|
+
// } catch (error: any) {
|
|
207
|
+
// if (error && (error.code === "MODULE_NOT_FOUND" || error.code === "ERR_MODULE_NOT_FOUND")) {
|
|
208
|
+
// this.warnMissingDependency("@opentelemetry/auto-instrumentations-node");
|
|
209
|
+
// return null;
|
|
210
|
+
// }
|
|
211
|
+
// throw error;
|
|
212
|
+
// }
|
|
213
|
+
// }
|
|
214
|
+
|
|
215
|
+
// private static registerShutdownHooks() {
|
|
216
|
+
// if (this.shutdownRegistered) {
|
|
217
|
+
// return;
|
|
218
|
+
// }
|
|
219
|
+
// const nodeProcess = this.getProcess();
|
|
220
|
+
// if (!nodeProcess) {
|
|
221
|
+
// return;
|
|
222
|
+
// }
|
|
223
|
+
// nodeProcess.once("beforeExit", this.shutdownListener);
|
|
224
|
+
// nodeProcess.once("exit", this.shutdownListener);
|
|
225
|
+
// this.shutdownRegistered = true;
|
|
226
|
+
// }
|
|
227
|
+
|
|
228
|
+
// private static getProcess(): any {
|
|
229
|
+
// if (typeof globalThis === "undefined") {
|
|
230
|
+
// return undefined;
|
|
231
|
+
// }
|
|
232
|
+
// const candidate = (globalThis as any).process;
|
|
233
|
+
// if (candidate && typeof candidate.once === "function") {
|
|
234
|
+
// return candidate;
|
|
235
|
+
// }
|
|
236
|
+
// return undefined;
|
|
237
|
+
// }
|
|
238
|
+
|
|
239
|
+
// private static getEnv(key: string): string | undefined {
|
|
240
|
+
// const nodeProcess = this.getProcess();
|
|
241
|
+
// if (!nodeProcess || !nodeProcess.env) {
|
|
242
|
+
// return undefined;
|
|
243
|
+
// }
|
|
244
|
+
// const value = nodeProcess.env[key];
|
|
245
|
+
// return typeof value === "string" ? value : undefined;
|
|
246
|
+
// }
|
|
247
|
+
|
|
248
|
+
// private static getConsole(): any {
|
|
249
|
+
// if (typeof globalThis === "undefined") {
|
|
250
|
+
// return undefined;
|
|
251
|
+
// }
|
|
252
|
+
// return (globalThis as any).console;
|
|
253
|
+
// }
|
|
254
|
+
|
|
255
|
+
// private static logInfo(...args: unknown[]) {
|
|
256
|
+
// const target = this.getConsole();
|
|
257
|
+
// if (target && typeof target.info === "function") {
|
|
258
|
+
// target.info(...args);
|
|
259
|
+
// }
|
|
260
|
+
// }
|
|
261
|
+
|
|
262
|
+
// private static logWarn(...args: unknown[]) {
|
|
263
|
+
// const target = this.getConsole();
|
|
264
|
+
// if (target && typeof target.warn === "function") {
|
|
265
|
+
// target.warn(...args);
|
|
266
|
+
// }
|
|
267
|
+
// }
|
|
268
|
+
// }
|
package/src/WebApplication.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { Router } from "./Router/Router";
|
|
|
5
5
|
import { QueueJobsRegisty } from "./Queue/QueueJobsRegisty";
|
|
6
6
|
import { DatatableRegistry } from "./Datatable/DatatableRegistry";
|
|
7
7
|
import { ModulesLoader } from "./Modules/ModulesLoader";
|
|
8
|
-
import { SigNozTelemetry } from "./Telemetry/SigNozTelemetry";
|
|
8
|
+
// import { SigNozTelemetry } from "./Telemetry/SigNozTelemetry";
|
|
9
9
|
|
|
10
10
|
export class WebApplication {
|
|
11
11
|
private server!: Server;
|
|
@@ -21,9 +21,9 @@ export class WebApplication {
|
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
if (options && options.signoz) {
|
|
25
|
-
|
|
26
|
-
}
|
|
24
|
+
// if (options && options.signoz) {
|
|
25
|
+
// void SigNozTelemetry.init(options.signoz);
|
|
26
|
+
// }
|
|
27
27
|
|
|
28
28
|
this.modulesLoader = new ModulesLoader();
|
|
29
29
|
this.modulesLoader.load(options && options.modules ? options.modules : []);
|
|
@@ -55,9 +55,9 @@ export class WebApplication {
|
|
|
55
55
|
Router.handleRequest(req, res);
|
|
56
56
|
});
|
|
57
57
|
|
|
58
|
-
this.server.on("close", () => {
|
|
59
|
-
|
|
60
|
-
});
|
|
58
|
+
// this.server.on("close", () => {
|
|
59
|
+
// void SigNozTelemetry.shutdown();
|
|
60
|
+
// });
|
|
61
61
|
|
|
62
62
|
this.server.listen(port, () => {
|
|
63
63
|
const runtimeConsole = typeof globalThis !== "undefined" ? (globalThis as any).console : undefined;
|
package/src/index.ts
CHANGED
|
@@ -31,5 +31,5 @@ export * from "./Queue/QueueJob";
|
|
|
31
31
|
export * from "./Queue/QueueJobsRegisty";
|
|
32
32
|
export * from "./Commands/ConsoleOutputHelper";
|
|
33
33
|
export * from "./Modules/ModuleProvider";
|
|
34
|
-
export * from "./Telemetry/SigNozTelemetry";
|
|
35
|
-
export * from "./info";
|
|
34
|
+
// export * from "./Telemetry/SigNozTelemetry";
|
|
35
|
+
// export * from "./info";
|