badmfck-api-server 2.8.6 → 2.8.8
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.
@@ -80,6 +80,7 @@ async function Initializer(services) {
|
|
80
80
|
for (let i of services) {
|
81
81
|
await i.init();
|
82
82
|
activeServices.push(i.getName());
|
83
|
+
MonitorService_1.S_STAT_REGISTRATE_SERVICE.invoke(i.getName());
|
83
84
|
}
|
84
85
|
for (let i of services) {
|
85
86
|
i.applicationReady();
|
@@ -88,7 +89,7 @@ async function Initializer(services) {
|
|
88
89
|
exports.Initializer = Initializer;
|
89
90
|
class APIService extends BaseService_1.BaseService {
|
90
91
|
static nextLogID = 0;
|
91
|
-
version = "2.8.
|
92
|
+
version = "2.8.8";
|
92
93
|
options;
|
93
94
|
monitor = null;
|
94
95
|
monitorIndexFile;
|
@@ -107,6 +108,7 @@ class APIService extends BaseService_1.BaseService {
|
|
107
108
|
if (this.options.monitor && this.options.monitor.length > 0) {
|
108
109
|
exports.REQ_MONITOR_USERS.listener = async () => this.options.monitor ?? [];
|
109
110
|
this.monitor = new MonitorService_1.MonitorService();
|
111
|
+
this.monitor.init();
|
110
112
|
this.options.endpoints.push(new Monitor_1.Monitor());
|
111
113
|
}
|
112
114
|
this.options.endpoints.push(new ExternalServiceEndpoint_1.ExternalServiceEndpoint());
|
@@ -237,7 +239,7 @@ class APIService extends BaseService_1.BaseService {
|
|
237
239
|
files: req.files ?? null,
|
238
240
|
referer: req.get("Referer"),
|
239
241
|
};
|
240
|
-
if (this.options.preproducer) {
|
242
|
+
if (this.options.preproducer && ep !== "--sys-monitor") {
|
241
243
|
try {
|
242
244
|
const preproducerResult = await this.options.preproducer(httpRequest);
|
243
245
|
if (preproducerResult)
|
@@ -14,10 +14,12 @@ export interface IEPStatReqFilter {
|
|
14
14
|
export interface IEPStatResult {
|
15
15
|
}
|
16
16
|
export declare const S_STAT_REGISTRATE_REQUEST: Signal<TransferPacketVO<any>>;
|
17
|
+
export declare const S_STAT_REGISTRATE_SERVICE: Signal<string>;
|
17
18
|
export declare const REQ_EP_STAT: Req<IEPStatReqFilter, IEPStatResult>;
|
18
19
|
export declare class MonitorService extends BaseService {
|
19
20
|
endpoints: Map<number, Map<string, IEPStat>>;
|
20
21
|
constructor();
|
22
|
+
init(): Promise<void>;
|
21
23
|
getEPStat(req: IEPStatReqFilter): Promise<IEPStatResult>;
|
22
24
|
onStatRegistrate(data: TransferPacketVO): void;
|
23
25
|
pad(num: number): string;
|
@@ -23,18 +23,22 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
23
23
|
return result;
|
24
24
|
};
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
26
|
-
exports.MonitorService = exports.REQ_EP_STAT = exports.S_STAT_REGISTRATE_REQUEST = void 0;
|
26
|
+
exports.MonitorService = exports.REQ_EP_STAT = exports.S_STAT_REGISTRATE_SERVICE = exports.S_STAT_REGISTRATE_REQUEST = void 0;
|
27
27
|
const badmfck_signal_1 = __importStar(require("badmfck-signal"));
|
28
28
|
const BaseService_1 = require("./BaseService");
|
29
29
|
exports.S_STAT_REGISTRATE_REQUEST = new badmfck_signal_1.default();
|
30
|
+
exports.S_STAT_REGISTRATE_SERVICE = new badmfck_signal_1.default();
|
30
31
|
exports.REQ_EP_STAT = new badmfck_signal_1.Req(undefined, "REQ_EP_STAT");
|
31
32
|
class MonitorService extends BaseService_1.BaseService {
|
32
33
|
endpoints = new Map();
|
33
34
|
constructor() {
|
34
35
|
super("MonitorService");
|
35
|
-
exports.S_STAT_REGISTRATE_REQUEST.subscribe(this.onStatRegistrate);
|
36
|
+
exports.S_STAT_REGISTRATE_REQUEST.subscribe(req => this.onStatRegistrate(req));
|
36
37
|
exports.REQ_EP_STAT.listener = async (req) => this.getEPStat(req);
|
37
38
|
}
|
39
|
+
async init() {
|
40
|
+
super.init();
|
41
|
+
}
|
38
42
|
async getEPStat(req) {
|
39
43
|
const result = new Map();
|
40
44
|
if (req.range === "hour") {
|
@@ -81,7 +85,7 @@ class MonitorService extends BaseService_1.BaseService {
|
|
81
85
|
}
|
82
86
|
endResult.push(stat);
|
83
87
|
}
|
84
|
-
return { filter: req, result: endResult };
|
88
|
+
return { filter: req, result: endResult, overallcount: this.endpoints.size };
|
85
89
|
}
|
86
90
|
onStatRegistrate(data) {
|
87
91
|
const minute = this.getMinutes(new Date());
|
@@ -15,6 +15,7 @@ export declare class Monitor extends BaseEndpoint {
|
|
15
15
|
ignoreHttpLogging: boolean;
|
16
16
|
users: Map<string, IStatObject>;
|
17
17
|
constructor();
|
18
|
+
controllers(req: HTTPRequestVO): Promise<TransferPacketVO>;
|
18
19
|
logs(req: HTTPRequestVO): Promise<TransferPacketVO>;
|
19
20
|
netlog(req: HTTPRequestVO): Promise<TransferPacketVO>;
|
20
21
|
metrics(req: HTTPRequestVO): Promise<TransferPacketVO>;
|
@@ -22,9 +22,14 @@ class Monitor extends BaseEndpoint_1.BaseEndpoint {
|
|
22
22
|
{ ignoreInterceptor: true, endpoint: "log", handler: this.logs },
|
23
23
|
{ ignoreInterceptor: true, endpoint: "netlog", handler: this.netlog },
|
24
24
|
{ ignoreInterceptor: true, endpoint: "metrics", handler: this.metrics },
|
25
|
-
{ ignoreInterceptor: true, endpoint: "server", handler: this.serverStat }
|
25
|
+
{ ignoreInterceptor: true, endpoint: "server", handler: this.serverStat },
|
26
|
+
{ ignoreInterceptor: true, endpoint: "controllers", handler: this.controllers }
|
26
27
|
]);
|
27
28
|
}
|
29
|
+
async controllers(req) {
|
30
|
+
this.checkAuthentication(req);
|
31
|
+
return {};
|
32
|
+
}
|
28
33
|
async logs(req) {
|
29
34
|
this.checkAuthentication(req);
|
30
35
|
const services = await LogService_1.REQ_LOG_UNIQUE_SERVICES.request();
|
@@ -40,7 +45,8 @@ class Monitor extends BaseEndpoint_1.BaseEndpoint {
|
|
40
45
|
}
|
41
46
|
async netlog(req) {
|
42
47
|
this.checkAuthentication(req);
|
43
|
-
|
48
|
+
const log = await APIService_1.REQ_HTTP_LOG.request(req.data);
|
49
|
+
return { data: log };
|
44
50
|
}
|
45
51
|
async metrics(req) {
|
46
52
|
this.checkAuthentication(req);
|