@fluojs/metrics 1.0.0-beta.1 → 1.0.0-beta.2
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.ko.md +5 -1
- package/README.md +5 -1
- package/dist/metrics-module.js +35 -0
- package/package.json +4 -4
package/README.ko.md
CHANGED
|
@@ -145,6 +145,7 @@ MetricsModule.forRoot({
|
|
|
145
145
|
플랫폼 텔레메트리는 매 `/metrics` 스크레이프마다 `PLATFORM_SHELL`을 resolve하여 `fluo_component_ready`와 `fluo_component_health`를 갱신합니다.
|
|
146
146
|
|
|
147
147
|
- `PLATFORM_SHELL` 등록 자체가 빠진 경우에는 스크레이프가 계속 성공하고 플랫폼 텔레메트리 시리즈만 생략됩니다.
|
|
148
|
+
- 이전 스크레이프에서 플랫폼 텔레메트리를 노출한 뒤 `PLATFORM_SHELL`을 사용할 수 없게 되면, stale `fluo_component_ready` 및 `fluo_component_health` 시리즈를 제거한 뒤 메트릭을 반환합니다.
|
|
148
149
|
- 그 외의 `PLATFORM_SHELL` resolve 실패는 조용히 삼키지 않고 스크레이프 실패로 그대로 드러납니다.
|
|
149
150
|
|
|
150
151
|
### 기본 프로세스/Node 메트릭 비활성화
|
|
@@ -162,7 +163,9 @@ MetricsModule.forRoot({
|
|
|
162
163
|
- `MetricsModule.forRoot(options)`
|
|
163
164
|
- `MetricsService`
|
|
164
165
|
- `METER_PROVIDER` (Token)
|
|
165
|
-
-
|
|
166
|
+
- `PrometheusMeterProvider`
|
|
167
|
+
- `HttpMetricsMiddleware` 및 HTTP path-label 옵션 타입
|
|
168
|
+
- `prom-client`의 `Registry`
|
|
166
169
|
|
|
167
170
|
### 운영 기본값
|
|
168
171
|
|
|
@@ -172,6 +175,7 @@ MetricsModule.forRoot({
|
|
|
172
175
|
- HTTP 메트릭은 기본적으로 템플릿 기반 경로 라벨 정규화를 사용합니다.
|
|
173
176
|
- raw path 라벨은 `allowUnsafeRawPathLabelMode: true`를 명시한 bounded internal route에서만 사용해야 합니다.
|
|
174
177
|
- 플랫폼 텔레메트리는 `PLATFORM_SHELL`이 실제로 누락된 경우에만 생략되며, 그 외 resolve 실패는 스크레이프를 실패시킵니다.
|
|
178
|
+
- 이전에 노출된 플랫폼 텔레메트리 시리즈는 `PLATFORM_SHELL`을 사용할 수 없게 된 스크레이프에서 제거됩니다.
|
|
175
179
|
|
|
176
180
|
## 관련 패키지
|
|
177
181
|
|
package/README.md
CHANGED
|
@@ -126,6 +126,7 @@ MetricsModule.forRoot({
|
|
|
126
126
|
Platform telemetry refreshes `fluo_component_ready` and `fluo_component_health` on each `/metrics` scrape by resolving `PLATFORM_SHELL`.
|
|
127
127
|
|
|
128
128
|
- If `PLATFORM_SHELL` is not registered, the scrape still succeeds and omits the platform telemetry series.
|
|
129
|
+
- If `PLATFORM_SHELL` becomes unavailable after a previous successful scrape, stale `fluo_component_ready` and `fluo_component_health` series are removed before metrics are returned.
|
|
129
130
|
- If resolving `PLATFORM_SHELL` fails for any other reason, the scrape surfaces that failure instead of swallowing it.
|
|
130
131
|
|
|
131
132
|
### Disable default process and Node metrics
|
|
@@ -143,7 +144,9 @@ MetricsModule.forRoot({
|
|
|
143
144
|
- `MetricsModule.forRoot(options)`
|
|
144
145
|
- `MetricsService`
|
|
145
146
|
- `METER_PROVIDER`
|
|
146
|
-
-
|
|
147
|
+
- `PrometheusMeterProvider`
|
|
148
|
+
- `HttpMetricsMiddleware` and HTTP path-label option types
|
|
149
|
+
- `Registry` from `prom-client`
|
|
147
150
|
|
|
148
151
|
### Operational defaults
|
|
149
152
|
|
|
@@ -153,6 +156,7 @@ MetricsModule.forRoot({
|
|
|
153
156
|
- HTTP metrics default to template-normalized path labels.
|
|
154
157
|
- Raw path labels require `allowUnsafeRawPathLabelMode: true` and should stay limited to bounded internal routes.
|
|
155
158
|
- Platform telemetry is omitted only when `PLATFORM_SHELL` is genuinely missing; other resolution failures fail the scrape.
|
|
159
|
+
- Stale platform telemetry series are removed when `PLATFORM_SHELL` becomes unavailable after a prior successful scrape.
|
|
156
160
|
|
|
157
161
|
## Related Packages
|
|
158
162
|
|
package/dist/metrics-module.js
CHANGED
|
@@ -158,6 +158,7 @@ class RuntimePlatformTelemetry {
|
|
|
158
158
|
async refresh(ctx) {
|
|
159
159
|
const platformShell = await this.resolvePlatformShell(ctx);
|
|
160
160
|
if (!platformShell) {
|
|
161
|
+
this.clearPlatformTelemetry();
|
|
161
162
|
return;
|
|
162
163
|
}
|
|
163
164
|
const snapshot = await platformShell.snapshot();
|
|
@@ -195,6 +196,40 @@ class RuntimePlatformTelemetry {
|
|
|
195
196
|
toMetricValue: toReadinessValue
|
|
196
197
|
});
|
|
197
198
|
}
|
|
199
|
+
clearPlatformTelemetry() {
|
|
200
|
+
this.clearGaugeStatuses({
|
|
201
|
+
env: this.labels?.env ?? 'unknown',
|
|
202
|
+
gauge: this.healthGauge,
|
|
203
|
+
instance: this.labels?.instance ?? 'local',
|
|
204
|
+
lastStatuses: this.lastHealthStatuses,
|
|
205
|
+
operation: 'health',
|
|
206
|
+
statuses: HEALTH_STATUSES
|
|
207
|
+
});
|
|
208
|
+
this.clearGaugeStatuses({
|
|
209
|
+
env: this.labels?.env ?? 'unknown',
|
|
210
|
+
gauge: this.readinessGauge,
|
|
211
|
+
instance: this.labels?.instance ?? 'local',
|
|
212
|
+
lastStatuses: this.lastReadinessStatuses,
|
|
213
|
+
operation: 'readiness',
|
|
214
|
+
statuses: READINESS_STATUSES
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
clearGaugeStatuses({
|
|
218
|
+
env,
|
|
219
|
+
gauge,
|
|
220
|
+
instance,
|
|
221
|
+
lastStatuses,
|
|
222
|
+
operation,
|
|
223
|
+
statuses
|
|
224
|
+
}) {
|
|
225
|
+
for (const componentKey of lastStatuses.keys()) {
|
|
226
|
+
const [componentId, componentKind] = this.fromComponentKey(componentKey);
|
|
227
|
+
for (const status of statuses) {
|
|
228
|
+
gauge.remove(componentId, componentKind, operation, status, env, instance);
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
lastStatuses.clear();
|
|
232
|
+
}
|
|
198
233
|
syncGaugeStatuses({
|
|
199
234
|
currentStatuses,
|
|
200
235
|
env,
|
package/package.json
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"monitoring",
|
|
9
9
|
"observability"
|
|
10
10
|
],
|
|
11
|
-
"version": "1.0.0-beta.
|
|
11
|
+
"version": "1.0.0-beta.2",
|
|
12
12
|
"private": false,
|
|
13
13
|
"license": "MIT",
|
|
14
14
|
"repository": {
|
|
@@ -36,9 +36,9 @@
|
|
|
36
36
|
],
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"prom-client": "^15.1.3",
|
|
39
|
-
"@fluojs/di": "^1.0.0-beta.
|
|
40
|
-
"@fluojs/
|
|
41
|
-
"@fluojs/
|
|
39
|
+
"@fluojs/di": "^1.0.0-beta.2",
|
|
40
|
+
"@fluojs/http": "^1.0.0-beta.1",
|
|
41
|
+
"@fluojs/runtime": "^1.0.0-beta.2"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@types/node": "^22.0.0",
|