@dudousxd/nestjs-telescope
Version:
Laravel Telescope-style observability console for NestJS — core: watchers, recorder, correlation, SQLite store, headless API.
20 lines • 837 B
JavaScript
// packages/core/src/profiling/profiling-config.ts
/** Resolve + validate profiling options into a fully-defaulted config. */
export function resolveProfilingConfig(options) {
const enabled = options?.enabled === true;
const sampleRate = clamp01(options?.sampleRate ?? 0);
const maxConcurrent = Math.max(1, Math.floor(options?.maxConcurrent ?? 1));
const minDurationMs = Math.max(0, options?.minDurationMs ?? 0);
const samplingIntervalMicros = Math.max(1, Math.floor(options?.samplingIntervalMicros ?? 1000));
return { enabled, sampleRate, maxConcurrent, minDurationMs, samplingIntervalMicros };
}
function clamp01(value) {
if (!Number.isFinite(value))
return 0;
if (value < 0)
return 0;
if (value > 1)
return 1;
return value;
}
//# sourceMappingURL=profiling-config.js.map