@myvitalrx/metadata-runtime 1.19.1 → 1.20.1
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 +3 -5
- package/dist/index.d.ts +1 -24
- package/dist/index.js +14 -261
- package/dist/index.js.map +1 -1
- package/package.json +3 -7
package/README.md
CHANGED
|
@@ -51,15 +51,13 @@ The library is designed to:
|
|
|
51
51
|
|
|
52
52
|
## Installation
|
|
53
53
|
|
|
54
|
+
Install the package from the configured private NPM registry:
|
|
55
|
+
|
|
54
56
|
```bash
|
|
55
57
|
npm install @myvitalrx/metadata-runtime
|
|
56
58
|
```
|
|
57
59
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
```typescript
|
|
61
|
-
import { getContext, withContext } from '@myvitalrx/platform-tools/observability';
|
|
62
|
-
```
|
|
60
|
+
The package should be installed using the same registry/authentication configuration used by the other MyVitalRx internal packages.
|
|
63
61
|
|
|
64
62
|
---
|
|
65
63
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import { StructuredLogger } from '@api-hub/observability';
|
|
2
3
|
import { S3Client } from '@aws-sdk/client-s3';
|
|
3
4
|
|
|
4
5
|
/**
|
|
@@ -484,30 +485,6 @@ interface ProjectionCurrentPointer {
|
|
|
484
485
|
projectionVersion: string;
|
|
485
486
|
}
|
|
486
487
|
|
|
487
|
-
interface LogEntry {
|
|
488
|
-
event?: string;
|
|
489
|
-
message?: string;
|
|
490
|
-
err?: unknown;
|
|
491
|
-
error?: unknown;
|
|
492
|
-
[key: string]: unknown;
|
|
493
|
-
}
|
|
494
|
-
|
|
495
|
-
/**
|
|
496
|
-
* Structured logger compatible with legacy `@api-hub/logger` {@link LogEntry} call style
|
|
497
|
-
* (`logger.info({ event: 'x', ... } )`), backed by {@link getLogger} and AsyncLocalStorage context.
|
|
498
|
-
*/
|
|
499
|
-
declare class StructuredLogger {
|
|
500
|
-
private readonly persistentKeys;
|
|
501
|
-
constructor(persistentKeys?: Record<string, unknown>);
|
|
502
|
-
getPersistentKeys(): Record<string, unknown>;
|
|
503
|
-
info(entry: LogEntry): void;
|
|
504
|
-
warn(entry: LogEntry): void;
|
|
505
|
-
error(entry: LogEntry): void;
|
|
506
|
-
debug(entry: LogEntry): void;
|
|
507
|
-
http(entry: LogEntry): void;
|
|
508
|
-
verbose(entry: LogEntry): void;
|
|
509
|
-
}
|
|
510
|
-
|
|
511
488
|
/** Document discriminator. Not part of a permission identity. */
|
|
512
489
|
declare const PERMISSION_REGISTRY_METADATA_TYPE: "PermissionRegistry";
|
|
513
490
|
/**
|
package/dist/index.js
CHANGED
|
@@ -1,26 +1,8 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { createHash } from 'crypto';
|
|
3
|
-
import
|
|
3
|
+
import { createLogger, createOperationalLogger, createPerformanceTimer, getContext } from '@api-hub/observability';
|
|
4
4
|
import { GetObjectCommand, S3Client } from '@aws-sdk/client-s3';
|
|
5
5
|
|
|
6
|
-
var __defProp = Object.defineProperty;
|
|
7
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
8
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
9
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
|
-
var __export = (target, all) => {
|
|
11
|
-
for (var name in all)
|
|
12
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
13
|
-
};
|
|
14
|
-
var __copyProps = (to, from, except, desc) => {
|
|
15
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
16
|
-
for (let key of __getOwnPropNames(from))
|
|
17
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
18
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
19
|
-
}
|
|
20
|
-
return to;
|
|
21
|
-
};
|
|
22
|
-
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget);
|
|
23
|
-
|
|
24
6
|
// ../../libs/runtime-metadata/src/lib/constants/RuntimeMetadataConstants.ts
|
|
25
7
|
var CACHE_STATUS = {
|
|
26
8
|
EMPTY: "empty",
|
|
@@ -198,227 +180,6 @@ function sha256Hex(data) {
|
|
|
198
180
|
return createHash("sha256").update(data).digest("hex");
|
|
199
181
|
}
|
|
200
182
|
|
|
201
|
-
// src/observability-shim.ts
|
|
202
|
-
var observability_shim_exports = {};
|
|
203
|
-
__export(observability_shim_exports, {
|
|
204
|
-
createOperationalLogger: () => createOperationalLogger
|
|
205
|
-
});
|
|
206
|
-
|
|
207
|
-
// ../../libs/observability/src/logging/operational-logger.ts
|
|
208
|
-
var LEVEL_RANK = {
|
|
209
|
-
DEBUG: 10,
|
|
210
|
-
INFO: 20,
|
|
211
|
-
WARN: 30,
|
|
212
|
-
ERROR: 40
|
|
213
|
-
};
|
|
214
|
-
var SENSITIVE_KEYS = /* @__PURE__ */ new Set([
|
|
215
|
-
"payload",
|
|
216
|
-
"body",
|
|
217
|
-
"records",
|
|
218
|
-
"items",
|
|
219
|
-
"relationships",
|
|
220
|
-
"token",
|
|
221
|
-
"authorization",
|
|
222
|
-
"secret",
|
|
223
|
-
"password",
|
|
224
|
-
"accesskey",
|
|
225
|
-
"accesskeyid",
|
|
226
|
-
"secretaccesskey",
|
|
227
|
-
"sessiontoken",
|
|
228
|
-
"credentials",
|
|
229
|
-
"cookie",
|
|
230
|
-
"metadata",
|
|
231
|
-
"response",
|
|
232
|
-
"request",
|
|
233
|
-
"attributes",
|
|
234
|
-
"lookupindex",
|
|
235
|
-
"domainfiles",
|
|
236
|
-
"snapshot"
|
|
237
|
-
]);
|
|
238
|
-
var METADATA_LOG_DEFAULTS = {
|
|
239
|
-
SLOW_HTTP_MS: 100,
|
|
240
|
-
SLOW_S3_MS: 500,
|
|
241
|
-
SLOW_REFRESH_MS: 2e3,
|
|
242
|
-
SLOW_LOOKUP_MS: 50,
|
|
243
|
-
SLOW_INIT_MS: 3e3,
|
|
244
|
-
SUMMARY_EVERY: 200
|
|
245
|
-
};
|
|
246
|
-
function resolveMetadataLogPolicy(env = process.env) {
|
|
247
|
-
const verbose = isTruthy(env.METADATA_LOG_VERBOSE);
|
|
248
|
-
const level = verbose ? "DEBUG" : normalizeLevel(env.METADATA_LOG_LEVEL ?? env.LOG_LEVEL) ?? "INFO";
|
|
249
|
-
return {
|
|
250
|
-
level,
|
|
251
|
-
verbose,
|
|
252
|
-
sampleInfo: sampleRate(env.METADATA_LOG_SAMPLE_INFO, 1),
|
|
253
|
-
sampleDebug: sampleRate(env.METADATA_LOG_SAMPLE_DEBUG, 1),
|
|
254
|
-
slowHttpMs: positiveInt(env.METADATA_SLOW_HTTP_MS, METADATA_LOG_DEFAULTS.SLOW_HTTP_MS),
|
|
255
|
-
slowS3Ms: positiveInt(env.METADATA_SLOW_S3_MS, METADATA_LOG_DEFAULTS.SLOW_S3_MS),
|
|
256
|
-
slowRefreshMs: positiveInt(
|
|
257
|
-
env.METADATA_SLOW_REFRESH_MS,
|
|
258
|
-
METADATA_LOG_DEFAULTS.SLOW_REFRESH_MS
|
|
259
|
-
),
|
|
260
|
-
slowLookupMs: positiveInt(
|
|
261
|
-
env.METADATA_SLOW_LOOKUP_MS,
|
|
262
|
-
METADATA_LOG_DEFAULTS.SLOW_LOOKUP_MS
|
|
263
|
-
),
|
|
264
|
-
slowInitMs: positiveInt(env.METADATA_SLOW_INIT_MS, METADATA_LOG_DEFAULTS.SLOW_INIT_MS),
|
|
265
|
-
summaryEvery: nonNegativeInt(
|
|
266
|
-
env.METADATA_LOG_SUMMARY_EVERY,
|
|
267
|
-
METADATA_LOG_DEFAULTS.SUMMARY_EVERY
|
|
268
|
-
)
|
|
269
|
-
};
|
|
270
|
-
}
|
|
271
|
-
function createOperationalLogger(sink, env = process.env) {
|
|
272
|
-
const policy = resolveMetadataLogPolicy(env);
|
|
273
|
-
function enabled(level) {
|
|
274
|
-
return LEVEL_RANK[policy.level] <= LEVEL_RANK[methodLevel(level)];
|
|
275
|
-
}
|
|
276
|
-
function emit(level, event, fields) {
|
|
277
|
-
if (!enabled(level)) {
|
|
278
|
-
return;
|
|
279
|
-
}
|
|
280
|
-
if (level === "info" && !sampled(policy.sampleInfo)) {
|
|
281
|
-
return;
|
|
282
|
-
}
|
|
283
|
-
if (level === "debug" && !sampled(policy.sampleDebug)) {
|
|
284
|
-
return;
|
|
285
|
-
}
|
|
286
|
-
const entry = {
|
|
287
|
-
event,
|
|
288
|
-
...sanitize(resolveFields(fields))
|
|
289
|
-
};
|
|
290
|
-
deliver(sink, level, entry, env);
|
|
291
|
-
}
|
|
292
|
-
return {
|
|
293
|
-
policy,
|
|
294
|
-
isEnabled: enabled,
|
|
295
|
-
debug: (event, fields) => emit("debug", event, fields),
|
|
296
|
-
info: (event, fields) => emit("info", event, fields),
|
|
297
|
-
warn: (event, fields) => emit("warn", event, fields),
|
|
298
|
-
error: (event, fields) => emit("error", event, fields),
|
|
299
|
-
observe(input) {
|
|
300
|
-
const slow = input.durationMs >= input.thresholdMs;
|
|
301
|
-
if (slow) {
|
|
302
|
-
if (!enabled("warn")) {
|
|
303
|
-
return;
|
|
304
|
-
}
|
|
305
|
-
emit("warn", input.event, () => ({
|
|
306
|
-
...resolveFields(input.fields),
|
|
307
|
-
durationMs: input.durationMs,
|
|
308
|
-
thresholdMs: input.thresholdMs,
|
|
309
|
-
slow: true
|
|
310
|
-
}));
|
|
311
|
-
return;
|
|
312
|
-
}
|
|
313
|
-
emit("debug", input.event, () => ({
|
|
314
|
-
...resolveFields(input.fields),
|
|
315
|
-
durationMs: input.durationMs
|
|
316
|
-
}));
|
|
317
|
-
}
|
|
318
|
-
};
|
|
319
|
-
}
|
|
320
|
-
function deliver(sink, level, entry, env) {
|
|
321
|
-
if (level === "debug" && !platformEmits("debug", env)) {
|
|
322
|
-
sink.info({ ...entry, logLevel: "debug" });
|
|
323
|
-
return;
|
|
324
|
-
}
|
|
325
|
-
const method = sink[level];
|
|
326
|
-
if (typeof method === "function") {
|
|
327
|
-
method.call(sink, entry);
|
|
328
|
-
}
|
|
329
|
-
}
|
|
330
|
-
function platformEmits(level, env) {
|
|
331
|
-
const platform = normalizeLevel(env.LOG_LEVEL) ?? "ERROR";
|
|
332
|
-
return LEVEL_RANK[platform] <= LEVEL_RANK[methodLevel(level)];
|
|
333
|
-
}
|
|
334
|
-
function methodLevel(level) {
|
|
335
|
-
switch (level) {
|
|
336
|
-
case "debug":
|
|
337
|
-
return "DEBUG";
|
|
338
|
-
case "info":
|
|
339
|
-
return "INFO";
|
|
340
|
-
case "warn":
|
|
341
|
-
return "WARN";
|
|
342
|
-
default:
|
|
343
|
-
return "ERROR";
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
function resolveFields(fields) {
|
|
347
|
-
if (!fields) {
|
|
348
|
-
return {};
|
|
349
|
-
}
|
|
350
|
-
return typeof fields === "function" ? fields() : fields;
|
|
351
|
-
}
|
|
352
|
-
function sanitize(fields) {
|
|
353
|
-
const out = {};
|
|
354
|
-
for (const [key, value] of Object.entries(fields)) {
|
|
355
|
-
if (value === void 0 || SENSITIVE_KEYS.has(key.toLowerCase())) {
|
|
356
|
-
continue;
|
|
357
|
-
}
|
|
358
|
-
if (key === "message" && typeof value === "string") {
|
|
359
|
-
if (out.errorMessage === void 0) {
|
|
360
|
-
out.errorMessage = value;
|
|
361
|
-
}
|
|
362
|
-
continue;
|
|
363
|
-
}
|
|
364
|
-
out[key] = value;
|
|
365
|
-
}
|
|
366
|
-
return out;
|
|
367
|
-
}
|
|
368
|
-
function normalizeLevel(value) {
|
|
369
|
-
const upper = (value ?? "").trim().toUpperCase();
|
|
370
|
-
if (upper === "DEBUG" || upper === "INFO" || upper === "WARN" || upper === "ERROR") {
|
|
371
|
-
return upper;
|
|
372
|
-
}
|
|
373
|
-
return void 0;
|
|
374
|
-
}
|
|
375
|
-
function sampleRate(raw, fallback) {
|
|
376
|
-
if (raw == null || raw.trim() === "") {
|
|
377
|
-
return fallback;
|
|
378
|
-
}
|
|
379
|
-
const parsed = Number(raw);
|
|
380
|
-
if (!Number.isFinite(parsed) || parsed < 0) {
|
|
381
|
-
return 0;
|
|
382
|
-
}
|
|
383
|
-
if (parsed > 1) {
|
|
384
|
-
return 1;
|
|
385
|
-
}
|
|
386
|
-
return parsed;
|
|
387
|
-
}
|
|
388
|
-
function sampled(rate) {
|
|
389
|
-
if (rate <= 0) {
|
|
390
|
-
return false;
|
|
391
|
-
}
|
|
392
|
-
if (rate >= 1) {
|
|
393
|
-
return true;
|
|
394
|
-
}
|
|
395
|
-
return Math.random() < rate;
|
|
396
|
-
}
|
|
397
|
-
function positiveInt(raw, fallback) {
|
|
398
|
-
const parsed = Number(raw);
|
|
399
|
-
if (!raw || !Number.isFinite(parsed) || parsed < 0) {
|
|
400
|
-
return fallback;
|
|
401
|
-
}
|
|
402
|
-
return Math.floor(parsed);
|
|
403
|
-
}
|
|
404
|
-
function nonNegativeInt(raw, fallback) {
|
|
405
|
-
if (raw == null || raw.trim() === "") {
|
|
406
|
-
return fallback;
|
|
407
|
-
}
|
|
408
|
-
const parsed = Number(raw);
|
|
409
|
-
if (!Number.isFinite(parsed) || parsed < 0) {
|
|
410
|
-
return fallback;
|
|
411
|
-
}
|
|
412
|
-
return Math.floor(parsed);
|
|
413
|
-
}
|
|
414
|
-
function isTruthy(value) {
|
|
415
|
-
const normalized = (value ?? "").trim().toLowerCase();
|
|
416
|
-
return normalized === "true" || normalized === "1" || normalized === "yes";
|
|
417
|
-
}
|
|
418
|
-
|
|
419
|
-
// src/observability-shim.ts
|
|
420
|
-
__reExport(observability_shim_exports, observability_star);
|
|
421
|
-
|
|
422
183
|
// ../../libs/utils/src/errors/base.error.ts
|
|
423
184
|
var BaseError = class extends Error {
|
|
424
185
|
statusCode;
|
|
@@ -2960,7 +2721,7 @@ var MetadataLoader = class {
|
|
|
2960
2721
|
constructor(options) {
|
|
2961
2722
|
this.expectedSchemaVersion = options.expectedSchemaVersion;
|
|
2962
2723
|
this.expectedProjectionVersion = options.expectedProjectionVersion;
|
|
2963
|
-
this.logger = options.logger ??
|
|
2724
|
+
this.logger = options.logger ?? createLogger({ serviceName: "runtime-metadata" });
|
|
2964
2725
|
}
|
|
2965
2726
|
/**
|
|
2966
2727
|
* Parse + validate raw manifest JSON body.
|
|
@@ -3151,7 +2912,7 @@ var MetadataDownloader = class {
|
|
|
3151
2912
|
environment: options.environment
|
|
3152
2913
|
});
|
|
3153
2914
|
this.expectedProjectionVersion = options.expectedProjectionVersion ?? PROJECTION_VERSION;
|
|
3154
|
-
this.logger = options.logger ??
|
|
2915
|
+
this.logger = options.logger ?? createLogger({ serviceName: "runtime-metadata" });
|
|
3155
2916
|
this.loader = options.loader ?? new MetadataLoader({
|
|
3156
2917
|
expectedSchemaVersion: options.expectedSchemaVersion,
|
|
3157
2918
|
expectedProjectionVersion: this.expectedProjectionVersion,
|
|
@@ -3215,7 +2976,7 @@ var MetadataDownloader = class {
|
|
|
3215
2976
|
* Does not download common.json or domain projection files.
|
|
3216
2977
|
*/
|
|
3217
2978
|
async downloadBootstrapBundle(manifest) {
|
|
3218
|
-
const timer =
|
|
2979
|
+
const timer = createPerformanceTimer("runtimeMetadata.downloadBootstrap");
|
|
3219
2980
|
const releaseId = manifest.releaseId;
|
|
3220
2981
|
const manifestFileName = PROJECTION_FILE_NAME[PROJECTION_TYPE.MANIFEST];
|
|
3221
2982
|
const logs = createOperationalLogger(this.logger);
|
|
@@ -3982,14 +3743,12 @@ var MetadataCache = class {
|
|
|
3982
3743
|
return guard.generation === this.generation && guard.releaseId === this.snapshot.releaseId;
|
|
3983
3744
|
}
|
|
3984
3745
|
};
|
|
3985
|
-
|
|
3986
|
-
// ../../libs/runtime-metadata/src/lib/resolver/MetadataResolver.ts
|
|
3987
3746
|
var MetadataResolver = class {
|
|
3988
3747
|
cache;
|
|
3989
3748
|
logger;
|
|
3990
3749
|
constructor(options) {
|
|
3991
3750
|
this.cache = options.cache;
|
|
3992
|
-
this.logger = options.logger ??
|
|
3751
|
+
this.logger = options.logger ?? createLogger({ serviceName: "runtime-metadata" });
|
|
3993
3752
|
}
|
|
3994
3753
|
resolve(typeCodeOrRef, valueCodeOrVersion, version) {
|
|
3995
3754
|
if (isMetadataReference(typeCodeOrRef)) {
|
|
@@ -4243,8 +4002,6 @@ var MetadataResolver = class {
|
|
|
4243
4002
|
}
|
|
4244
4003
|
}
|
|
4245
4004
|
};
|
|
4246
|
-
|
|
4247
|
-
// ../../libs/runtime-metadata/src/lib/refresh/MetadataRefreshService.ts
|
|
4248
4005
|
var MetadataRefreshService = class {
|
|
4249
4006
|
cache;
|
|
4250
4007
|
downloader;
|
|
@@ -4262,7 +4019,7 @@ var MetadataRefreshService = class {
|
|
|
4262
4019
|
this.loader = options.loader;
|
|
4263
4020
|
this.configuredRevision = options.configuredRevision;
|
|
4264
4021
|
this.reloadDomainFiles = options.reloadDomainFiles;
|
|
4265
|
-
this.logger = options.logger ??
|
|
4022
|
+
this.logger = options.logger ?? createLogger({ serviceName: "runtime-metadata" });
|
|
4266
4023
|
}
|
|
4267
4024
|
getRefreshStatus() {
|
|
4268
4025
|
return this.refreshStatus;
|
|
@@ -4661,7 +4418,7 @@ var ExtensionMetadataProvider = class {
|
|
|
4661
4418
|
this.baseUrl = options.baseUrl.replace(/\/+$/, "");
|
|
4662
4419
|
this.readyTimeoutMs = options.readyTimeoutMs ?? DEFAULT_READY_TIMEOUT_MS;
|
|
4663
4420
|
this.requestTimeoutMs = options.requestTimeoutMs ?? DEFAULT_REQUEST_TIMEOUT_MS;
|
|
4664
|
-
this.logger = options.logger ??
|
|
4421
|
+
this.logger = options.logger ?? createLogger({ serviceName: "runtime-metadata" });
|
|
4665
4422
|
this.fetchImpl = options.fetchImpl ?? fetch;
|
|
4666
4423
|
}
|
|
4667
4424
|
async isAvailable() {
|
|
@@ -5592,7 +5349,7 @@ function isServingState(state) {
|
|
|
5592
5349
|
return state === "READY" || state === "STALE" || state === "DEGRADED";
|
|
5593
5350
|
}
|
|
5594
5351
|
function correlationLogFields() {
|
|
5595
|
-
const correlationId =
|
|
5352
|
+
const correlationId = getContext().correlationId;
|
|
5596
5353
|
if (!correlationId || correlationId === "unknown") {
|
|
5597
5354
|
return {};
|
|
5598
5355
|
}
|
|
@@ -5888,7 +5645,7 @@ var ProviderFailoverCoordinator = class {
|
|
|
5888
5645
|
}
|
|
5889
5646
|
this.state = PROVIDER_TRANSPORT_STATE.EXTENSION_UNAVAILABLE;
|
|
5890
5647
|
this.lastProbeAt = this.now();
|
|
5891
|
-
const correlationId =
|
|
5648
|
+
const correlationId = getContext().correlationId;
|
|
5892
5649
|
createOperationalLogger(this.logger).warn(RUNTIME_METADATA_EVENTS.PROVIDER_FALLBACK, {
|
|
5893
5650
|
reason,
|
|
5894
5651
|
fallback: METADATA_PROVIDER_KIND.S3,
|
|
@@ -5919,8 +5676,6 @@ var ProviderFailoverCoordinator = class {
|
|
|
5919
5676
|
function isExtensionServing(status) {
|
|
5920
5677
|
return SERVING_STATES.has(status.state) && Boolean(status.releaseId);
|
|
5921
5678
|
}
|
|
5922
|
-
|
|
5923
|
-
// ../../libs/runtime-metadata/src/lib/provider/S3MetadataProvider.ts
|
|
5924
5679
|
var S3MetadataProvider = class {
|
|
5925
5680
|
cache;
|
|
5926
5681
|
resolver;
|
|
@@ -5932,7 +5687,7 @@ var S3MetadataProvider = class {
|
|
|
5932
5687
|
this.resolver = options.resolver;
|
|
5933
5688
|
this.downloader = options.downloader;
|
|
5934
5689
|
this.ensureTypesLoaded = options.ensureTypesLoaded;
|
|
5935
|
-
this.logger = options.logger ??
|
|
5690
|
+
this.logger = options.logger ?? createLogger({ serviceName: "runtime-metadata" });
|
|
5936
5691
|
}
|
|
5937
5692
|
async isAvailable() {
|
|
5938
5693
|
return this.cache.isReady();
|
|
@@ -6445,7 +6200,7 @@ var RuntimeMetadataService = class {
|
|
|
6445
6200
|
providerCoordinator;
|
|
6446
6201
|
constructor(options) {
|
|
6447
6202
|
this.config = resolveRuntimeMetadataConfig(options.config);
|
|
6448
|
-
this.logger = options.logger ??
|
|
6203
|
+
this.logger = options.logger ?? createLogger({ serviceName: "runtime-metadata" });
|
|
6449
6204
|
this.cache = options.cache ?? new MetadataCache();
|
|
6450
6205
|
this.loader = options.loader ?? new MetadataLoader({
|
|
6451
6206
|
expectedSchemaVersion: this.config.expectedSchemaVersion,
|
|
@@ -7649,7 +7404,7 @@ function recoveryCooldownMs(env) {
|
|
|
7649
7404
|
return resolveExtensionRecoveryIntervalMs(env);
|
|
7650
7405
|
}
|
|
7651
7406
|
function correlationFields() {
|
|
7652
|
-
const correlationId =
|
|
7407
|
+
const correlationId = getContext().correlationId;
|
|
7653
7408
|
if (!correlationId || correlationId === "unknown") {
|
|
7654
7409
|
return {};
|
|
7655
7410
|
}
|
|
@@ -7675,8 +7430,6 @@ async function mapPool(items, limit, run) {
|
|
|
7675
7430
|
await Promise.all(workers);
|
|
7676
7431
|
return results;
|
|
7677
7432
|
}
|
|
7678
|
-
|
|
7679
|
-
// ../../libs/runtime-metadata/src/lib/integration/createRuntimeMetadataFromEnv.ts
|
|
7680
7433
|
function createRuntimeMetadataFromEnv(options) {
|
|
7681
7434
|
const env = options.env ?? process.env;
|
|
7682
7435
|
const bucket = resolveMetadataProjectionsBucket(env);
|
|
@@ -7695,10 +7448,10 @@ function createRuntimeMetadataFromEnv(options) {
|
|
|
7695
7448
|
client: options.client,
|
|
7696
7449
|
config,
|
|
7697
7450
|
env,
|
|
7698
|
-
logger: options.logger ??
|
|
7451
|
+
logger: options.logger ?? createLogger({ serviceName: "runtime-metadata" })
|
|
7699
7452
|
});
|
|
7700
7453
|
}
|
|
7701
|
-
var logger =
|
|
7454
|
+
var logger = createLogger({
|
|
7702
7455
|
service: process.env.SERVICE_NAME ?? "api-service",
|
|
7703
7456
|
redactPII: true
|
|
7704
7457
|
});
|