@spinajs/telemetry 2.0.482
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/README.md +482 -0
- package/lib/cjs/InMemoryPerfSink.d.ts +51 -0
- package/lib/cjs/InMemoryPerfSink.d.ts.map +1 -0
- package/lib/cjs/InMemoryPerfSink.js +100 -0
- package/lib/cjs/InMemoryPerfSink.js.map +1 -0
- package/lib/cjs/PromMetricSink.d.ts +26 -0
- package/lib/cjs/PromMetricSink.d.ts.map +1 -0
- package/lib/cjs/PromMetricSink.js +68 -0
- package/lib/cjs/PromMetricSink.js.map +1 -0
- package/lib/cjs/bootstrap.d.ts +13 -0
- package/lib/cjs/bootstrap.d.ts.map +1 -0
- package/lib/cjs/bootstrap.js +57 -0
- package/lib/cjs/bootstrap.js.map +1 -0
- package/lib/cjs/config/telemetry.d.ts +63 -0
- package/lib/cjs/config/telemetry.d.ts.map +1 -0
- package/lib/cjs/config/telemetry.js +78 -0
- package/lib/cjs/config/telemetry.js.map +1 -0
- package/lib/cjs/controllers/Metrics.d.ts +26 -0
- package/lib/cjs/controllers/Metrics.d.ts.map +1 -0
- package/lib/cjs/controllers/Metrics.js +63 -0
- package/lib/cjs/controllers/Metrics.js.map +1 -0
- package/lib/cjs/controllers/Telemetry.d.ts +92 -0
- package/lib/cjs/controllers/Telemetry.d.ts.map +1 -0
- package/lib/cjs/controllers/Telemetry.js +226 -0
- package/lib/cjs/controllers/Telemetry.js.map +1 -0
- package/lib/cjs/dto/index.d.ts +21 -0
- package/lib/cjs/dto/index.d.ts.map +1 -0
- package/lib/cjs/dto/index.js +64 -0
- package/lib/cjs/dto/index.js.map +1 -0
- package/lib/cjs/endpoints.d.ts +32 -0
- package/lib/cjs/endpoints.d.ts.map +1 -0
- package/lib/cjs/endpoints.js +38 -0
- package/lib/cjs/endpoints.js.map +1 -0
- package/lib/cjs/health.d.ts +55 -0
- package/lib/cjs/health.d.ts.map +1 -0
- package/lib/cjs/health.js +111 -0
- package/lib/cjs/health.js.map +1 -0
- package/lib/cjs/index.d.ts +16 -0
- package/lib/cjs/index.d.ts.map +1 -0
- package/lib/cjs/index.js +32 -0
- package/lib/cjs/index.js.map +1 -0
- package/lib/cjs/metrics.d.ts +16 -0
- package/lib/cjs/metrics.d.ts.map +1 -0
- package/lib/cjs/metrics.js +32 -0
- package/lib/cjs/metrics.js.map +1 -0
- package/lib/cjs/middleware.d.ts +81 -0
- package/lib/cjs/middleware.d.ts.map +1 -0
- package/lib/cjs/middleware.js +210 -0
- package/lib/cjs/middleware.js.map +1 -0
- package/lib/cjs/package.json +1 -0
- package/lib/cjs/policies/PublicPolicy.d.ts +16 -0
- package/lib/cjs/policies/PublicPolicy.d.ts.map +1 -0
- package/lib/cjs/policies/PublicPolicy.js +34 -0
- package/lib/cjs/policies/PublicPolicy.js.map +1 -0
- package/lib/cjs/policies/TelemetryTokenPolicy.d.ts +19 -0
- package/lib/cjs/policies/TelemetryTokenPolicy.d.ts.map +1 -0
- package/lib/cjs/policies/TelemetryTokenPolicy.js +65 -0
- package/lib/cjs/policies/TelemetryTokenPolicy.js.map +1 -0
- package/lib/cjs/requestStats.d.ts +81 -0
- package/lib/cjs/requestStats.d.ts.map +1 -0
- package/lib/cjs/requestStats.js +134 -0
- package/lib/cjs/requestStats.js.map +1 -0
- package/lib/cjs/responses.d.ts +23 -0
- package/lib/cjs/responses.d.ts.map +1 -0
- package/lib/cjs/responses.js +35 -0
- package/lib/cjs/responses.js.map +1 -0
- package/lib/cjs/routeStats.d.ts +43 -0
- package/lib/cjs/routeStats.d.ts.map +1 -0
- package/lib/cjs/routeStats.js +59 -0
- package/lib/cjs/routeStats.js.map +1 -0
- package/lib/cjs/schemas/HealthResponse.schema.d.ts +30 -0
- package/lib/cjs/schemas/HealthResponse.schema.d.ts.map +1 -0
- package/lib/cjs/schemas/HealthResponse.schema.js +15 -0
- package/lib/cjs/schemas/HealthResponse.schema.js.map +1 -0
- package/lib/cjs/schemas/PerfResponse.schema.d.ts +56 -0
- package/lib/cjs/schemas/PerfResponse.schema.d.ts.map +1 -0
- package/lib/cjs/schemas/PerfResponse.schema.js +36 -0
- package/lib/cjs/schemas/PerfResponse.schema.js.map +1 -0
- package/lib/cjs/schemas/ReadyResponse.schema.d.ts +36 -0
- package/lib/cjs/schemas/ReadyResponse.schema.d.ts.map +1 -0
- package/lib/cjs/schemas/ReadyResponse.schema.js +23 -0
- package/lib/cjs/schemas/ReadyResponse.schema.js.map +1 -0
- package/lib/cjs/schemas/RequestStatsSnapshot.schema.d.ts +79 -0
- package/lib/cjs/schemas/RequestStatsSnapshot.schema.d.ts.map +1 -0
- package/lib/cjs/schemas/RequestStatsSnapshot.schema.js +30 -0
- package/lib/cjs/schemas/RequestStatsSnapshot.schema.js.map +1 -0
- package/lib/cjs/schemas/RoutesResponse.schema.d.ts +100 -0
- package/lib/cjs/schemas/RoutesResponse.schema.d.ts.map +1 -0
- package/lib/cjs/schemas/RoutesResponse.schema.js +25 -0
- package/lib/cjs/schemas/RoutesResponse.schema.js.map +1 -0
- package/lib/cjs/schemas/StatsResponse.schema.d.ts +158 -0
- package/lib/cjs/schemas/StatsResponse.schema.d.ts.map +1 -0
- package/lib/cjs/schemas/StatsResponse.schema.js +19 -0
- package/lib/cjs/schemas/StatsResponse.schema.js.map +1 -0
- package/lib/cjs/schemas/TimelineResponse.schema.d.ts +109 -0
- package/lib/cjs/schemas/TimelineResponse.schema.d.ts.map +1 -0
- package/lib/cjs/schemas/TimelineResponse.schema.js +28 -0
- package/lib/cjs/schemas/TimelineResponse.schema.js.map +1 -0
- package/lib/cjs/store.d.ts +58 -0
- package/lib/cjs/store.d.ts.map +1 -0
- package/lib/cjs/store.js +108 -0
- package/lib/cjs/store.js.map +1 -0
- package/lib/cjs/timeline.d.ts +48 -0
- package/lib/cjs/timeline.d.ts.map +1 -0
- package/lib/cjs/timeline.js +70 -0
- package/lib/cjs/timeline.js.map +1 -0
- package/lib/mjs/InMemoryPerfSink.d.ts +51 -0
- package/lib/mjs/InMemoryPerfSink.d.ts.map +1 -0
- package/lib/mjs/InMemoryPerfSink.js +97 -0
- package/lib/mjs/InMemoryPerfSink.js.map +1 -0
- package/lib/mjs/PromMetricSink.d.ts +26 -0
- package/lib/mjs/PromMetricSink.d.ts.map +1 -0
- package/lib/mjs/PromMetricSink.js +65 -0
- package/lib/mjs/PromMetricSink.js.map +1 -0
- package/lib/mjs/bootstrap.d.ts +13 -0
- package/lib/mjs/bootstrap.d.ts.map +1 -0
- package/lib/mjs/bootstrap.js +54 -0
- package/lib/mjs/bootstrap.js.map +1 -0
- package/lib/mjs/config/telemetry.d.ts +63 -0
- package/lib/mjs/config/telemetry.d.ts.map +1 -0
- package/lib/mjs/config/telemetry.js +76 -0
- package/lib/mjs/config/telemetry.js.map +1 -0
- package/lib/mjs/controllers/Metrics.d.ts +26 -0
- package/lib/mjs/controllers/Metrics.d.ts.map +1 -0
- package/lib/mjs/controllers/Metrics.js +60 -0
- package/lib/mjs/controllers/Metrics.js.map +1 -0
- package/lib/mjs/controllers/Telemetry.d.ts +92 -0
- package/lib/mjs/controllers/Telemetry.d.ts.map +1 -0
- package/lib/mjs/controllers/Telemetry.js +223 -0
- package/lib/mjs/controllers/Telemetry.js.map +1 -0
- package/lib/mjs/dto/index.d.ts +21 -0
- package/lib/mjs/dto/index.d.ts.map +1 -0
- package/lib/mjs/dto/index.js +58 -0
- package/lib/mjs/dto/index.js.map +1 -0
- package/lib/mjs/endpoints.d.ts +32 -0
- package/lib/mjs/endpoints.d.ts.map +1 -0
- package/lib/mjs/endpoints.js +34 -0
- package/lib/mjs/endpoints.js.map +1 -0
- package/lib/mjs/health.d.ts +55 -0
- package/lib/mjs/health.d.ts.map +1 -0
- package/lib/mjs/health.js +107 -0
- package/lib/mjs/health.js.map +1 -0
- package/lib/mjs/index.d.ts +16 -0
- package/lib/mjs/index.d.ts.map +1 -0
- package/lib/mjs/index.js +16 -0
- package/lib/mjs/index.js.map +1 -0
- package/lib/mjs/metrics.d.ts +16 -0
- package/lib/mjs/metrics.d.ts.map +1 -0
- package/lib/mjs/metrics.js +16 -0
- package/lib/mjs/metrics.js.map +1 -0
- package/lib/mjs/middleware.d.ts +81 -0
- package/lib/mjs/middleware.d.ts.map +1 -0
- package/lib/mjs/middleware.js +207 -0
- package/lib/mjs/middleware.js.map +1 -0
- package/lib/mjs/package.json +1 -0
- package/lib/mjs/policies/PublicPolicy.d.ts +16 -0
- package/lib/mjs/policies/PublicPolicy.d.ts.map +1 -0
- package/lib/mjs/policies/PublicPolicy.js +31 -0
- package/lib/mjs/policies/PublicPolicy.js.map +1 -0
- package/lib/mjs/policies/TelemetryTokenPolicy.d.ts +19 -0
- package/lib/mjs/policies/TelemetryTokenPolicy.d.ts.map +1 -0
- package/lib/mjs/policies/TelemetryTokenPolicy.js +62 -0
- package/lib/mjs/policies/TelemetryTokenPolicy.js.map +1 -0
- package/lib/mjs/requestStats.d.ts +81 -0
- package/lib/mjs/requestStats.d.ts.map +1 -0
- package/lib/mjs/requestStats.js +130 -0
- package/lib/mjs/requestStats.js.map +1 -0
- package/lib/mjs/responses.d.ts +23 -0
- package/lib/mjs/responses.d.ts.map +1 -0
- package/lib/mjs/responses.js +30 -0
- package/lib/mjs/responses.js.map +1 -0
- package/lib/mjs/routeStats.d.ts +43 -0
- package/lib/mjs/routeStats.d.ts.map +1 -0
- package/lib/mjs/routeStats.js +55 -0
- package/lib/mjs/routeStats.js.map +1 -0
- package/lib/mjs/schemas/HealthResponse.schema.d.ts +30 -0
- package/lib/mjs/schemas/HealthResponse.schema.d.ts.map +1 -0
- package/lib/mjs/schemas/HealthResponse.schema.js +13 -0
- package/lib/mjs/schemas/HealthResponse.schema.js.map +1 -0
- package/lib/mjs/schemas/PerfResponse.schema.d.ts +56 -0
- package/lib/mjs/schemas/PerfResponse.schema.d.ts.map +1 -0
- package/lib/mjs/schemas/PerfResponse.schema.js +34 -0
- package/lib/mjs/schemas/PerfResponse.schema.js.map +1 -0
- package/lib/mjs/schemas/ReadyResponse.schema.d.ts +36 -0
- package/lib/mjs/schemas/ReadyResponse.schema.d.ts.map +1 -0
- package/lib/mjs/schemas/ReadyResponse.schema.js +21 -0
- package/lib/mjs/schemas/ReadyResponse.schema.js.map +1 -0
- package/lib/mjs/schemas/RequestStatsSnapshot.schema.d.ts +79 -0
- package/lib/mjs/schemas/RequestStatsSnapshot.schema.d.ts.map +1 -0
- package/lib/mjs/schemas/RequestStatsSnapshot.schema.js +28 -0
- package/lib/mjs/schemas/RequestStatsSnapshot.schema.js.map +1 -0
- package/lib/mjs/schemas/RoutesResponse.schema.d.ts +100 -0
- package/lib/mjs/schemas/RoutesResponse.schema.d.ts.map +1 -0
- package/lib/mjs/schemas/RoutesResponse.schema.js +20 -0
- package/lib/mjs/schemas/RoutesResponse.schema.js.map +1 -0
- package/lib/mjs/schemas/StatsResponse.schema.d.ts +158 -0
- package/lib/mjs/schemas/StatsResponse.schema.d.ts.map +1 -0
- package/lib/mjs/schemas/StatsResponse.schema.js +14 -0
- package/lib/mjs/schemas/StatsResponse.schema.js.map +1 -0
- package/lib/mjs/schemas/TimelineResponse.schema.d.ts +109 -0
- package/lib/mjs/schemas/TimelineResponse.schema.d.ts.map +1 -0
- package/lib/mjs/schemas/TimelineResponse.schema.js +23 -0
- package/lib/mjs/schemas/TimelineResponse.schema.js.map +1 -0
- package/lib/mjs/store.d.ts +58 -0
- package/lib/mjs/store.d.ts.map +1 -0
- package/lib/mjs/store.js +105 -0
- package/lib/mjs/store.js.map +1 -0
- package/lib/mjs/timeline.d.ts +48 -0
- package/lib/mjs/timeline.d.ts.map +1 -0
- package/lib/mjs/timeline.js +66 -0
- package/lib/mjs/timeline.js.map +1 -0
- package/lib/tsconfig.cjs.tsbuildinfo +1 -0
- package/lib/tsconfig.mjs.tsbuildinfo +1 -0
- package/package.json +69 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RequestStatsSnapshot.schema.js","sourceRoot":"","sources":["../../../src/schemas/RequestStatsSnapshot.schema.ts"],"names":[],"mappings":";;AAAA;;;GAGG;AACH,MAAM,0BAA0B,GAAG;IACjC,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE;QACV,QAAQ,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,kBAAkB,EAAE;QAC7D,SAAS,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,mBAAmB,EAAE;QAC/D,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,8BAA8B,EAAE;QAEvE,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,eAAe,EAAE;QACtD,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,eAAe,EAAE;QACzD,QAAQ,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,eAAe,EAAE;QAC1D,YAAY,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,eAAe,EAAE;QAC9D,YAAY,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,eAAe,EAAE;QAE9D,UAAU,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,4BAA4B,EAAE;QACzE,QAAQ,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,wBAAwB,EAAE;QACnE,QAAQ,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,wBAAwB,EAAE;QACnE,QAAQ,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,0BAA0B,EAAE;QAErE,eAAe,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,sCAAsC,EAAE;QACxF,eAAe,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,yCAAyC,EAAE;QAC3F,WAAW,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,2CAA2C,EAAE;QAEzF,QAAQ,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,qCAAqC,EAAE;QAChF,QAAQ,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,mCAAmC,EAAE;KAC/E;CACF,CAAC;AAEF,kBAAe,0BAA0B,CAAC"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
declare const RoutesResponseSchema: {
|
|
2
|
+
type: string;
|
|
3
|
+
properties: {
|
|
4
|
+
truncated: {
|
|
5
|
+
type: string;
|
|
6
|
+
description: string;
|
|
7
|
+
};
|
|
8
|
+
routes: {
|
|
9
|
+
type: string;
|
|
10
|
+
items: {
|
|
11
|
+
type: string;
|
|
12
|
+
properties: {
|
|
13
|
+
method: {
|
|
14
|
+
type: string;
|
|
15
|
+
description: string;
|
|
16
|
+
};
|
|
17
|
+
route: {
|
|
18
|
+
type: string;
|
|
19
|
+
description: string;
|
|
20
|
+
};
|
|
21
|
+
stats: {
|
|
22
|
+
type: string;
|
|
23
|
+
properties: {
|
|
24
|
+
requests: {
|
|
25
|
+
type: string;
|
|
26
|
+
description: string;
|
|
27
|
+
};
|
|
28
|
+
responses: {
|
|
29
|
+
type: string;
|
|
30
|
+
description: string;
|
|
31
|
+
};
|
|
32
|
+
errors: {
|
|
33
|
+
type: string;
|
|
34
|
+
description: string;
|
|
35
|
+
};
|
|
36
|
+
info: {
|
|
37
|
+
type: string;
|
|
38
|
+
description: string;
|
|
39
|
+
};
|
|
40
|
+
success: {
|
|
41
|
+
type: string;
|
|
42
|
+
description: string;
|
|
43
|
+
};
|
|
44
|
+
redirect: {
|
|
45
|
+
type: string;
|
|
46
|
+
description: string;
|
|
47
|
+
};
|
|
48
|
+
client_error: {
|
|
49
|
+
type: string;
|
|
50
|
+
description: string;
|
|
51
|
+
};
|
|
52
|
+
server_error: {
|
|
53
|
+
type: string;
|
|
54
|
+
description: string;
|
|
55
|
+
};
|
|
56
|
+
total_time: {
|
|
57
|
+
type: string;
|
|
58
|
+
description: string;
|
|
59
|
+
};
|
|
60
|
+
max_time: {
|
|
61
|
+
type: string;
|
|
62
|
+
description: string;
|
|
63
|
+
};
|
|
64
|
+
min_time: {
|
|
65
|
+
type: string;
|
|
66
|
+
description: string;
|
|
67
|
+
};
|
|
68
|
+
avg_time: {
|
|
69
|
+
type: string;
|
|
70
|
+
description: string;
|
|
71
|
+
};
|
|
72
|
+
apdex_satisfied: {
|
|
73
|
+
type: string;
|
|
74
|
+
description: string;
|
|
75
|
+
};
|
|
76
|
+
apdex_tolerated: {
|
|
77
|
+
type: string;
|
|
78
|
+
description: string;
|
|
79
|
+
};
|
|
80
|
+
apdex_score: {
|
|
81
|
+
type: string;
|
|
82
|
+
description: string;
|
|
83
|
+
};
|
|
84
|
+
req_rate: {
|
|
85
|
+
type: string;
|
|
86
|
+
description: string;
|
|
87
|
+
};
|
|
88
|
+
err_rate: {
|
|
89
|
+
type: string;
|
|
90
|
+
description: string;
|
|
91
|
+
};
|
|
92
|
+
};
|
|
93
|
+
};
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
};
|
|
97
|
+
};
|
|
98
|
+
};
|
|
99
|
+
export default RoutesResponseSchema;
|
|
100
|
+
//# sourceMappingURL=RoutesResponse.schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RoutesResponse.schema.d.ts","sourceRoot":"","sources":["../../../src/schemas/RoutesResponse.schema.ts"],"names":[],"mappings":"AAEA,QAAA,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgBzB,CAAC;AAEF,eAAe,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const RequestStatsSnapshot_schema_js_1 = __importDefault(require("./RequestStatsSnapshot.schema.js"));
|
|
7
|
+
const RoutesResponseSchema = {
|
|
8
|
+
type: 'object',
|
|
9
|
+
properties: {
|
|
10
|
+
truncated: { type: 'boolean', description: 'True once the route cap was hit and new routes stopped being tracked' },
|
|
11
|
+
routes: {
|
|
12
|
+
type: 'array',
|
|
13
|
+
items: {
|
|
14
|
+
type: 'object',
|
|
15
|
+
properties: {
|
|
16
|
+
method: { type: 'string', description: 'HTTP method' },
|
|
17
|
+
route: { type: 'string', description: 'Matched route path, or the raw path when nothing matched' },
|
|
18
|
+
stats: RequestStatsSnapshot_schema_js_1.default,
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
exports.default = RoutesResponseSchema;
|
|
25
|
+
//# sourceMappingURL=RoutesResponse.schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RoutesResponse.schema.js","sourceRoot":"","sources":["../../../src/schemas/RoutesResponse.schema.ts"],"names":[],"mappings":";;;;;AAAA,sGAA0E;AAE1E,MAAM,oBAAoB,GAAG;IAC3B,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE;QACV,SAAS,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE,sEAAsE,EAAE;QACnH,MAAM,EAAE;YACN,IAAI,EAAE,OAAO;YACb,KAAK,EAAE;gBACL,IAAI,EAAE,QAAQ;gBACd,UAAU,EAAE;oBACV,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,aAAa,EAAE;oBACtD,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,0DAA0D,EAAE;oBAClG,KAAK,EAAE,wCAA0B;iBAClC;aACF;SACF;KACF;CACF,CAAC;AAEF,kBAAe,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
declare const StatsResponseSchema: {
|
|
2
|
+
type: string;
|
|
3
|
+
properties: {
|
|
4
|
+
all: {
|
|
5
|
+
description: string;
|
|
6
|
+
type: string;
|
|
7
|
+
properties: {
|
|
8
|
+
requests: {
|
|
9
|
+
type: string;
|
|
10
|
+
description: string;
|
|
11
|
+
};
|
|
12
|
+
responses: {
|
|
13
|
+
type: string;
|
|
14
|
+
description: string;
|
|
15
|
+
};
|
|
16
|
+
errors: {
|
|
17
|
+
type: string;
|
|
18
|
+
description: string;
|
|
19
|
+
};
|
|
20
|
+
info: {
|
|
21
|
+
type: string;
|
|
22
|
+
description: string;
|
|
23
|
+
};
|
|
24
|
+
success: {
|
|
25
|
+
type: string;
|
|
26
|
+
description: string;
|
|
27
|
+
};
|
|
28
|
+
redirect: {
|
|
29
|
+
type: string;
|
|
30
|
+
description: string;
|
|
31
|
+
};
|
|
32
|
+
client_error: {
|
|
33
|
+
type: string;
|
|
34
|
+
description: string;
|
|
35
|
+
};
|
|
36
|
+
server_error: {
|
|
37
|
+
type: string;
|
|
38
|
+
description: string;
|
|
39
|
+
};
|
|
40
|
+
total_time: {
|
|
41
|
+
type: string;
|
|
42
|
+
description: string;
|
|
43
|
+
};
|
|
44
|
+
max_time: {
|
|
45
|
+
type: string;
|
|
46
|
+
description: string;
|
|
47
|
+
};
|
|
48
|
+
min_time: {
|
|
49
|
+
type: string;
|
|
50
|
+
description: string;
|
|
51
|
+
};
|
|
52
|
+
avg_time: {
|
|
53
|
+
type: string;
|
|
54
|
+
description: string;
|
|
55
|
+
};
|
|
56
|
+
apdex_satisfied: {
|
|
57
|
+
type: string;
|
|
58
|
+
description: string;
|
|
59
|
+
};
|
|
60
|
+
apdex_tolerated: {
|
|
61
|
+
type: string;
|
|
62
|
+
description: string;
|
|
63
|
+
};
|
|
64
|
+
apdex_score: {
|
|
65
|
+
type: string;
|
|
66
|
+
description: string;
|
|
67
|
+
};
|
|
68
|
+
req_rate: {
|
|
69
|
+
type: string;
|
|
70
|
+
description: string;
|
|
71
|
+
};
|
|
72
|
+
err_rate: {
|
|
73
|
+
type: string;
|
|
74
|
+
description: string;
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
timeline: {
|
|
79
|
+
type: string;
|
|
80
|
+
description: string;
|
|
81
|
+
additionalProperties: {
|
|
82
|
+
type: string;
|
|
83
|
+
properties: {
|
|
84
|
+
requests: {
|
|
85
|
+
type: string;
|
|
86
|
+
description: string;
|
|
87
|
+
};
|
|
88
|
+
responses: {
|
|
89
|
+
type: string;
|
|
90
|
+
description: string;
|
|
91
|
+
};
|
|
92
|
+
errors: {
|
|
93
|
+
type: string;
|
|
94
|
+
description: string;
|
|
95
|
+
};
|
|
96
|
+
info: {
|
|
97
|
+
type: string;
|
|
98
|
+
description: string;
|
|
99
|
+
};
|
|
100
|
+
success: {
|
|
101
|
+
type: string;
|
|
102
|
+
description: string;
|
|
103
|
+
};
|
|
104
|
+
redirect: {
|
|
105
|
+
type: string;
|
|
106
|
+
description: string;
|
|
107
|
+
};
|
|
108
|
+
client_error: {
|
|
109
|
+
type: string;
|
|
110
|
+
description: string;
|
|
111
|
+
};
|
|
112
|
+
server_error: {
|
|
113
|
+
type: string;
|
|
114
|
+
description: string;
|
|
115
|
+
};
|
|
116
|
+
total_time: {
|
|
117
|
+
type: string;
|
|
118
|
+
description: string;
|
|
119
|
+
};
|
|
120
|
+
max_time: {
|
|
121
|
+
type: string;
|
|
122
|
+
description: string;
|
|
123
|
+
};
|
|
124
|
+
min_time: {
|
|
125
|
+
type: string;
|
|
126
|
+
description: string;
|
|
127
|
+
};
|
|
128
|
+
avg_time: {
|
|
129
|
+
type: string;
|
|
130
|
+
description: string;
|
|
131
|
+
};
|
|
132
|
+
apdex_satisfied: {
|
|
133
|
+
type: string;
|
|
134
|
+
description: string;
|
|
135
|
+
};
|
|
136
|
+
apdex_tolerated: {
|
|
137
|
+
type: string;
|
|
138
|
+
description: string;
|
|
139
|
+
};
|
|
140
|
+
apdex_score: {
|
|
141
|
+
type: string;
|
|
142
|
+
description: string;
|
|
143
|
+
};
|
|
144
|
+
req_rate: {
|
|
145
|
+
type: string;
|
|
146
|
+
description: string;
|
|
147
|
+
};
|
|
148
|
+
err_rate: {
|
|
149
|
+
type: string;
|
|
150
|
+
description: string;
|
|
151
|
+
};
|
|
152
|
+
};
|
|
153
|
+
};
|
|
154
|
+
};
|
|
155
|
+
};
|
|
156
|
+
};
|
|
157
|
+
export default StatsResponseSchema;
|
|
158
|
+
//# sourceMappingURL=StatsResponse.schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StatsResponse.schema.d.ts","sourceRoot":"","sources":["../../../src/schemas/StatsResponse.schema.ts"],"names":[],"mappings":"AAEA,QAAA,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAUxB,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const RequestStatsSnapshot_schema_js_1 = __importDefault(require("./RequestStatsSnapshot.schema.js"));
|
|
7
|
+
const StatsResponseSchema = {
|
|
8
|
+
type: 'object',
|
|
9
|
+
properties: {
|
|
10
|
+
all: { ...RequestStatsSnapshot_schema_js_1.default, description: 'Lifetime request stats' },
|
|
11
|
+
timeline: {
|
|
12
|
+
type: 'object',
|
|
13
|
+
description: 'Rolling per-bucket stats, keyed by floor( timestamp / bucketMs )',
|
|
14
|
+
additionalProperties: RequestStatsSnapshot_schema_js_1.default,
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
exports.default = StatsResponseSchema;
|
|
19
|
+
//# sourceMappingURL=StatsResponse.schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StatsResponse.schema.js","sourceRoot":"","sources":["../../../src/schemas/StatsResponse.schema.ts"],"names":[],"mappings":";;;;;AAAA,sGAA0E;AAE1E,MAAM,mBAAmB,GAAG;IAC1B,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE;QACV,GAAG,EAAE,EAAE,GAAG,wCAA0B,EAAE,WAAW,EAAE,wBAAwB,EAAE;QAC7E,QAAQ,EAAE;YACR,IAAI,EAAE,QAAQ;YACd,WAAW,EAAE,kEAAkE;YAC/E,oBAAoB,EAAE,wCAA0B;SACjD;KACF;CACF,CAAC;AAEF,kBAAe,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
declare const TimelineResponseSchema: {
|
|
2
|
+
type: string;
|
|
3
|
+
properties: {
|
|
4
|
+
bucketMs: {
|
|
5
|
+
type: string;
|
|
6
|
+
description: string;
|
|
7
|
+
};
|
|
8
|
+
length: {
|
|
9
|
+
type: string;
|
|
10
|
+
description: string;
|
|
11
|
+
};
|
|
12
|
+
buckets: {
|
|
13
|
+
type: string;
|
|
14
|
+
description: string;
|
|
15
|
+
items: {
|
|
16
|
+
type: string;
|
|
17
|
+
properties: {
|
|
18
|
+
key: {
|
|
19
|
+
type: string;
|
|
20
|
+
description: string;
|
|
21
|
+
};
|
|
22
|
+
from: {
|
|
23
|
+
type: string;
|
|
24
|
+
description: string;
|
|
25
|
+
};
|
|
26
|
+
to: {
|
|
27
|
+
type: string;
|
|
28
|
+
description: string;
|
|
29
|
+
};
|
|
30
|
+
stats: {
|
|
31
|
+
type: string;
|
|
32
|
+
properties: {
|
|
33
|
+
requests: {
|
|
34
|
+
type: string;
|
|
35
|
+
description: string;
|
|
36
|
+
};
|
|
37
|
+
responses: {
|
|
38
|
+
type: string;
|
|
39
|
+
description: string;
|
|
40
|
+
};
|
|
41
|
+
errors: {
|
|
42
|
+
type: string;
|
|
43
|
+
description: string;
|
|
44
|
+
};
|
|
45
|
+
info: {
|
|
46
|
+
type: string;
|
|
47
|
+
description: string;
|
|
48
|
+
};
|
|
49
|
+
success: {
|
|
50
|
+
type: string;
|
|
51
|
+
description: string;
|
|
52
|
+
};
|
|
53
|
+
redirect: {
|
|
54
|
+
type: string;
|
|
55
|
+
description: string;
|
|
56
|
+
};
|
|
57
|
+
client_error: {
|
|
58
|
+
type: string;
|
|
59
|
+
description: string;
|
|
60
|
+
};
|
|
61
|
+
server_error: {
|
|
62
|
+
type: string;
|
|
63
|
+
description: string;
|
|
64
|
+
};
|
|
65
|
+
total_time: {
|
|
66
|
+
type: string;
|
|
67
|
+
description: string;
|
|
68
|
+
};
|
|
69
|
+
max_time: {
|
|
70
|
+
type: string;
|
|
71
|
+
description: string;
|
|
72
|
+
};
|
|
73
|
+
min_time: {
|
|
74
|
+
type: string;
|
|
75
|
+
description: string;
|
|
76
|
+
};
|
|
77
|
+
avg_time: {
|
|
78
|
+
type: string;
|
|
79
|
+
description: string;
|
|
80
|
+
};
|
|
81
|
+
apdex_satisfied: {
|
|
82
|
+
type: string;
|
|
83
|
+
description: string;
|
|
84
|
+
};
|
|
85
|
+
apdex_tolerated: {
|
|
86
|
+
type: string;
|
|
87
|
+
description: string;
|
|
88
|
+
};
|
|
89
|
+
apdex_score: {
|
|
90
|
+
type: string;
|
|
91
|
+
description: string;
|
|
92
|
+
};
|
|
93
|
+
req_rate: {
|
|
94
|
+
type: string;
|
|
95
|
+
description: string;
|
|
96
|
+
};
|
|
97
|
+
err_rate: {
|
|
98
|
+
type: string;
|
|
99
|
+
description: string;
|
|
100
|
+
};
|
|
101
|
+
};
|
|
102
|
+
};
|
|
103
|
+
};
|
|
104
|
+
};
|
|
105
|
+
};
|
|
106
|
+
};
|
|
107
|
+
};
|
|
108
|
+
export default TimelineResponseSchema;
|
|
109
|
+
//# sourceMappingURL=TimelineResponse.schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TimelineResponse.schema.d.ts","sourceRoot":"","sources":["../../../src/schemas/TimelineResponse.schema.ts"],"names":[],"mappings":"AAEA,QAAA,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmB3B,CAAC;AAEF,eAAe,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const RequestStatsSnapshot_schema_js_1 = __importDefault(require("./RequestStatsSnapshot.schema.js"));
|
|
7
|
+
const TimelineResponseSchema = {
|
|
8
|
+
type: 'object',
|
|
9
|
+
properties: {
|
|
10
|
+
bucketMs: { type: 'number', description: 'Bucket width in ms' },
|
|
11
|
+
length: { type: 'number', description: 'Number of buckets retained in the ring' },
|
|
12
|
+
buckets: {
|
|
13
|
+
type: 'array',
|
|
14
|
+
description: 'Live buckets, oldest first',
|
|
15
|
+
items: {
|
|
16
|
+
type: 'object',
|
|
17
|
+
properties: {
|
|
18
|
+
key: { type: 'number', description: 'floor( timestamp / bucketMs )' },
|
|
19
|
+
from: { type: 'number', description: 'Bucket start, epoch ms' },
|
|
20
|
+
to: { type: 'number', description: 'Bucket end, epoch ms' },
|
|
21
|
+
stats: RequestStatsSnapshot_schema_js_1.default,
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
exports.default = TimelineResponseSchema;
|
|
28
|
+
//# sourceMappingURL=TimelineResponse.schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TimelineResponse.schema.js","sourceRoot":"","sources":["../../../src/schemas/TimelineResponse.schema.ts"],"names":[],"mappings":";;;;;AAAA,sGAA0E;AAE1E,MAAM,sBAAsB,GAAG;IAC7B,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE;QACV,QAAQ,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,oBAAoB,EAAE;QAC/D,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,wCAAwC,EAAE;QACjF,OAAO,EAAE;YACP,IAAI,EAAE,OAAO;YACb,WAAW,EAAE,4BAA4B;YACzC,KAAK,EAAE;gBACL,IAAI,EAAE,QAAQ;gBACd,UAAU,EAAE;oBACV,GAAG,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,+BAA+B,EAAE;oBACrE,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,wBAAwB,EAAE;oBAC/D,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,sBAAsB,EAAE;oBAC3D,KAAK,EAAE,wCAA0B;iBAClC;aACF;SACF;KACF;CACF,CAAC;AAEF,kBAAe,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { AsyncService } from '@spinajs/di';
|
|
2
|
+
import { RequestStats } from './requestStats.js';
|
|
3
|
+
import { Timeline } from './timeline.js';
|
|
4
|
+
import { RouteStats } from './routeStats.js';
|
|
5
|
+
/**
|
|
6
|
+
* The single, process-wide home of the collected http telemetry aggregates.
|
|
7
|
+
*
|
|
8
|
+
* It exists because the writer and the reader are different objects:
|
|
9
|
+
* {@link TelemetryMiddleware} is an `@Injectable( ServerMiddleware )` and is
|
|
10
|
+
* therefore NOT a singleton — the instance express mounts is not the instance a
|
|
11
|
+
* controller gets from `@Autoinject`. Keeping the aggregates on the middleware
|
|
12
|
+
* meant the JSON endpoints read an object nothing ever wrote to. The middleware
|
|
13
|
+
* now only writes ( {@link record} ), the controller only reads, and both talk
|
|
14
|
+
* to this one `@Singleton()`.
|
|
15
|
+
*/
|
|
16
|
+
export declare class TelemetryStore extends AsyncService {
|
|
17
|
+
protected ApdexThresholdMs: number;
|
|
18
|
+
protected TimelineLength: number;
|
|
19
|
+
protected TimelineBucketMs: number;
|
|
20
|
+
protected RoutesMaxEntries: number;
|
|
21
|
+
/**
|
|
22
|
+
* Whether per-route stats are recorded. Read on the hot path, so it must stay
|
|
23
|
+
* a plain, DI-independent field ( a directly-instantiated store in a unit test
|
|
24
|
+
* has no resolved Configuration, and a `@Config` getter cannot be assigned ).
|
|
25
|
+
* Populated from `telemetry.routes.enabled` in `resolve()`.
|
|
26
|
+
*/
|
|
27
|
+
RoutesEnabled: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Epoch ms at which collection started. Used to compute the lifetime request
|
|
30
|
+
* / error rates.
|
|
31
|
+
*/
|
|
32
|
+
readonly StartedAt: number;
|
|
33
|
+
/**
|
|
34
|
+
* Lifetime request stats ( status classes, error rate, apdex ). Constructed
|
|
35
|
+
* with defaults here and rebuilt in `resolve()` once configuration is
|
|
36
|
+
* available, so a DI-less `new TelemetryStore()` is usable in unit tests.
|
|
37
|
+
*/
|
|
38
|
+
RequestStats: RequestStats;
|
|
39
|
+
/**
|
|
40
|
+
* Rolling timeline of request stats. Rebuilt in `resolve()`.
|
|
41
|
+
*/
|
|
42
|
+
Timeline: Timeline;
|
|
43
|
+
/**
|
|
44
|
+
* Per method+route breakdown. Rebuilt in `resolve()`.
|
|
45
|
+
*/
|
|
46
|
+
RouteStats: RouteStats;
|
|
47
|
+
resolve(): Promise<void>;
|
|
48
|
+
/**
|
|
49
|
+
* Record one completed response into every aggregate.
|
|
50
|
+
*
|
|
51
|
+
* @param method - http verb
|
|
52
|
+
* @param route - low-cardinality route label ( the matched route path )
|
|
53
|
+
* @param statusCode - response status
|
|
54
|
+
* @param durationMs - how long the request took
|
|
55
|
+
*/
|
|
56
|
+
record(method: string, route: string, statusCode: number, durationMs: number): void;
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../src/store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAA6B,MAAM,aAAa,CAAC;AAItE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C;;;;;;;;;;GAUG;AACH,qBAEa,cAAe,SAAQ,YAAY;IAE9C,SAAS,CAAC,gBAAgB,EAAG,MAAM,CAAC;IAGpC,SAAS,CAAC,cAAc,EAAG,MAAM,CAAC;IAGlC,SAAS,CAAC,gBAAgB,EAAG,MAAM,CAAC;IAGpC,SAAS,CAAC,gBAAgB,EAAG,MAAM,CAAC;IAEpC;;;;;OAKG;IACI,aAAa,UAAQ;IAE5B;;;OAGG;IACH,SAAgB,SAAS,SAAc;IAEvC;;;;OAIG;IACI,YAAY,eAAsB;IAEzC;;OAEG;IACI,QAAQ,WAAkB;IAEjC;;OAEG;IACI,UAAU,aAA2B;IAE/B,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAarC;;;;;;;OAOG;IACI,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,IAAI;CAS3F"}
|
package/lib/cjs/store.js
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.TelemetryStore = void 0;
|
|
13
|
+
const di_1 = require("@spinajs/di");
|
|
14
|
+
const configuration_1 = require("@spinajs/configuration");
|
|
15
|
+
const configuration_common_1 = require("@spinajs/configuration-common");
|
|
16
|
+
const requestStats_js_1 = require("./requestStats.js");
|
|
17
|
+
const timeline_js_1 = require("./timeline.js");
|
|
18
|
+
const routeStats_js_1 = require("./routeStats.js");
|
|
19
|
+
/**
|
|
20
|
+
* The single, process-wide home of the collected http telemetry aggregates.
|
|
21
|
+
*
|
|
22
|
+
* It exists because the writer and the reader are different objects:
|
|
23
|
+
* {@link TelemetryMiddleware} is an `@Injectable( ServerMiddleware )` and is
|
|
24
|
+
* therefore NOT a singleton — the instance express mounts is not the instance a
|
|
25
|
+
* controller gets from `@Autoinject`. Keeping the aggregates on the middleware
|
|
26
|
+
* meant the JSON endpoints read an object nothing ever wrote to. The middleware
|
|
27
|
+
* now only writes ( {@link record} ), the controller only reads, and both talk
|
|
28
|
+
* to this one `@Singleton()`.
|
|
29
|
+
*/
|
|
30
|
+
let TelemetryStore = class TelemetryStore extends di_1.AsyncService {
|
|
31
|
+
constructor() {
|
|
32
|
+
super(...arguments);
|
|
33
|
+
/**
|
|
34
|
+
* Whether per-route stats are recorded. Read on the hot path, so it must stay
|
|
35
|
+
* a plain, DI-independent field ( a directly-instantiated store in a unit test
|
|
36
|
+
* has no resolved Configuration, and a `@Config` getter cannot be assigned ).
|
|
37
|
+
* Populated from `telemetry.routes.enabled` in `resolve()`.
|
|
38
|
+
*/
|
|
39
|
+
this.RoutesEnabled = true;
|
|
40
|
+
/**
|
|
41
|
+
* Epoch ms at which collection started. Used to compute the lifetime request
|
|
42
|
+
* / error rates.
|
|
43
|
+
*/
|
|
44
|
+
this.StartedAt = Date.now();
|
|
45
|
+
/**
|
|
46
|
+
* Lifetime request stats ( status classes, error rate, apdex ). Constructed
|
|
47
|
+
* with defaults here and rebuilt in `resolve()` once configuration is
|
|
48
|
+
* available, so a DI-less `new TelemetryStore()` is usable in unit tests.
|
|
49
|
+
*/
|
|
50
|
+
this.RequestStats = new requestStats_js_1.RequestStats();
|
|
51
|
+
/**
|
|
52
|
+
* Rolling timeline of request stats. Rebuilt in `resolve()`.
|
|
53
|
+
*/
|
|
54
|
+
this.Timeline = new timeline_js_1.Timeline();
|
|
55
|
+
/**
|
|
56
|
+
* Per method+route breakdown. Rebuilt in `resolve()`.
|
|
57
|
+
*/
|
|
58
|
+
this.RouteStats = new routeStats_js_1.RouteStats(500, 25);
|
|
59
|
+
}
|
|
60
|
+
async resolve() {
|
|
61
|
+
await super.resolve();
|
|
62
|
+
// Rebuild the aggregates now that configuration is available.
|
|
63
|
+
this.RequestStats = new requestStats_js_1.RequestStats(this.ApdexThresholdMs);
|
|
64
|
+
this.Timeline = new timeline_js_1.Timeline(this.TimelineLength, this.TimelineBucketMs, this.ApdexThresholdMs);
|
|
65
|
+
this.RouteStats = new routeStats_js_1.RouteStats(this.RoutesMaxEntries, this.ApdexThresholdMs);
|
|
66
|
+
// RoutesEnabled is a hot-path field, not a @Config getter, so read it here.
|
|
67
|
+
const cfg = di_1.DI.get(configuration_common_1.Configuration);
|
|
68
|
+
this.RoutesEnabled = cfg?.get('telemetry.routes.enabled', true) ?? true;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Record one completed response into every aggregate.
|
|
72
|
+
*
|
|
73
|
+
* @param method - http verb
|
|
74
|
+
* @param route - low-cardinality route label ( the matched route path )
|
|
75
|
+
* @param statusCode - response status
|
|
76
|
+
* @param durationMs - how long the request took
|
|
77
|
+
*/
|
|
78
|
+
record(method, route, statusCode, durationMs) {
|
|
79
|
+
this.RequestStats.countRequest();
|
|
80
|
+
this.RequestStats.countResponse(statusCode, durationMs);
|
|
81
|
+
this.Timeline.record(statusCode, durationMs, Date.now());
|
|
82
|
+
if (this.RoutesEnabled !== false) {
|
|
83
|
+
this.RouteStats.record(method, route, statusCode, durationMs);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
exports.TelemetryStore = TelemetryStore;
|
|
88
|
+
__decorate([
|
|
89
|
+
(0, configuration_1.Config)('telemetry.apdexThresholdMs', { defaultValue: 25 }),
|
|
90
|
+
__metadata("design:type", Number)
|
|
91
|
+
], TelemetryStore.prototype, "ApdexThresholdMs", void 0);
|
|
92
|
+
__decorate([
|
|
93
|
+
(0, configuration_1.Config)('telemetry.timeline.length', { defaultValue: 60 }),
|
|
94
|
+
__metadata("design:type", Number)
|
|
95
|
+
], TelemetryStore.prototype, "TimelineLength", void 0);
|
|
96
|
+
__decorate([
|
|
97
|
+
(0, configuration_1.Config)('telemetry.timeline.bucketMs', { defaultValue: 60_000 }),
|
|
98
|
+
__metadata("design:type", Number)
|
|
99
|
+
], TelemetryStore.prototype, "TimelineBucketMs", void 0);
|
|
100
|
+
__decorate([
|
|
101
|
+
(0, configuration_1.Config)('telemetry.routes.maxEntries', { defaultValue: 500 }),
|
|
102
|
+
__metadata("design:type", Number)
|
|
103
|
+
], TelemetryStore.prototype, "RoutesMaxEntries", void 0);
|
|
104
|
+
exports.TelemetryStore = TelemetryStore = __decorate([
|
|
105
|
+
(0, di_1.Singleton)(),
|
|
106
|
+
(0, di_1.Injectable)()
|
|
107
|
+
], TelemetryStore);
|
|
108
|
+
//# sourceMappingURL=store.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store.js","sourceRoot":"","sources":["../../src/store.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oCAAsE;AACtE,0DAAgD;AAChD,wEAA8D;AAE9D,uDAAiD;AACjD,+CAAyC;AACzC,mDAA6C;AAE7C;;;;;;;;;;GAUG;AAGI,IAAM,cAAc,GAApB,MAAM,cAAe,SAAQ,iBAAY;IAAzC;;QAaL;;;;;WAKG;QACI,kBAAa,GAAG,IAAI,CAAC;QAE5B;;;WAGG;QACa,cAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QAEvC;;;;WAIG;QACI,iBAAY,GAAG,IAAI,8BAAY,EAAE,CAAC;QAEzC;;WAEG;QACI,aAAQ,GAAG,IAAI,sBAAQ,EAAE,CAAC;QAEjC;;WAEG;QACI,eAAU,GAAG,IAAI,0BAAU,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;IAgC9C,CAAC;IA9BQ,KAAK,CAAC,OAAO;QAClB,MAAM,KAAK,CAAC,OAAO,EAAE,CAAC;QAEtB,8DAA8D;QAC9D,IAAI,CAAC,YAAY,GAAG,IAAI,8BAAY,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;QAC5D,IAAI,CAAC,QAAQ,GAAG,IAAI,sBAAQ,CAAC,IAAI,CAAC,cAAc,EAAE,IAAI,CAAC,gBAAgB,EAAE,IAAI,CAAC,gBAAgB,CAAC,CAAC;QAChG,IAAI,CAAC,UAAU,GAAG,IAAI,0BAAU,CAAC,IAAI,CAAC,gBAAgB,EAAE,IAAI,CAAC,gBAAgB,CAAC,CAAC;QAE/E,4EAA4E;QAC5E,MAAM,GAAG,GAAG,OAAE,CAAC,GAAG,CAAC,oCAAa,CAAC,CAAC;QAClC,IAAI,CAAC,aAAa,GAAG,GAAG,EAAE,GAAG,CAAC,0BAA0B,EAAE,IAAI,CAAC,IAAI,IAAI,CAAC;IAC1E,CAAC;IAED;;;;;;;OAOG;IACI,MAAM,CAAC,MAAc,EAAE,KAAa,EAAE,UAAkB,EAAE,UAAkB;QACjF,IAAI,CAAC,YAAY,CAAC,YAAY,EAAE,CAAC;QACjC,IAAI,CAAC,YAAY,CAAC,aAAa,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;QACxD,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,UAAU,EAAE,UAAU,EAAE,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC;QAEzD,IAAI,IAAI,CAAC,aAAa,KAAK,KAAK,EAAE,CAAC;YACjC,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC;QAChE,CAAC;IACH,CAAC;CACF,CAAA;AA1EY,wCAAc;AAEf;IADT,IAAA,sBAAM,EAAC,4BAA4B,EAAE,EAAE,YAAY,EAAE,EAAE,EAAE,CAAC;;wDACvB;AAG1B;IADT,IAAA,sBAAM,EAAC,2BAA2B,EAAE,EAAE,YAAY,EAAE,EAAE,EAAE,CAAC;;sDACxB;AAGxB;IADT,IAAA,sBAAM,EAAC,6BAA6B,EAAE,EAAE,YAAY,EAAE,MAAM,EAAE,CAAC;;wDAC5B;AAG1B;IADT,IAAA,sBAAM,EAAC,6BAA6B,EAAE,EAAE,YAAY,EAAE,GAAG,EAAE,CAAC;;wDACzB;yBAXzB,cAAc;IAF1B,IAAA,cAAS,GAAE;IACX,IAAA,eAAU,GAAE;GACA,cAAc,CA0E1B"}
|