@interopio/insights-metrics 0.0.188 → 0.1.0
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/constants.d.ts +27 -27
- package/dist/constants.js +30 -30
- package/dist/factory/builder.d.ts +34 -34
- package/dist/factory/builder.js +296 -296
- package/dist/factory/factory.d.ts +10 -10
- package/dist/factory/factory.js +82 -82
- package/dist/factory/factory.js.map +1 -1
- package/dist/index.d.ts +5 -5
- package/dist/index.js +47 -47
- package/dist/index.js.map +1 -1
- package/dist/manager.d.ts +26 -26
- package/dist/manager.js +165 -167
- package/dist/manager.js.map +1 -1
- package/dist/meter/lazyProvider.d.ts +15 -15
- package/dist/meter/lazyProvider.js +35 -35
- package/dist/meter/lazyProvider.js.map +1 -1
- package/dist/meter/providerFactory.d.ts +6 -6
- package/dist/meter/providerFactory.js +47 -47
- package/dist/meter/providerFactory.js.map +1 -1
- package/dist/metrics/application/count.d.ts +19 -19
- package/dist/metrics/application/count.js +68 -68
- package/dist/metrics/application/count.js.map +1 -1
- package/dist/metrics/application/cpu.d.ts +10 -10
- package/dist/metrics/application/cpu.js +47 -47
- package/dist/metrics/application/cpu.js.map +1 -1
- package/dist/metrics/application/crash.d.ts +16 -16
- package/dist/metrics/application/crash.js +48 -48
- package/dist/metrics/application/crash.js.map +1 -1
- package/dist/metrics/application/duration.d.ts +25 -25
- package/dist/metrics/application/duration.js +104 -104
- package/dist/metrics/application/duration.js.map +1 -1
- package/dist/metrics/application/durationSoft.d.ts +4 -4
- package/dist/metrics/application/durationSoft.js +33 -33
- package/dist/metrics/application/durationSoft.js.map +1 -1
- package/dist/metrics/application/error.d.ts +16 -16
- package/dist/metrics/application/error.js +48 -48
- package/dist/metrics/application/error.js.map +1 -1
- package/dist/metrics/application/memory.d.ts +11 -11
- package/dist/metrics/application/memory.js +49 -49
- package/dist/metrics/application/memory.js.map +1 -1
- package/dist/metrics/application/started.d.ts +16 -16
- package/dist/metrics/application/started.js +48 -48
- package/dist/metrics/application/started.js.map +1 -1
- package/dist/metrics/application/startup.d.ts +16 -16
- package/dist/metrics/application/startup.js +49 -49
- package/dist/metrics/application/startup.js.map +1 -1
- package/dist/metrics/application/stopped.d.ts +16 -16
- package/dist/metrics/application/stopped.js +48 -48
- package/dist/metrics/application/stopped.js.map +1 -1
- package/dist/metrics/base/base.d.ts +28 -28
- package/dist/metrics/base/base.js +181 -180
- package/dist/metrics/base/base.js.map +1 -1
- package/dist/metrics/base/observable.d.ts +19 -19
- package/dist/metrics/base/observable.js +88 -88
- package/dist/metrics/base/observable.js.map +1 -1
- package/dist/metrics/base/observableGauge.d.ts +6 -6
- package/dist/metrics/base/observableGauge.js +11 -11
- package/dist/metrics/base/zeroOutClosedAppObservableGaugeMetricBase.d.ts +12 -12
- package/dist/metrics/base/zeroOutClosedAppObservableGaugeMetricBase.js +38 -38
- package/dist/metrics/base/zeroOutClosedAppObservableGaugeMetricBase.js.map +1 -1
- package/dist/metrics/custom/customCounter.d.ts +10 -10
- package/dist/metrics/custom/customCounter.js +23 -23
- package/dist/metrics/custom/customCounter.js.map +1 -1
- package/dist/metrics/custom/customGauge.d.ts +10 -10
- package/dist/metrics/custom/customGauge.js +23 -23
- package/dist/metrics/custom/customGauge.js.map +1 -1
- package/dist/metrics/custom/customHistogram.d.ts +10 -10
- package/dist/metrics/custom/customHistogram.js +23 -23
- package/dist/metrics/custom/customHistogram.js.map +1 -1
- package/dist/metrics/custom/customObservableCounter.d.ts +6 -6
- package/dist/metrics/custom/customObservableCounter.js +12 -12
- package/dist/metrics/custom/customObservableGauge.d.ts +6 -6
- package/dist/metrics/custom/customObservableGauge.js +12 -12
- package/dist/metrics/custom/customObservableUpDownCounter.d.ts +6 -6
- package/dist/metrics/custom/customObservableUpDownCounter.js +12 -12
- package/dist/metrics/custom/customUpDownCounter.d.ts +10 -10
- package/dist/metrics/custom/customUpDownCounter.js +23 -23
- package/dist/metrics/custom/customUpDownCounter.js.map +1 -1
- package/dist/metrics/layout/startup.d.ts +15 -15
- package/dist/metrics/layout/startup.js +46 -46
- package/dist/metrics/layout/startup.js.map +1 -1
- package/dist/metrics/platform/error.d.ts +15 -15
- package/dist/metrics/platform/error.js +46 -46
- package/dist/metrics/platform/error.js.map +1 -1
- package/dist/metrics/platform/startup.d.ts +16 -16
- package/dist/metrics/platform/startup.js +46 -46
- package/dist/metrics/platform/startup.js.map +1 -1
- package/dist/metrics/system/cpu.d.ts +10 -10
- package/dist/metrics/system/cpu.js +49 -49
- package/dist/metrics/system/cpu.js.map +1 -1
- package/dist/metrics/system/memory.d.ts +10 -10
- package/dist/metrics/system/memory.js +50 -50
- package/dist/metrics/system/memory.js.map +1 -1
- package/dist/metrics/workspace/count.d.ts +23 -23
- package/dist/metrics/workspace/count.js +93 -93
- package/dist/metrics/workspace/count.js.map +1 -1
- package/dist/metrics/workspace/selected.d.ts +14 -14
- package/dist/metrics/workspace/selected.js +46 -46
- package/dist/metrics/workspace/selected.js.map +1 -1
- package/dist/metrics/workspace/started.d.ts +17 -17
- package/dist/metrics/workspace/started.js +48 -48
- package/dist/metrics/workspace/started.js.map +1 -1
- package/dist/metrics/workspace/startupLegacy.d.ts +8 -8
- package/dist/metrics/workspace/startupLegacy.js +19 -19
- package/dist/metrics/workspace/stopped.d.ts +15 -15
- package/dist/metrics/workspace/stopped.js +45 -45
- package/dist/metrics/workspace/stopped.js.map +1 -1
- package/dist/metrics/workspace/timedGauge.d.ts +14 -14
- package/dist/metrics/workspace/timedGauge.js +53 -53
- package/dist/metrics/workspace/timedGauge.js.map +1 -1
- package/dist/settings/builder.d.ts +26 -26
- package/dist/settings/builder.js +141 -141
- package/dist/settings/builder.js.map +1 -1
- package/dist/settings/default.d.ts +41 -41
- package/dist/settings/default.js +179 -179
- package/dist/settings/default.js.map +1 -1
- package/dist/utils.d.ts +2 -2
- package/dist/utils.js +49 -50
- package/dist/utils.js.map +1 -1
- package/dist/validation/builder.d.ts +4 -4
- package/dist/validation/builder.js +11 -11
- package/dist/validation/container.d.ts +4 -4
- package/dist/validation/container.js +13 -13
- package/dist/validation/metrics/application/count.d.ts +7 -7
- package/dist/validation/metrics/application/count.js +20 -20
- package/dist/validation/metrics/application/duration.d.ts +6 -6
- package/dist/validation/metrics/application/duration.js +16 -16
- package/dist/validation/metrics/application/error.d.ts +6 -6
- package/dist/validation/metrics/application/error.js +15 -15
- package/dist/validation/metrics/application/started.d.ts +6 -6
- package/dist/validation/metrics/application/started.js +15 -15
- package/dist/validation/metrics/application/startupHistogram.d.ts +6 -6
- package/dist/validation/metrics/application/startupHistogram.js +17 -17
- package/dist/validation/metrics/application/stopped.d.ts +6 -6
- package/dist/validation/metrics/application/stopped.js +15 -15
- package/dist/validation/metrics/base/base.d.ts +5 -5
- package/dist/validation/metrics/base/base.js +21 -21
- package/dist/validation/metrics/base/gauge.d.ts +5 -5
- package/dist/validation/metrics/base/gauge.js +11 -11
- package/dist/validation/metrics/builder.d.ts +2 -2
- package/dist/validation/metrics/builder.js +6 -6
- package/dist/validation/metrics/factory.d.ts +4 -4
- package/dist/validation/metrics/factory.js +12 -12
- package/dist/validation/metrics/factoryBuilder.d.ts +5 -5
- package/dist/validation/metrics/factoryBuilder.js +22 -22
- package/dist/validation/metrics/layout/startupHistogram.d.ts +6 -6
- package/dist/validation/metrics/layout/startupHistogram.js +17 -17
- package/dist/validation/metrics/manager.d.ts +4 -4
- package/dist/validation/metrics/manager.js +14 -14
- package/dist/validation/metrics/meterFactory.d.ts +2 -2
- package/dist/validation/metrics/meterFactory.js +7 -7
- package/dist/validation/metrics/perf.d.ts +8 -8
- package/dist/validation/metrics/perf.js +40 -40
- package/dist/validation/metrics/platform/crash.d.ts +6 -6
- package/dist/validation/metrics/platform/crash.js +15 -15
- package/dist/validation/metrics/platform/error.d.ts +6 -6
- package/dist/validation/metrics/platform/error.js +14 -14
- package/dist/validation/metrics/platform/startup.d.ts +6 -6
- package/dist/validation/metrics/platform/startup.js +17 -17
- package/dist/validation/metrics/settingsBuilder.d.ts +4 -4
- package/dist/validation/metrics/settingsBuilder.js +25 -25
- package/dist/validation/metrics/workspace/count.d.ts +8 -8
- package/dist/validation/metrics/workspace/count.js +24 -24
- package/dist/validation/metrics/workspace/startedOrStoppedMetric.d.ts +8 -8
- package/dist/validation/metrics/workspace/startedOrStoppedMetric.js +18 -18
- package/dist/validation/validator.d.ts +4 -4
- package/dist/validation/validator.js +14 -14
- package/dist/validation/validator.js.map +1 -1
- package/package.json +17 -15
package/dist/factory/builder.js
CHANGED
|
@@ -1,297 +1,297 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MetricsFactoryBuilder = void 0;
|
|
4
|
-
const factoryBuilder_1 = require("../validation/metrics/factoryBuilder");
|
|
5
|
-
const factory_1 = require("./factory");
|
|
6
|
-
const count_1 = require("../metrics/application/count");
|
|
7
|
-
const cpu_1 = require("../metrics/application/cpu");
|
|
8
|
-
const crash_1 = require("../metrics/application/crash");
|
|
9
|
-
const duration_1 = require("../metrics/application/duration");
|
|
10
|
-
const durationSoft_1 = require("../metrics/application/durationSoft");
|
|
11
|
-
const error_1 = require("../metrics/application/error");
|
|
12
|
-
const memory_1 = require("../metrics/application/memory");
|
|
13
|
-
const started_1 = require("../metrics/application/started");
|
|
14
|
-
const startup_1 = require("../metrics/application/startup");
|
|
15
|
-
const stopped_1 = require("../metrics/application/stopped");
|
|
16
|
-
const startup_2 = require("../metrics/layout/startup");
|
|
17
|
-
const error_2 = require("../metrics/platform/error");
|
|
18
|
-
const startup_3 = require("../metrics/platform/startup");
|
|
19
|
-
const cpu_2 = require("../metrics/system/cpu");
|
|
20
|
-
const memory_2 = require("../metrics/system/memory");
|
|
21
|
-
const count_2 = require("../metrics/workspace/count");
|
|
22
|
-
const started_2 = require("../metrics/workspace/started");
|
|
23
|
-
const startupLegacy_1 = require("../metrics/workspace/startupLegacy");
|
|
24
|
-
const stopped_2 = require("../metrics/workspace/stopped");
|
|
25
|
-
const selected_1 = require("../metrics/workspace/selected");
|
|
26
|
-
const timedGauge_1 = require("../metrics/workspace/timedGauge");
|
|
27
|
-
class MetricsFactoryBuilder {
|
|
28
|
-
constructor(lazyMeterProvider, dependencyContainer, logger) {
|
|
29
|
-
this.lazyMeterProvider = lazyMeterProvider;
|
|
30
|
-
this.dependencyContainer = dependencyContainer;
|
|
31
|
-
this.logger = logger;
|
|
32
|
-
this.metricsFactories = new Map();
|
|
33
|
-
this.metricsFactories = new Map();
|
|
34
|
-
}
|
|
35
|
-
get meter() {
|
|
36
|
-
const meter = this.lazyMeterProvider.getMeter();
|
|
37
|
-
return meter;
|
|
38
|
-
}
|
|
39
|
-
build() {
|
|
40
|
-
const validator = new factoryBuilder_1.MetricsFactoryBuilderValidator();
|
|
41
|
-
validator.validate(this);
|
|
42
|
-
const metricsFactory = new factory_1.MetricsFactory(this.logger, this.metricsFactories, this.meter);
|
|
43
|
-
return metricsFactory;
|
|
44
|
-
}
|
|
45
|
-
withDefaults() {
|
|
46
|
-
return this
|
|
47
|
-
.withAppStarted()
|
|
48
|
-
.withAppStopped()
|
|
49
|
-
.withAppStartup()
|
|
50
|
-
.withAppCount()
|
|
51
|
-
.withAppDuration()
|
|
52
|
-
.withAppDurationSoft()
|
|
53
|
-
.withAppMemory()
|
|
54
|
-
.withAppCPU()
|
|
55
|
-
.withSystemMemory()
|
|
56
|
-
.withSystemCPU()
|
|
57
|
-
.withAppError()
|
|
58
|
-
.withAppCrash()
|
|
59
|
-
.withLayoutStartup()
|
|
60
|
-
.withWorkspaceStartupLegacy()
|
|
61
|
-
.withWorkspaceStarted()
|
|
62
|
-
.withWorkspaceStopped()
|
|
63
|
-
.withWorkspaceSelected()
|
|
64
|
-
.withWorkspaceCount()
|
|
65
|
-
// G4E-9759
|
|
66
|
-
.withWorkspaceMetric("workspace_startup", dc => dc.workspaceStartupHandler, [
|
|
67
|
-
{
|
|
68
|
-
attributes: {
|
|
69
|
-
complexLoad: true
|
|
70
|
-
},
|
|
71
|
-
enabled: false
|
|
72
|
-
}
|
|
73
|
-
])
|
|
74
|
-
.withWorkspaceMetric("workspace_startup_frame", dc => dc.workspaceFrameCreatedHandler, [
|
|
75
|
-
{
|
|
76
|
-
attributes: {
|
|
77
|
-
complexLoad: true
|
|
78
|
-
},
|
|
79
|
-
enabled: false
|
|
80
|
-
}
|
|
81
|
-
])
|
|
82
|
-
.withWorkspaceMetric("workspace_startup_frame_init", dc => dc.workspaceFrameInitHandler, [
|
|
83
|
-
{
|
|
84
|
-
attributes: {
|
|
85
|
-
complexLoad: true
|
|
86
|
-
},
|
|
87
|
-
enabled: false
|
|
88
|
-
}
|
|
89
|
-
])
|
|
90
|
-
.withWorkspaceMetric("workspace_startup_frame_page_load", dc => dc.workspaceFramePageLoadHandler, [
|
|
91
|
-
{
|
|
92
|
-
attributes: {
|
|
93
|
-
complexLoad: true
|
|
94
|
-
},
|
|
95
|
-
enabled: false
|
|
96
|
-
}
|
|
97
|
-
])
|
|
98
|
-
.withWorkspaceMetric("workspace_startup_frame_workspace_render", dc => dc.workspaceFrameWorkspaceRenderHandler, [
|
|
99
|
-
{
|
|
100
|
-
attributes: {
|
|
101
|
-
complexLoad: true
|
|
102
|
-
},
|
|
103
|
-
enabled: false
|
|
104
|
-
}
|
|
105
|
-
])
|
|
106
|
-
.withWorkspaceMetric("workspace_startup_component", dc => dc.workspaceComponentCreatedHandler, [
|
|
107
|
-
{
|
|
108
|
-
attributes: {
|
|
109
|
-
complexLoad: true
|
|
110
|
-
},
|
|
111
|
-
enabled: false
|
|
112
|
-
}
|
|
113
|
-
])
|
|
114
|
-
.withWorkspaceMetric("workspace_startup_apps", dc => dc.workspaceAppsStartedHandler, [
|
|
115
|
-
{
|
|
116
|
-
attributes: {
|
|
117
|
-
complexLoad: true
|
|
118
|
-
},
|
|
119
|
-
enabled: false
|
|
120
|
-
}
|
|
121
|
-
])
|
|
122
|
-
.withPlatformStartup()
|
|
123
|
-
.withPlatformError();
|
|
124
|
-
}
|
|
125
|
-
withWorkspaceMetric(name, handler, defaultFilters,
|
|
126
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
127
|
-
getAttributes) {
|
|
128
|
-
const func = (settings, generalSettings) => {
|
|
129
|
-
const metric = new timedGauge_1.WorkspaceTimedGaugeMetric(settings, generalSettings, this.meter, this.logger, handler(this.dependencyContainer), defaultFilters, getAttributes);
|
|
130
|
-
return metric;
|
|
131
|
-
};
|
|
132
|
-
this.metricsFactories.set(name, func.bind(this));
|
|
133
|
-
return this;
|
|
134
|
-
}
|
|
135
|
-
withAppStarted() {
|
|
136
|
-
const func = (settings, generalSettings) => {
|
|
137
|
-
const metric = new started_1.ApplicationStartedMetric(settings, this.meter, this.logger, generalSettings, this.dependencyContainer.instanceStartedHandler);
|
|
138
|
-
return metric;
|
|
139
|
-
};
|
|
140
|
-
this.metricsFactories.set("app_started", func.bind(this));
|
|
141
|
-
return this;
|
|
142
|
-
}
|
|
143
|
-
withAppStopped() {
|
|
144
|
-
const func = (settings, generalSettings) => {
|
|
145
|
-
const metric = new stopped_1.ApplicationStoppedMetric(settings, this.meter, this.logger, generalSettings, this.dependencyContainer.instanceStoppedHandler);
|
|
146
|
-
return metric;
|
|
147
|
-
};
|
|
148
|
-
this.metricsFactories.set("app_stopped", func.bind(this));
|
|
149
|
-
return this;
|
|
150
|
-
}
|
|
151
|
-
withAppStartup() {
|
|
152
|
-
const func = (settings, generalSettings) => {
|
|
153
|
-
const metric = new startup_1.ApplicationStartupMetric(settings, this.meter, this.logger, generalSettings, this.dependencyContainer.instanceReadyHandler);
|
|
154
|
-
return metric;
|
|
155
|
-
};
|
|
156
|
-
this.metricsFactories.set("app_startup", func.bind(this));
|
|
157
|
-
return this;
|
|
158
|
-
}
|
|
159
|
-
withAppCount() {
|
|
160
|
-
const func = (settings, generalSettings) => {
|
|
161
|
-
const metric = new count_1.ApplicationCountMetric(settings, this.meter, this.logger, generalSettings, this.dependencyContainer.instanceStartedHandler, this.dependencyContainer.instanceStoppedHandler);
|
|
162
|
-
return metric;
|
|
163
|
-
};
|
|
164
|
-
this.metricsFactories.set("app_count", func.bind(this));
|
|
165
|
-
return this;
|
|
166
|
-
}
|
|
167
|
-
withAppDuration() {
|
|
168
|
-
const func = (settings, generalSettings) => {
|
|
169
|
-
const metric = new duration_1.ApplicationDurationMetric(settings, this.meter, this.logger, generalSettings, this.dependencyContainer.instanceFocusedHandler);
|
|
170
|
-
return metric;
|
|
171
|
-
};
|
|
172
|
-
this.metricsFactories.set("app_duration", func.bind(this));
|
|
173
|
-
return this;
|
|
174
|
-
}
|
|
175
|
-
withAppDurationSoft() {
|
|
176
|
-
const func = (settings, generalSettings) => {
|
|
177
|
-
const metric = new durationSoft_1.ApplicationDurationSoftMetric(settings, this.meter, this.logger, generalSettings, this.dependencyContainer.instanceFocusedHandler);
|
|
178
|
-
return metric;
|
|
179
|
-
};
|
|
180
|
-
this.metricsFactories.set("app_duration_soft", func.bind(this));
|
|
181
|
-
return this;
|
|
182
|
-
}
|
|
183
|
-
withAppMemory() {
|
|
184
|
-
const func = (settings, generalSettings) => {
|
|
185
|
-
const metric = new memory_1.ApplicationMemoryMetric(settings, this.meter, this.logger, generalSettings, this.dependencyContainer.performanceProvider);
|
|
186
|
-
return metric;
|
|
187
|
-
};
|
|
188
|
-
this.metricsFactories.set("app_memory", func.bind(this));
|
|
189
|
-
return this;
|
|
190
|
-
}
|
|
191
|
-
withAppCPU() {
|
|
192
|
-
const func = (settings, generalSettings) => {
|
|
193
|
-
const metric = new cpu_1.ApplicationCPUMetric(settings, this.meter, this.logger, generalSettings, this.dependencyContainer.performanceProvider);
|
|
194
|
-
return metric;
|
|
195
|
-
};
|
|
196
|
-
this.metricsFactories.set("app_cpu", func.bind(this));
|
|
197
|
-
return this;
|
|
198
|
-
}
|
|
199
|
-
withAppError() {
|
|
200
|
-
const func = (settings, generalSettings) => {
|
|
201
|
-
const metric = new error_1.ApplicationErrorMetric(settings, this.meter, this.logger, generalSettings, this.dependencyContainer.instanceErrorHandler);
|
|
202
|
-
return metric;
|
|
203
|
-
};
|
|
204
|
-
this.metricsFactories.set("app_error", func.bind(this));
|
|
205
|
-
return this;
|
|
206
|
-
}
|
|
207
|
-
withAppCrash() {
|
|
208
|
-
const func = (settings, generalSettings) => {
|
|
209
|
-
const metric = new crash_1.ApplicationCrashMetric(settings, this.meter, this.logger, generalSettings, this.dependencyContainer.instanceCrashHandler);
|
|
210
|
-
return metric;
|
|
211
|
-
};
|
|
212
|
-
this.metricsFactories.set("app_crash", func.bind(this));
|
|
213
|
-
return this;
|
|
214
|
-
}
|
|
215
|
-
withSystemMemory() {
|
|
216
|
-
const func = (settings, generalSettings) => {
|
|
217
|
-
const metric = new memory_2.SystemMemoryMetric(settings, this.meter, this.logger, generalSettings, this.dependencyContainer.performanceProvider);
|
|
218
|
-
return metric;
|
|
219
|
-
};
|
|
220
|
-
this.metricsFactories.set("system_memory", func.bind(this));
|
|
221
|
-
return this;
|
|
222
|
-
}
|
|
223
|
-
withSystemCPU() {
|
|
224
|
-
const func = (settings, generalSettings) => {
|
|
225
|
-
const metric = new cpu_2.SystemCPUMetric(settings, this.meter, this.logger, generalSettings, this.dependencyContainer.performanceProvider);
|
|
226
|
-
return metric;
|
|
227
|
-
};
|
|
228
|
-
this.metricsFactories.set("system_cpu", func.bind(this));
|
|
229
|
-
return this;
|
|
230
|
-
}
|
|
231
|
-
withLayoutStartup() {
|
|
232
|
-
const func = (settings, generalSettings) => {
|
|
233
|
-
const metric = new startup_2.LayoutStartupMetric(settings, this.meter, this.logger, generalSettings, this.dependencyContainer.layoutRestoredHandler);
|
|
234
|
-
return metric;
|
|
235
|
-
};
|
|
236
|
-
this.metricsFactories.set("layout_startup", func.bind(this));
|
|
237
|
-
return this;
|
|
238
|
-
}
|
|
239
|
-
withWorkspaceStartupLegacy() {
|
|
240
|
-
const func = (settings, generalSettings) => {
|
|
241
|
-
const metric = new startupLegacy_1.WorkspaceStartupHistogramMetric(settings, this.meter, this.logger, generalSettings, this.dependencyContainer.workspaceLoadedHandler, this.dependencyContainer.workspaceRestoredHandler);
|
|
242
|
-
return metric;
|
|
243
|
-
};
|
|
244
|
-
this.metricsFactories.set("workspace_startup_legacy", func.bind(this));
|
|
245
|
-
return this;
|
|
246
|
-
}
|
|
247
|
-
withWorkspaceStarted() {
|
|
248
|
-
const func = (settings, generalSettings) => {
|
|
249
|
-
const metric = new started_2.WorkspaceStartedMetric(settings, this.meter, this.logger, generalSettings, this.dependencyContainer.workspaceStartedHandler, this.dependencyContainer.workspaceRestoredHandler);
|
|
250
|
-
return metric;
|
|
251
|
-
};
|
|
252
|
-
this.metricsFactories.set("workspace_started", func.bind(this));
|
|
253
|
-
return this;
|
|
254
|
-
}
|
|
255
|
-
withWorkspaceStopped() {
|
|
256
|
-
const func = (settings, generalSettings) => {
|
|
257
|
-
const metric = new stopped_2.WorkspaceStoppedMetric(settings, this.meter, this.logger, generalSettings, this.dependencyContainer.workspaceStoppedHandler);
|
|
258
|
-
return metric;
|
|
259
|
-
};
|
|
260
|
-
this.metricsFactories.set("workspace_stopped", func.bind(this));
|
|
261
|
-
return this;
|
|
262
|
-
}
|
|
263
|
-
withWorkspaceSelected() {
|
|
264
|
-
const func = (settings, generalSettings) => {
|
|
265
|
-
const metric = new selected_1.WorkspaceSelectedMetric(settings, this.meter, this.logger, generalSettings, this.dependencyContainer.workspaceSelectedHandler);
|
|
266
|
-
return metric;
|
|
267
|
-
};
|
|
268
|
-
this.metricsFactories.set("workspace_selected", func.bind(this));
|
|
269
|
-
return this;
|
|
270
|
-
}
|
|
271
|
-
withWorkspaceCount() {
|
|
272
|
-
const func = (settings, generalSettings) => {
|
|
273
|
-
const metric = new count_2.WorkspaceCountMetric(settings, this.meter, this.logger, generalSettings, this.dependencyContainer.workspaceSavedHandler, this.dependencyContainer.workspaceStartedHandler, this.dependencyContainer.workspaceRestoredHandler, this.dependencyContainer.workspaceStoppedHandler);
|
|
274
|
-
return metric;
|
|
275
|
-
};
|
|
276
|
-
this.metricsFactories.set("workspace_count", func.bind(this));
|
|
277
|
-
return this;
|
|
278
|
-
}
|
|
279
|
-
withPlatformStartup() {
|
|
280
|
-
const func = (settings, generalSettings) => {
|
|
281
|
-
const metric = new startup_3.PlatformStartupMetric(settings, this.meter, this.logger, generalSettings, this.dependencyContainer.platformStartedHandler);
|
|
282
|
-
return metric;
|
|
283
|
-
};
|
|
284
|
-
this.metricsFactories.set("platform_startup", func.bind(this));
|
|
285
|
-
return this;
|
|
286
|
-
}
|
|
287
|
-
withPlatformError() {
|
|
288
|
-
const func = (settings, generalSettings) => {
|
|
289
|
-
const metric = new error_2.PlatformErrorMetric(settings, this.meter, this.logger, generalSettings, this.dependencyContainer.platformErrorHandler);
|
|
290
|
-
return metric;
|
|
291
|
-
};
|
|
292
|
-
this.metricsFactories.set("platform_error", func.bind(this));
|
|
293
|
-
return this;
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
|
-
exports.MetricsFactoryBuilder = MetricsFactoryBuilder;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MetricsFactoryBuilder = void 0;
|
|
4
|
+
const factoryBuilder_1 = require("../validation/metrics/factoryBuilder");
|
|
5
|
+
const factory_1 = require("./factory");
|
|
6
|
+
const count_1 = require("../metrics/application/count");
|
|
7
|
+
const cpu_1 = require("../metrics/application/cpu");
|
|
8
|
+
const crash_1 = require("../metrics/application/crash");
|
|
9
|
+
const duration_1 = require("../metrics/application/duration");
|
|
10
|
+
const durationSoft_1 = require("../metrics/application/durationSoft");
|
|
11
|
+
const error_1 = require("../metrics/application/error");
|
|
12
|
+
const memory_1 = require("../metrics/application/memory");
|
|
13
|
+
const started_1 = require("../metrics/application/started");
|
|
14
|
+
const startup_1 = require("../metrics/application/startup");
|
|
15
|
+
const stopped_1 = require("../metrics/application/stopped");
|
|
16
|
+
const startup_2 = require("../metrics/layout/startup");
|
|
17
|
+
const error_2 = require("../metrics/platform/error");
|
|
18
|
+
const startup_3 = require("../metrics/platform/startup");
|
|
19
|
+
const cpu_2 = require("../metrics/system/cpu");
|
|
20
|
+
const memory_2 = require("../metrics/system/memory");
|
|
21
|
+
const count_2 = require("../metrics/workspace/count");
|
|
22
|
+
const started_2 = require("../metrics/workspace/started");
|
|
23
|
+
const startupLegacy_1 = require("../metrics/workspace/startupLegacy");
|
|
24
|
+
const stopped_2 = require("../metrics/workspace/stopped");
|
|
25
|
+
const selected_1 = require("../metrics/workspace/selected");
|
|
26
|
+
const timedGauge_1 = require("../metrics/workspace/timedGauge");
|
|
27
|
+
class MetricsFactoryBuilder {
|
|
28
|
+
constructor(lazyMeterProvider, dependencyContainer, logger) {
|
|
29
|
+
this.lazyMeterProvider = lazyMeterProvider;
|
|
30
|
+
this.dependencyContainer = dependencyContainer;
|
|
31
|
+
this.logger = logger;
|
|
32
|
+
this.metricsFactories = new Map();
|
|
33
|
+
this.metricsFactories = new Map();
|
|
34
|
+
}
|
|
35
|
+
get meter() {
|
|
36
|
+
const meter = this.lazyMeterProvider.getMeter();
|
|
37
|
+
return meter;
|
|
38
|
+
}
|
|
39
|
+
build() {
|
|
40
|
+
const validator = new factoryBuilder_1.MetricsFactoryBuilderValidator();
|
|
41
|
+
validator.validate(this);
|
|
42
|
+
const metricsFactory = new factory_1.MetricsFactory(this.logger, this.metricsFactories, this.meter);
|
|
43
|
+
return metricsFactory;
|
|
44
|
+
}
|
|
45
|
+
withDefaults() {
|
|
46
|
+
return this
|
|
47
|
+
.withAppStarted()
|
|
48
|
+
.withAppStopped()
|
|
49
|
+
.withAppStartup()
|
|
50
|
+
.withAppCount()
|
|
51
|
+
.withAppDuration()
|
|
52
|
+
.withAppDurationSoft()
|
|
53
|
+
.withAppMemory()
|
|
54
|
+
.withAppCPU()
|
|
55
|
+
.withSystemMemory()
|
|
56
|
+
.withSystemCPU()
|
|
57
|
+
.withAppError()
|
|
58
|
+
.withAppCrash()
|
|
59
|
+
.withLayoutStartup()
|
|
60
|
+
.withWorkspaceStartupLegacy()
|
|
61
|
+
.withWorkspaceStarted()
|
|
62
|
+
.withWorkspaceStopped()
|
|
63
|
+
.withWorkspaceSelected()
|
|
64
|
+
.withWorkspaceCount()
|
|
65
|
+
// G4E-9759
|
|
66
|
+
.withWorkspaceMetric("workspace_startup", dc => dc.workspaceStartupHandler, [
|
|
67
|
+
{
|
|
68
|
+
attributes: {
|
|
69
|
+
complexLoad: true
|
|
70
|
+
},
|
|
71
|
+
enabled: false
|
|
72
|
+
}
|
|
73
|
+
])
|
|
74
|
+
.withWorkspaceMetric("workspace_startup_frame", dc => dc.workspaceFrameCreatedHandler, [
|
|
75
|
+
{
|
|
76
|
+
attributes: {
|
|
77
|
+
complexLoad: true
|
|
78
|
+
},
|
|
79
|
+
enabled: false
|
|
80
|
+
}
|
|
81
|
+
])
|
|
82
|
+
.withWorkspaceMetric("workspace_startup_frame_init", dc => dc.workspaceFrameInitHandler, [
|
|
83
|
+
{
|
|
84
|
+
attributes: {
|
|
85
|
+
complexLoad: true
|
|
86
|
+
},
|
|
87
|
+
enabled: false
|
|
88
|
+
}
|
|
89
|
+
])
|
|
90
|
+
.withWorkspaceMetric("workspace_startup_frame_page_load", dc => dc.workspaceFramePageLoadHandler, [
|
|
91
|
+
{
|
|
92
|
+
attributes: {
|
|
93
|
+
complexLoad: true
|
|
94
|
+
},
|
|
95
|
+
enabled: false
|
|
96
|
+
}
|
|
97
|
+
])
|
|
98
|
+
.withWorkspaceMetric("workspace_startup_frame_workspace_render", dc => dc.workspaceFrameWorkspaceRenderHandler, [
|
|
99
|
+
{
|
|
100
|
+
attributes: {
|
|
101
|
+
complexLoad: true
|
|
102
|
+
},
|
|
103
|
+
enabled: false
|
|
104
|
+
}
|
|
105
|
+
])
|
|
106
|
+
.withWorkspaceMetric("workspace_startup_component", dc => dc.workspaceComponentCreatedHandler, [
|
|
107
|
+
{
|
|
108
|
+
attributes: {
|
|
109
|
+
complexLoad: true
|
|
110
|
+
},
|
|
111
|
+
enabled: false
|
|
112
|
+
}
|
|
113
|
+
])
|
|
114
|
+
.withWorkspaceMetric("workspace_startup_apps", dc => dc.workspaceAppsStartedHandler, [
|
|
115
|
+
{
|
|
116
|
+
attributes: {
|
|
117
|
+
complexLoad: true
|
|
118
|
+
},
|
|
119
|
+
enabled: false
|
|
120
|
+
}
|
|
121
|
+
])
|
|
122
|
+
.withPlatformStartup()
|
|
123
|
+
.withPlatformError();
|
|
124
|
+
}
|
|
125
|
+
withWorkspaceMetric(name, handler, defaultFilters,
|
|
126
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
127
|
+
getAttributes) {
|
|
128
|
+
const func = (settings, generalSettings) => {
|
|
129
|
+
const metric = new timedGauge_1.WorkspaceTimedGaugeMetric(settings, generalSettings, this.meter, this.logger, handler(this.dependencyContainer), defaultFilters, getAttributes);
|
|
130
|
+
return metric;
|
|
131
|
+
};
|
|
132
|
+
this.metricsFactories.set(name, func.bind(this));
|
|
133
|
+
return this;
|
|
134
|
+
}
|
|
135
|
+
withAppStarted() {
|
|
136
|
+
const func = (settings, generalSettings) => {
|
|
137
|
+
const metric = new started_1.ApplicationStartedMetric(settings, this.meter, this.logger, generalSettings, this.dependencyContainer.instanceStartedHandler);
|
|
138
|
+
return metric;
|
|
139
|
+
};
|
|
140
|
+
this.metricsFactories.set("app_started", func.bind(this));
|
|
141
|
+
return this;
|
|
142
|
+
}
|
|
143
|
+
withAppStopped() {
|
|
144
|
+
const func = (settings, generalSettings) => {
|
|
145
|
+
const metric = new stopped_1.ApplicationStoppedMetric(settings, this.meter, this.logger, generalSettings, this.dependencyContainer.instanceStoppedHandler);
|
|
146
|
+
return metric;
|
|
147
|
+
};
|
|
148
|
+
this.metricsFactories.set("app_stopped", func.bind(this));
|
|
149
|
+
return this;
|
|
150
|
+
}
|
|
151
|
+
withAppStartup() {
|
|
152
|
+
const func = (settings, generalSettings) => {
|
|
153
|
+
const metric = new startup_1.ApplicationStartupMetric(settings, this.meter, this.logger, generalSettings, this.dependencyContainer.instanceReadyHandler);
|
|
154
|
+
return metric;
|
|
155
|
+
};
|
|
156
|
+
this.metricsFactories.set("app_startup", func.bind(this));
|
|
157
|
+
return this;
|
|
158
|
+
}
|
|
159
|
+
withAppCount() {
|
|
160
|
+
const func = (settings, generalSettings) => {
|
|
161
|
+
const metric = new count_1.ApplicationCountMetric(settings, this.meter, this.logger, generalSettings, this.dependencyContainer.instanceStartedHandler, this.dependencyContainer.instanceStoppedHandler);
|
|
162
|
+
return metric;
|
|
163
|
+
};
|
|
164
|
+
this.metricsFactories.set("app_count", func.bind(this));
|
|
165
|
+
return this;
|
|
166
|
+
}
|
|
167
|
+
withAppDuration() {
|
|
168
|
+
const func = (settings, generalSettings) => {
|
|
169
|
+
const metric = new duration_1.ApplicationDurationMetric(settings, this.meter, this.logger, generalSettings, this.dependencyContainer.instanceFocusedHandler);
|
|
170
|
+
return metric;
|
|
171
|
+
};
|
|
172
|
+
this.metricsFactories.set("app_duration", func.bind(this));
|
|
173
|
+
return this;
|
|
174
|
+
}
|
|
175
|
+
withAppDurationSoft() {
|
|
176
|
+
const func = (settings, generalSettings) => {
|
|
177
|
+
const metric = new durationSoft_1.ApplicationDurationSoftMetric(settings, this.meter, this.logger, generalSettings, this.dependencyContainer.instanceFocusedHandler);
|
|
178
|
+
return metric;
|
|
179
|
+
};
|
|
180
|
+
this.metricsFactories.set("app_duration_soft", func.bind(this));
|
|
181
|
+
return this;
|
|
182
|
+
}
|
|
183
|
+
withAppMemory() {
|
|
184
|
+
const func = (settings, generalSettings) => {
|
|
185
|
+
const metric = new memory_1.ApplicationMemoryMetric(settings, this.meter, this.logger, generalSettings, this.dependencyContainer.performanceProvider);
|
|
186
|
+
return metric;
|
|
187
|
+
};
|
|
188
|
+
this.metricsFactories.set("app_memory", func.bind(this));
|
|
189
|
+
return this;
|
|
190
|
+
}
|
|
191
|
+
withAppCPU() {
|
|
192
|
+
const func = (settings, generalSettings) => {
|
|
193
|
+
const metric = new cpu_1.ApplicationCPUMetric(settings, this.meter, this.logger, generalSettings, this.dependencyContainer.performanceProvider);
|
|
194
|
+
return metric;
|
|
195
|
+
};
|
|
196
|
+
this.metricsFactories.set("app_cpu", func.bind(this));
|
|
197
|
+
return this;
|
|
198
|
+
}
|
|
199
|
+
withAppError() {
|
|
200
|
+
const func = (settings, generalSettings) => {
|
|
201
|
+
const metric = new error_1.ApplicationErrorMetric(settings, this.meter, this.logger, generalSettings, this.dependencyContainer.instanceErrorHandler);
|
|
202
|
+
return metric;
|
|
203
|
+
};
|
|
204
|
+
this.metricsFactories.set("app_error", func.bind(this));
|
|
205
|
+
return this;
|
|
206
|
+
}
|
|
207
|
+
withAppCrash() {
|
|
208
|
+
const func = (settings, generalSettings) => {
|
|
209
|
+
const metric = new crash_1.ApplicationCrashMetric(settings, this.meter, this.logger, generalSettings, this.dependencyContainer.instanceCrashHandler);
|
|
210
|
+
return metric;
|
|
211
|
+
};
|
|
212
|
+
this.metricsFactories.set("app_crash", func.bind(this));
|
|
213
|
+
return this;
|
|
214
|
+
}
|
|
215
|
+
withSystemMemory() {
|
|
216
|
+
const func = (settings, generalSettings) => {
|
|
217
|
+
const metric = new memory_2.SystemMemoryMetric(settings, this.meter, this.logger, generalSettings, this.dependencyContainer.performanceProvider);
|
|
218
|
+
return metric;
|
|
219
|
+
};
|
|
220
|
+
this.metricsFactories.set("system_memory", func.bind(this));
|
|
221
|
+
return this;
|
|
222
|
+
}
|
|
223
|
+
withSystemCPU() {
|
|
224
|
+
const func = (settings, generalSettings) => {
|
|
225
|
+
const metric = new cpu_2.SystemCPUMetric(settings, this.meter, this.logger, generalSettings, this.dependencyContainer.performanceProvider);
|
|
226
|
+
return metric;
|
|
227
|
+
};
|
|
228
|
+
this.metricsFactories.set("system_cpu", func.bind(this));
|
|
229
|
+
return this;
|
|
230
|
+
}
|
|
231
|
+
withLayoutStartup() {
|
|
232
|
+
const func = (settings, generalSettings) => {
|
|
233
|
+
const metric = new startup_2.LayoutStartupMetric(settings, this.meter, this.logger, generalSettings, this.dependencyContainer.layoutRestoredHandler);
|
|
234
|
+
return metric;
|
|
235
|
+
};
|
|
236
|
+
this.metricsFactories.set("layout_startup", func.bind(this));
|
|
237
|
+
return this;
|
|
238
|
+
}
|
|
239
|
+
withWorkspaceStartupLegacy() {
|
|
240
|
+
const func = (settings, generalSettings) => {
|
|
241
|
+
const metric = new startupLegacy_1.WorkspaceStartupHistogramMetric(settings, this.meter, this.logger, generalSettings, this.dependencyContainer.workspaceLoadedHandler, this.dependencyContainer.workspaceRestoredHandler);
|
|
242
|
+
return metric;
|
|
243
|
+
};
|
|
244
|
+
this.metricsFactories.set("workspace_startup_legacy", func.bind(this));
|
|
245
|
+
return this;
|
|
246
|
+
}
|
|
247
|
+
withWorkspaceStarted() {
|
|
248
|
+
const func = (settings, generalSettings) => {
|
|
249
|
+
const metric = new started_2.WorkspaceStartedMetric(settings, this.meter, this.logger, generalSettings, this.dependencyContainer.workspaceStartedHandler, this.dependencyContainer.workspaceRestoredHandler);
|
|
250
|
+
return metric;
|
|
251
|
+
};
|
|
252
|
+
this.metricsFactories.set("workspace_started", func.bind(this));
|
|
253
|
+
return this;
|
|
254
|
+
}
|
|
255
|
+
withWorkspaceStopped() {
|
|
256
|
+
const func = (settings, generalSettings) => {
|
|
257
|
+
const metric = new stopped_2.WorkspaceStoppedMetric(settings, this.meter, this.logger, generalSettings, this.dependencyContainer.workspaceStoppedHandler);
|
|
258
|
+
return metric;
|
|
259
|
+
};
|
|
260
|
+
this.metricsFactories.set("workspace_stopped", func.bind(this));
|
|
261
|
+
return this;
|
|
262
|
+
}
|
|
263
|
+
withWorkspaceSelected() {
|
|
264
|
+
const func = (settings, generalSettings) => {
|
|
265
|
+
const metric = new selected_1.WorkspaceSelectedMetric(settings, this.meter, this.logger, generalSettings, this.dependencyContainer.workspaceSelectedHandler);
|
|
266
|
+
return metric;
|
|
267
|
+
};
|
|
268
|
+
this.metricsFactories.set("workspace_selected", func.bind(this));
|
|
269
|
+
return this;
|
|
270
|
+
}
|
|
271
|
+
withWorkspaceCount() {
|
|
272
|
+
const func = (settings, generalSettings) => {
|
|
273
|
+
const metric = new count_2.WorkspaceCountMetric(settings, this.meter, this.logger, generalSettings, this.dependencyContainer.workspaceSavedHandler, this.dependencyContainer.workspaceStartedHandler, this.dependencyContainer.workspaceRestoredHandler, this.dependencyContainer.workspaceStoppedHandler);
|
|
274
|
+
return metric;
|
|
275
|
+
};
|
|
276
|
+
this.metricsFactories.set("workspace_count", func.bind(this));
|
|
277
|
+
return this;
|
|
278
|
+
}
|
|
279
|
+
withPlatformStartup() {
|
|
280
|
+
const func = (settings, generalSettings) => {
|
|
281
|
+
const metric = new startup_3.PlatformStartupMetric(settings, this.meter, this.logger, generalSettings, this.dependencyContainer.platformStartedHandler);
|
|
282
|
+
return metric;
|
|
283
|
+
};
|
|
284
|
+
this.metricsFactories.set("platform_startup", func.bind(this));
|
|
285
|
+
return this;
|
|
286
|
+
}
|
|
287
|
+
withPlatformError() {
|
|
288
|
+
const func = (settings, generalSettings) => {
|
|
289
|
+
const metric = new error_2.PlatformErrorMetric(settings, this.meter, this.logger, generalSettings, this.dependencyContainer.platformErrorHandler);
|
|
290
|
+
return metric;
|
|
291
|
+
};
|
|
292
|
+
this.metricsFactories.set("platform_error", func.bind(this));
|
|
293
|
+
return this;
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
exports.MetricsFactoryBuilder = MetricsFactoryBuilder;
|
|
297
297
|
//# sourceMappingURL=builder.js.map
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { type Attributes, type Meter, type ObservableResult } from "@opentelemetry/api";
|
|
2
|
-
import { IOInsights } from "@interopio/otel/insights";
|
|
3
|
-
export declare class MetricsFactory implements IOInsights.MetricsFactory {
|
|
4
|
-
logger: IOInsights.Logger;
|
|
5
|
-
metricsFactories: Map<IOInsights.MetricType, IOInsights.CreateMetricFunc>;
|
|
6
|
-
meter: Meter;
|
|
7
|
-
constructor(logger: IOInsights.Logger, metricsFactories: Map<IOInsights.MetricType, IOInsights.CreateMetricFunc>, meter: Meter);
|
|
8
|
-
create<TData extends Attributes>(metricSettings: IOInsights.MetricSettings, generalSettings: IOInsights.MetricsSettings, observeCallback?: (result: ObservableResult<TData>) => Promise<void>, subscribeCallback?: () => Promise<void>, unsubscribeCallback?: () => Promise<void>): IOInsights.Metric;
|
|
9
|
-
private createNullMetric;
|
|
10
|
-
}
|
|
1
|
+
import { type Attributes, type Meter, type ObservableResult } from "@opentelemetry/api";
|
|
2
|
+
import { IOInsights } from "@interopio/otel/insights";
|
|
3
|
+
export declare class MetricsFactory implements IOInsights.MetricsFactory {
|
|
4
|
+
logger: IOInsights.Logger;
|
|
5
|
+
metricsFactories: Map<IOInsights.MetricType, IOInsights.CreateMetricFunc>;
|
|
6
|
+
meter: Meter;
|
|
7
|
+
constructor(logger: IOInsights.Logger, metricsFactories: Map<IOInsights.MetricType, IOInsights.CreateMetricFunc>, meter: Meter);
|
|
8
|
+
create<TData extends Attributes>(metricSettings: IOInsights.MetricSettings, generalSettings: IOInsights.MetricsSettings, observeCallback?: (result: ObservableResult<TData>) => Promise<void>, subscribeCallback?: () => Promise<void>, unsubscribeCallback?: () => Promise<void>): IOInsights.Metric;
|
|
9
|
+
private createNullMetric;
|
|
10
|
+
}
|