MCPcopy Create free account
hub / github.com/code-pushup/cli / constructor

Method constructor

packages/utils/src/lib/profiler/profiler.ts:91–105  ·  view source on GitHub ↗

* Creates a new Profiler instance with the specified configuration. * * @param options - Configuration options for the profiler * @param options.tracks - Custom track configurations merged with defaults * @param options.prefix - Prefix for all measurement names * @param options.track

(options: ProfilerOptions<T>)

Source from the content-addressed store, hash-verified

89 *
90 */
91 constructor(options: ProfilerOptions<T>) {
92 const { tracks, prefix, enabled, ...defaults } = options;
93 const dataType = 'track-entry';
94
95 this.#enabled = enabled ?? isEnvVarEnabled(PROFILER_ENABLED_ENV_VAR);
96 this.#defaults = { ...defaults, dataType };
97 this.tracks = tracks
98 ? setupTracks({ ...defaults, dataType }, tracks)
99 : undefined;
100 this.#ctxOf = measureCtx({
101 ...defaults,
102 dataType,
103 prefix,
104 });
105 }
106
107 /**
108 * Sets enabled state for this profiler.

Callers

nothing calls this directly

Calls 3

isEnvVarEnabledFunction · 0.85
setupTracksFunction · 0.85
measureCtxFunction · 0.85

Tested by

no test coverage detected