* 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>)
| 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. |
nothing calls this directly
no test coverage detected