@code-pushup/utils 0.110.0 → 0.111.0
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/package.json +2 -2
- package/src/lib/exit-process.js +1 -1
- package/src/lib/exit-process.js.map +1 -1
- package/src/lib/performance-observer.d.ts +184 -3
- package/src/lib/performance-observer.js +240 -27
- package/src/lib/performance-observer.js.map +1 -1
- package/src/lib/profiler/constants.d.ts +19 -5
- package/src/lib/profiler/constants.js +19 -5
- package/src/lib/profiler/constants.js.map +1 -1
- package/src/lib/profiler/profiler.d.ts +82 -0
- package/src/lib/profiler/profiler.js +147 -5
- package/src/lib/profiler/profiler.js.map +1 -1
- package/src/lib/wal.d.ts +13 -1
- package/src/lib/wal.js.map +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@code-pushup/utils",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.111.0",
|
|
4
4
|
"description": "Low-level utilities (helper functions, etc.) used by Code PushUp CLI",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://github.com/code-pushup/cli/tree/main/packages/utils#readme",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"node": ">=18.2.0"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@code-pushup/models": "0.
|
|
30
|
+
"@code-pushup/models": "0.111.0",
|
|
31
31
|
"ansis": "^3.3.0",
|
|
32
32
|
"build-md": "^0.4.2",
|
|
33
33
|
"bundle-require": "^5.1.0",
|
package/src/lib/exit-process.js
CHANGED
|
@@ -19,7 +19,7 @@ export const DEFAULT_FATAL_EXIT_CODE = 1;
|
|
|
19
19
|
export function installExitHandlers(options = {}) {
|
|
20
20
|
// eslint-disable-next-line functional/no-let
|
|
21
21
|
let closedReason;
|
|
22
|
-
const { onExit, onError, exitOnFatal, exitOnSignal, fatalExitCode = DEFAULT_FATAL_EXIT_CODE, } = options;
|
|
22
|
+
const { onExit, onError, exitOnFatal = false, exitOnSignal = false, fatalExitCode = DEFAULT_FATAL_EXIT_CODE, } = options;
|
|
23
23
|
const close = (code, reason) => {
|
|
24
24
|
if (closedReason) {
|
|
25
25
|
return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exit-process.js","sourceRoot":"","sources":["../../../src/lib/exit-process.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,OAAO,MAAM,cAAc,CAAC;AAEnC,6DAA6D;AAC7D,uOAAuO;AACvO,MAAM,4BAA4B,GAAG,GAAG,CAAC;AACzC,MAAM,kBAAkB,GAAG,CAAC,YAAoB,EAAE,EAAE,CAClD,4BAA4B,GAAG,YAAY,CAAC;AAE9C,MAAM,WAAW,GAAG,CAAC,CAAC;AACtB,MAAM,YAAY,GAAG,EAAE,CAAC;AACxB,MAAM,YAAY,GAAG,CAAC,CAAC;AAEvB,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAA+B,EAAE;IAChE,MAAM,gBAAgB,GAAG,EAAE,CAAC,QAAQ,EAAE,KAAK,OAAO,CAAC;IACnD,OAAO;QACL,MAAM,EAAE,gBAAgB,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,kBAAkB,CAAC,WAAW,CAAC;QACxE,OAAO,EAAE,kBAAkB,CAAC,YAAY,CAAC;QACzC,OAAO,EAAE,kBAAkB,CAAC,YAAY,CAAC;KAC1C,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC;AAkBzC,MAAM,UAAU,mBAAmB,CAAC,UAA8B,EAAE;IAClE,6CAA6C;IAC7C,IAAI,YAAqC,CAAC;IAC1C,MAAM,EACJ,MAAM,EACN,OAAO,EACP,WAAW,
|
|
1
|
+
{"version":3,"file":"exit-process.js","sourceRoot":"","sources":["../../../src/lib/exit-process.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE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type { AppendableSink } from './wal.js';
|
|
3
|
+
/**
|
|
4
|
+
* Encoder that converts PerformanceEntry to domain events.
|
|
5
|
+
*
|
|
6
|
+
* Pure function that transforms performance entries into domain events.
|
|
7
|
+
* Should be stateless, synchronous, and have no side effects.
|
|
8
|
+
* Returns a readonly array of encoded items.
|
|
9
|
+
*/
|
|
10
|
+
export type PerformanceEntryEncoder<F> = (entry: PerformanceEntry) => readonly F[];
|
|
11
|
+
/**
|
|
12
|
+
* Default threshold for triggering queue flushes based on queue length.
|
|
13
|
+
* When the queue length reaches (maxQueueSize - flushThreshold),
|
|
14
|
+
* a flush is triggered to prevent overflow. This provides a buffer zone
|
|
15
|
+
* before hitting the maximum queue capacity.
|
|
16
|
+
*/
|
|
3
17
|
export declare const DEFAULT_FLUSH_THRESHOLD = 20;
|
|
18
|
+
/**
|
|
19
|
+
* Default maximum number of items allowed in the queue before entries are dropped.
|
|
20
|
+
* This acts as a memory safety limit to prevent unbounded memory growth
|
|
21
|
+
* in case of sink slowdown or high-frequency performance entries.
|
|
22
|
+
*/
|
|
23
|
+
export declare const DEFAULT_MAX_QUEUE_SIZE = 10000;
|
|
24
|
+
/**
|
|
25
|
+
* Validates the flush threshold configuration to ensure sensible bounds.
|
|
26
|
+
*
|
|
27
|
+
* The flush threshold must be positive and cannot exceed the maximum queue size,
|
|
28
|
+
* as it represents a buffer zone within the queue capacity.
|
|
29
|
+
*
|
|
30
|
+
* @param flushThreshold - The threshold value to validate (must be > 0)
|
|
31
|
+
* @param maxQueueSize - The maximum queue size for comparison (flushThreshold <= maxQueueSize)
|
|
32
|
+
* @throws {Error} If flushThreshold is not positive or exceeds maxQueueSize
|
|
33
|
+
*/
|
|
34
|
+
export declare function validateFlushThreshold(flushThreshold: number, maxQueueSize: number): void;
|
|
35
|
+
/**
|
|
36
|
+
* Configuration options for the PerformanceObserverSink.
|
|
37
|
+
*
|
|
38
|
+
* @template T - The type of encoded performance data that will be written to the sink
|
|
39
|
+
*/
|
|
4
40
|
export type PerformanceObserverOptions<T> = {
|
|
41
|
+
/**
|
|
42
|
+
* The sink where encoded performance entries will be written.
|
|
43
|
+
* Must implement the AppendableSink interface for handling the encoded data.
|
|
44
|
+
*/
|
|
5
45
|
sink: AppendableSink<T>;
|
|
6
|
-
|
|
7
|
-
|
|
46
|
+
/**
|
|
47
|
+
* Function that encodes raw PerformanceEntry objects into domain-specific types.
|
|
48
|
+
* This transformer converts Node.js performance entries into application-specific data structures.
|
|
49
|
+
* Returns a readonly array of encoded items.
|
|
50
|
+
*/
|
|
51
|
+
encodePerfEntry: PerformanceEntryEncoder<T>;
|
|
52
|
+
/**
|
|
53
|
+
* Whether to enable buffered observation mode.
|
|
54
|
+
* When true, captures all performance entries that occurred before observation started.
|
|
55
|
+
* When false, only captures entries after subscription begins.
|
|
56
|
+
*
|
|
57
|
+
* @default true
|
|
58
|
+
*/
|
|
59
|
+
captureBufferedEntries?: boolean;
|
|
60
|
+
/**
|
|
61
|
+
* Threshold for triggering queue flushes.
|
|
62
|
+
* Flushes occur in two scenarios:
|
|
63
|
+
* 1. When queue length reaches (maxQueueSize - flushThreshold)
|
|
64
|
+
* 2. When the number of items added since last flush reaches flushThreshold
|
|
65
|
+
* Larger values provide more buffer space before hitting capacity limits.
|
|
66
|
+
*
|
|
67
|
+
* @default DEFAULT_FLUSH_THRESHOLD (20)
|
|
68
|
+
*/
|
|
8
69
|
flushThreshold?: number;
|
|
70
|
+
/**
|
|
71
|
+
* Maximum number of items allowed in the queue before new entries are dropped.
|
|
72
|
+
* Acts as a memory safety limit to prevent unbounded growth during sink slowdown.
|
|
73
|
+
*
|
|
74
|
+
* @default DEFAULT_MAX_QUEUE_SIZE (10000)
|
|
75
|
+
*/
|
|
76
|
+
maxQueueSize?: number;
|
|
77
|
+
/**
|
|
78
|
+
* Name of the environment variable to check for debug mode.
|
|
79
|
+
* When the env var is set to 'true', encode failures create performance marks for debugging.
|
|
80
|
+
*
|
|
81
|
+
* @default 'CP_PROFILER_DEBUG'
|
|
82
|
+
*/
|
|
83
|
+
debugEnvVar?: string;
|
|
9
84
|
};
|
|
85
|
+
/**
|
|
86
|
+
* A sink implementation that observes Node.js performance entries and forwards them to a configurable sink.
|
|
87
|
+
*
|
|
88
|
+
* This class provides a buffered, memory-safe bridge between Node.js PerformanceObserver
|
|
89
|
+
* and application-specific data sinks. It handles performance entry encoding, queue management,
|
|
90
|
+
* and graceful degradation under high load conditions.
|
|
91
|
+
*
|
|
92
|
+
* Performance entries flow through the following lifecycle:
|
|
93
|
+
*
|
|
94
|
+
* - Queued in Memory 💾
|
|
95
|
+
* - Items stored in queue (`#queue`) until flushed
|
|
96
|
+
* - Queue limited by `maxQueueSize` to prevent unbounded growth
|
|
97
|
+
* - Items remain in queue if sink is closed during flush
|
|
98
|
+
*
|
|
99
|
+
* - Successfully Written 📤
|
|
100
|
+
* - Items written to sink and counted in `getStats().written`
|
|
101
|
+
* - Queue cleared after successful batch writes
|
|
102
|
+
*
|
|
103
|
+
* - Item Disposition Scenarios 💥
|
|
104
|
+
* - **Encode Failure**: ❌ Items lost when `encode()` throws. Creates perf mark if debug env var (specified by `debugEnvVar`) is set to 'true'.
|
|
105
|
+
* - **Sink Write Failure**: 💾 Items stay in queue when sink write fails during flush
|
|
106
|
+
* - **Sink Closed**: 💾 Items stay in queue when sink is closed during flush
|
|
107
|
+
* - **Proactive Flush Throws**: 💾 Items stay in queue when `flush()` throws during threshold check
|
|
108
|
+
* - **Final Flush Throws**: 💾 Items stay in queue when `flush()` throws at end of callback
|
|
109
|
+
* - **Buffered Flush Throws**: 💾 Items stay in queue when buffered entries flush fails
|
|
110
|
+
* - **Queue Overflow**: ❌ Items dropped when queue reaches `maxQueueSize`
|
|
111
|
+
*
|
|
112
|
+
* @template T - The type of encoded performance data written to the sink
|
|
113
|
+
* @implements {Observer} - Lifecycle management interface
|
|
114
|
+
* @implements {Buffered} - Queue statistics interface
|
|
115
|
+
*/
|
|
10
116
|
export declare class PerformanceObserverSink<T> {
|
|
11
117
|
#private;
|
|
118
|
+
/**
|
|
119
|
+
* Creates a new PerformanceObserverSink with the specified configuration.
|
|
120
|
+
*
|
|
121
|
+
* @param options - Configuration options for the performance observer sink
|
|
122
|
+
* @throws {Error} If flushThreshold validation fails (must be > 0 and <= maxQueueSize)
|
|
123
|
+
*/
|
|
12
124
|
constructor(options: PerformanceObserverOptions<T>);
|
|
13
|
-
|
|
125
|
+
/**
|
|
126
|
+
* Returns whether debug mode is enabled for encode failures.
|
|
127
|
+
*
|
|
128
|
+
* Debug mode is determined by the environment variable specified by `debugEnvVar`
|
|
129
|
+
* (defaults to 'CP_PROFILER_DEBUG'). When enabled, encode failures create
|
|
130
|
+
* performance marks for debugging.
|
|
131
|
+
*
|
|
132
|
+
* @returns true if debug mode is enabled, false otherwise
|
|
133
|
+
*/
|
|
134
|
+
get debug(): boolean;
|
|
135
|
+
/**
|
|
136
|
+
* Returns current queue statistics for monitoring and debugging.
|
|
137
|
+
*
|
|
138
|
+
* Provides insight into the current state of the performance entry queue,
|
|
139
|
+
* useful for monitoring memory usage and processing throughput.
|
|
140
|
+
*
|
|
141
|
+
* @returns Object containing all states and entry counts
|
|
142
|
+
*/
|
|
143
|
+
getStats(): {
|
|
144
|
+
isSubscribed: boolean;
|
|
145
|
+
queued: number;
|
|
146
|
+
dropped: number;
|
|
147
|
+
written: number;
|
|
148
|
+
maxQueueSize: number;
|
|
149
|
+
flushThreshold: number;
|
|
150
|
+
addedSinceLastFlush: number;
|
|
151
|
+
buffered: boolean;
|
|
152
|
+
};
|
|
153
|
+
/**
|
|
154
|
+
* Encodes a raw PerformanceEntry using the configured encoder function.
|
|
155
|
+
*
|
|
156
|
+
* This method delegates to the user-provided encoder function, allowing
|
|
157
|
+
* transformation of Node.js performance entries into application-specific types.
|
|
158
|
+
*
|
|
159
|
+
* @param entry - The raw performance entry to encode
|
|
160
|
+
* @returns Readonly array of encoded items
|
|
161
|
+
*/
|
|
162
|
+
encode(entry: PerformanceEntry): readonly T[];
|
|
163
|
+
/**
|
|
164
|
+
* Starts observing performance entries and forwarding them to the sink.
|
|
165
|
+
*
|
|
166
|
+
* Creates a Node.js PerformanceObserver that monitors 'mark' and 'measure' entries.
|
|
167
|
+
* The observer uses a bounded queue with proactive flushing to manage memory usage.
|
|
168
|
+
* When buffered mode is enabled, any existing buffered entries are immediately flushed.
|
|
169
|
+
* If the sink is closed, items stay in the queue until reopened.
|
|
170
|
+
*
|
|
171
|
+
*/
|
|
14
172
|
subscribe(): void;
|
|
173
|
+
/**
|
|
174
|
+
* Flushes all queued performance entries to the sink.
|
|
175
|
+
*
|
|
176
|
+
* Writes all currently queued encoded performance entries to the configured sink.
|
|
177
|
+
* If the sink is closed, flush is a no-op and items stay in the queue until reopened.
|
|
178
|
+
* The queue is always cleared after flush attempt, regardless of success or failure.
|
|
179
|
+
*/
|
|
15
180
|
flush(): void;
|
|
181
|
+
/**
|
|
182
|
+
* Stops observing performance entries and cleans up resources.
|
|
183
|
+
*
|
|
184
|
+
* Performs a final flush of any remaining queued entries, then disconnects
|
|
185
|
+
* the PerformanceObserver and releases all references.
|
|
186
|
+
*
|
|
187
|
+
* This method is idempotent - safe to call multiple times.
|
|
188
|
+
*/
|
|
16
189
|
unsubscribe(): void;
|
|
190
|
+
/**
|
|
191
|
+
* Checks whether the performance observer is currently active.
|
|
192
|
+
*
|
|
193
|
+
* Returns true if the sink is subscribed and actively observing performance entries.
|
|
194
|
+
* This indicates that a PerformanceObserver instance exists and is connected.
|
|
195
|
+
*
|
|
196
|
+
* @returns true if currently subscribed and observing, false otherwise
|
|
197
|
+
*/
|
|
17
198
|
isSubscribed(): boolean;
|
|
18
199
|
}
|
|
@@ -1,35 +1,216 @@
|
|
|
1
1
|
import { PerformanceObserver, performance, } from 'node:perf_hooks';
|
|
2
|
+
import { isEnvVarEnabled } from './env.js';
|
|
3
|
+
import { PROFILER_DEBUG_ENV_VAR } from './profiler/constants.js';
|
|
4
|
+
/**
|
|
5
|
+
* Array of performance entry types that this observer monitors.
|
|
6
|
+
* Only 'mark' and 'measure' entries are tracked as they represent
|
|
7
|
+
* user-defined performance markers and measurements.
|
|
8
|
+
*/
|
|
2
9
|
const OBSERVED_TYPES = ['mark', 'measure'];
|
|
10
|
+
const OBSERVED_TYPE_SET = new Set(OBSERVED_TYPES);
|
|
11
|
+
/**
|
|
12
|
+
* Converts an error to a performance mark name for debugging.
|
|
13
|
+
* @param error - The error that occurred
|
|
14
|
+
* @param entry - The performance entry that failed to encode
|
|
15
|
+
* @returns A mark name string
|
|
16
|
+
*/
|
|
17
|
+
function errorToPerfMark(error, entry) {
|
|
18
|
+
const errorName = error instanceof Error ? error.name : 'UnknownError';
|
|
19
|
+
const entryName = entry.name || 'unnamed';
|
|
20
|
+
return `encode-error:${errorName}:${entryName}`;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Default threshold for triggering queue flushes based on queue length.
|
|
24
|
+
* When the queue length reaches (maxQueueSize - flushThreshold),
|
|
25
|
+
* a flush is triggered to prevent overflow. This provides a buffer zone
|
|
26
|
+
* before hitting the maximum queue capacity.
|
|
27
|
+
*/
|
|
3
28
|
export const DEFAULT_FLUSH_THRESHOLD = 20;
|
|
29
|
+
/**
|
|
30
|
+
* Default maximum number of items allowed in the queue before entries are dropped.
|
|
31
|
+
* This acts as a memory safety limit to prevent unbounded memory growth
|
|
32
|
+
* in case of sink slowdown or high-frequency performance entries.
|
|
33
|
+
*/
|
|
34
|
+
export const DEFAULT_MAX_QUEUE_SIZE = 10_000;
|
|
35
|
+
/**
|
|
36
|
+
* Validates the flush threshold configuration to ensure sensible bounds.
|
|
37
|
+
*
|
|
38
|
+
* The flush threshold must be positive and cannot exceed the maximum queue size,
|
|
39
|
+
* as it represents a buffer zone within the queue capacity.
|
|
40
|
+
*
|
|
41
|
+
* @param flushThreshold - The threshold value to validate (must be > 0)
|
|
42
|
+
* @param maxQueueSize - The maximum queue size for comparison (flushThreshold <= maxQueueSize)
|
|
43
|
+
* @throws {Error} If flushThreshold is not positive or exceeds maxQueueSize
|
|
44
|
+
*/
|
|
45
|
+
export function validateFlushThreshold(flushThreshold, maxQueueSize) {
|
|
46
|
+
if (flushThreshold <= 0) {
|
|
47
|
+
throw new Error('flushThreshold must be > 0');
|
|
48
|
+
}
|
|
49
|
+
if (flushThreshold > maxQueueSize) {
|
|
50
|
+
throw new Error('flushThreshold must be <= maxQueueSize');
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* A sink implementation that observes Node.js performance entries and forwards them to a configurable sink.
|
|
55
|
+
*
|
|
56
|
+
* This class provides a buffered, memory-safe bridge between Node.js PerformanceObserver
|
|
57
|
+
* and application-specific data sinks. It handles performance entry encoding, queue management,
|
|
58
|
+
* and graceful degradation under high load conditions.
|
|
59
|
+
*
|
|
60
|
+
* Performance entries flow through the following lifecycle:
|
|
61
|
+
*
|
|
62
|
+
* - Queued in Memory 💾
|
|
63
|
+
* - Items stored in queue (`#queue`) until flushed
|
|
64
|
+
* - Queue limited by `maxQueueSize` to prevent unbounded growth
|
|
65
|
+
* - Items remain in queue if sink is closed during flush
|
|
66
|
+
*
|
|
67
|
+
* - Successfully Written 📤
|
|
68
|
+
* - Items written to sink and counted in `getStats().written`
|
|
69
|
+
* - Queue cleared after successful batch writes
|
|
70
|
+
*
|
|
71
|
+
* - Item Disposition Scenarios 💥
|
|
72
|
+
* - **Encode Failure**: ❌ Items lost when `encode()` throws. Creates perf mark if debug env var (specified by `debugEnvVar`) is set to 'true'.
|
|
73
|
+
* - **Sink Write Failure**: 💾 Items stay in queue when sink write fails during flush
|
|
74
|
+
* - **Sink Closed**: 💾 Items stay in queue when sink is closed during flush
|
|
75
|
+
* - **Proactive Flush Throws**: 💾 Items stay in queue when `flush()` throws during threshold check
|
|
76
|
+
* - **Final Flush Throws**: 💾 Items stay in queue when `flush()` throws at end of callback
|
|
77
|
+
* - **Buffered Flush Throws**: 💾 Items stay in queue when buffered entries flush fails
|
|
78
|
+
* - **Queue Overflow**: ❌ Items dropped when queue reaches `maxQueueSize`
|
|
79
|
+
*
|
|
80
|
+
* @template T - The type of encoded performance data written to the sink
|
|
81
|
+
* @implements {Observer} - Lifecycle management interface
|
|
82
|
+
* @implements {Buffered} - Queue statistics interface
|
|
83
|
+
*/
|
|
4
84
|
export class PerformanceObserverSink {
|
|
5
|
-
|
|
85
|
+
/** Encoder function for transforming PerformanceEntry objects into domain types */
|
|
86
|
+
#encodePerfEntry;
|
|
87
|
+
/** Whether buffered observation mode is enabled */
|
|
6
88
|
#buffered;
|
|
89
|
+
/** Threshold for triggering flushes based on queue length proximity to max capacity */
|
|
7
90
|
#flushThreshold;
|
|
91
|
+
/** Maximum number of items allowed in queue before dropping new entries (hard memory limit) */
|
|
92
|
+
#maxQueueSize;
|
|
93
|
+
/** The target sink where encoded performance data is written */
|
|
8
94
|
#sink;
|
|
95
|
+
/** Node.js PerformanceObserver instance, undefined when not subscribed */
|
|
9
96
|
#observer;
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
97
|
+
/** Bounded queue storing encoded performance items awaiting flush */
|
|
98
|
+
#queue = [];
|
|
99
|
+
/** Count of performance entries dropped due to queue overflow */
|
|
100
|
+
#dropped = 0;
|
|
101
|
+
/** Count of performance entries successfully written to sink */
|
|
102
|
+
#written = 0;
|
|
103
|
+
/** Number of items added to queue since last successful flush */
|
|
104
|
+
#addedSinceLastFlush = 0;
|
|
105
|
+
/** Whether debug mode is enabled for encode failures */
|
|
106
|
+
#debug;
|
|
107
|
+
/**
|
|
108
|
+
* Creates a new PerformanceObserverSink with the specified configuration.
|
|
109
|
+
*
|
|
110
|
+
* @param options - Configuration options for the performance observer sink
|
|
111
|
+
* @throws {Error} If flushThreshold validation fails (must be > 0 and <= maxQueueSize)
|
|
112
|
+
*/
|
|
13
113
|
constructor(options) {
|
|
14
|
-
const {
|
|
15
|
-
this.#
|
|
16
|
-
this.#written = new Map(OBSERVED_TYPES.map(t => [t, 0]));
|
|
114
|
+
const { encodePerfEntry, sink, captureBufferedEntries, flushThreshold = DEFAULT_FLUSH_THRESHOLD, maxQueueSize = DEFAULT_MAX_QUEUE_SIZE, debugEnvVar = PROFILER_DEBUG_ENV_VAR, } = options;
|
|
115
|
+
this.#encodePerfEntry = encodePerfEntry;
|
|
17
116
|
this.#sink = sink;
|
|
18
|
-
this.#buffered =
|
|
19
|
-
this.#
|
|
117
|
+
this.#buffered = captureBufferedEntries ?? true;
|
|
118
|
+
this.#maxQueueSize = maxQueueSize;
|
|
119
|
+
validateFlushThreshold(flushThreshold, this.#maxQueueSize);
|
|
120
|
+
this.#flushThreshold = flushThreshold;
|
|
121
|
+
this.#debug = isEnvVarEnabled(debugEnvVar);
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Returns whether debug mode is enabled for encode failures.
|
|
125
|
+
*
|
|
126
|
+
* Debug mode is determined by the environment variable specified by `debugEnvVar`
|
|
127
|
+
* (defaults to 'CP_PROFILER_DEBUG'). When enabled, encode failures create
|
|
128
|
+
* performance marks for debugging.
|
|
129
|
+
*
|
|
130
|
+
* @returns true if debug mode is enabled, false otherwise
|
|
131
|
+
*/
|
|
132
|
+
get debug() {
|
|
133
|
+
return this.#debug;
|
|
20
134
|
}
|
|
135
|
+
/**
|
|
136
|
+
* Returns current queue statistics for monitoring and debugging.
|
|
137
|
+
*
|
|
138
|
+
* Provides insight into the current state of the performance entry queue,
|
|
139
|
+
* useful for monitoring memory usage and processing throughput.
|
|
140
|
+
*
|
|
141
|
+
* @returns Object containing all states and entry counts
|
|
142
|
+
*/
|
|
143
|
+
getStats() {
|
|
144
|
+
return {
|
|
145
|
+
isSubscribed: this.isSubscribed(),
|
|
146
|
+
queued: this.#queue.length,
|
|
147
|
+
dropped: this.#dropped,
|
|
148
|
+
written: this.#written,
|
|
149
|
+
maxQueueSize: this.#maxQueueSize,
|
|
150
|
+
flushThreshold: this.#flushThreshold,
|
|
151
|
+
addedSinceLastFlush: this.#addedSinceLastFlush,
|
|
152
|
+
buffered: this.#buffered,
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Encodes a raw PerformanceEntry using the configured encoder function.
|
|
157
|
+
*
|
|
158
|
+
* This method delegates to the user-provided encoder function, allowing
|
|
159
|
+
* transformation of Node.js performance entries into application-specific types.
|
|
160
|
+
*
|
|
161
|
+
* @param entry - The raw performance entry to encode
|
|
162
|
+
* @returns Readonly array of encoded items
|
|
163
|
+
*/
|
|
21
164
|
encode(entry) {
|
|
22
|
-
return this.#
|
|
165
|
+
return this.#encodePerfEntry(entry);
|
|
23
166
|
}
|
|
167
|
+
/**
|
|
168
|
+
* Starts observing performance entries and forwarding them to the sink.
|
|
169
|
+
*
|
|
170
|
+
* Creates a Node.js PerformanceObserver that monitors 'mark' and 'measure' entries.
|
|
171
|
+
* The observer uses a bounded queue with proactive flushing to manage memory usage.
|
|
172
|
+
* When buffered mode is enabled, any existing buffered entries are immediately flushed.
|
|
173
|
+
* If the sink is closed, items stay in the queue until reopened.
|
|
174
|
+
*
|
|
175
|
+
*/
|
|
24
176
|
subscribe() {
|
|
25
177
|
if (this.#observer) {
|
|
26
178
|
return;
|
|
27
179
|
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
180
|
+
this.#observer = new PerformanceObserver(list => {
|
|
181
|
+
list.getEntries().forEach(entry => {
|
|
182
|
+
if (OBSERVED_TYPE_SET.has(entry.entryType)) {
|
|
183
|
+
try {
|
|
184
|
+
const items = this.encode(entry);
|
|
185
|
+
items.forEach(item => {
|
|
186
|
+
// ❌ MAX QUEUE OVERFLOW
|
|
187
|
+
if (this.#queue.length >= this.#maxQueueSize) {
|
|
188
|
+
this.#dropped++; // Items are lost forever
|
|
189
|
+
return;
|
|
190
|
+
}
|
|
191
|
+
if (this.#queue.length >=
|
|
192
|
+
this.#maxQueueSize - this.#flushThreshold) {
|
|
193
|
+
this.flush();
|
|
194
|
+
}
|
|
195
|
+
this.#queue.push(item);
|
|
196
|
+
this.#addedSinceLastFlush++;
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
catch (error) {
|
|
200
|
+
// ❌ Encode failure: item lost forever as user has to fix encode function.
|
|
201
|
+
this.#dropped++;
|
|
202
|
+
if (this.#debug) {
|
|
203
|
+
try {
|
|
204
|
+
performance.mark(errorToPerfMark(error, entry));
|
|
205
|
+
}
|
|
206
|
+
catch {
|
|
207
|
+
// Ignore mark failures to prevent double errors
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
});
|
|
213
|
+
if (this.#addedSinceLastFlush >= this.#flushThreshold) {
|
|
33
214
|
this.flush();
|
|
34
215
|
}
|
|
35
216
|
});
|
|
@@ -37,33 +218,65 @@ export class PerformanceObserverSink {
|
|
|
37
218
|
entryTypes: OBSERVED_TYPES,
|
|
38
219
|
buffered: this.#buffered,
|
|
39
220
|
});
|
|
221
|
+
if (this.#buffered) {
|
|
222
|
+
this.flush();
|
|
223
|
+
}
|
|
40
224
|
}
|
|
225
|
+
/**
|
|
226
|
+
* Flushes all queued performance entries to the sink.
|
|
227
|
+
*
|
|
228
|
+
* Writes all currently queued encoded performance entries to the configured sink.
|
|
229
|
+
* If the sink is closed, flush is a no-op and items stay in the queue until reopened.
|
|
230
|
+
* The queue is always cleared after flush attempt, regardless of success or failure.
|
|
231
|
+
*/
|
|
41
232
|
flush() {
|
|
42
|
-
if (
|
|
233
|
+
if (this.#queue.length === 0) {
|
|
234
|
+
return;
|
|
235
|
+
}
|
|
236
|
+
if (this.#sink.isClosed()) {
|
|
43
237
|
return;
|
|
44
238
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
239
|
+
// Process each item in queue
|
|
240
|
+
const failedItems = [];
|
|
241
|
+
this.#queue.forEach(item => {
|
|
48
242
|
try {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
.forEach(item => this.#sink.append(item));
|
|
52
|
-
this.#written.set(t, written + fresh.length);
|
|
243
|
+
this.#sink.append(item);
|
|
244
|
+
this.#written++;
|
|
53
245
|
}
|
|
54
|
-
catch
|
|
55
|
-
|
|
246
|
+
catch {
|
|
247
|
+
failedItems.push(item);
|
|
56
248
|
}
|
|
57
249
|
});
|
|
58
|
-
|
|
250
|
+
// Clear queue but keep failed items for retry
|
|
251
|
+
this.#queue.length = 0;
|
|
252
|
+
this.#queue.push(...failedItems);
|
|
253
|
+
this.#addedSinceLastFlush = failedItems.length;
|
|
59
254
|
}
|
|
255
|
+
/**
|
|
256
|
+
* Stops observing performance entries and cleans up resources.
|
|
257
|
+
*
|
|
258
|
+
* Performs a final flush of any remaining queued entries, then disconnects
|
|
259
|
+
* the PerformanceObserver and releases all references.
|
|
260
|
+
*
|
|
261
|
+
* This method is idempotent - safe to call multiple times.
|
|
262
|
+
*/
|
|
60
263
|
unsubscribe() {
|
|
61
264
|
if (!this.#observer) {
|
|
62
265
|
return;
|
|
63
266
|
}
|
|
64
|
-
this
|
|
267
|
+
this.flush();
|
|
268
|
+
this.#addedSinceLastFlush = 0;
|
|
269
|
+
this.#observer.disconnect();
|
|
65
270
|
this.#observer = undefined;
|
|
66
271
|
}
|
|
272
|
+
/**
|
|
273
|
+
* Checks whether the performance observer is currently active.
|
|
274
|
+
*
|
|
275
|
+
* Returns true if the sink is subscribed and actively observing performance entries.
|
|
276
|
+
* This indicates that a PerformanceObserver instance exists and is connected.
|
|
277
|
+
*
|
|
278
|
+
* @returns true if currently subscribed and observing, false otherwise
|
|
279
|
+
*/
|
|
67
280
|
isSubscribed() {
|
|
68
281
|
return this.#observer !== undefined;
|
|
69
282
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"performance-observer.js","sourceRoot":"","sources":["../../../src/lib/performance-observer.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,mBAAmB,
|
|
1
|
+
{"version":3,"file":"performance-observer.js","sourceRoot":"","sources":["../../../src/lib/performance-observer.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,mBAA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;QACjC,IAAI,CAAC,oBAAoB,GAAG,WAAW,CAAC,MAAM,CAAC;IACjD,CAAC;IAED;;;;;;;OAOG;IACH,WAAW;QACT,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC;YACpB,OAAO;QACT,CAAC;QACD,IAAI,CAAC,KAAK,EAAE,CAAC;QACb,IAAI,CAAC,oBAAoB,GAAG,CAAC,CAAC;QAC9B,IAAI,CAAC,SAAS,CAAC,UAAU,EAAE,CAAC;QAC5B,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC7B,CAAC;IAED;;;;;;;OAOG;IACH,YAAY;QACV,OAAO,IAAI,CAAC,SAAS,KAAK,SAAS,CAAC;IACtC,CAAC;CACF"}
|
|
@@ -1,6 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Environment variable name for enabling/disabling profiling globally.
|
|
3
|
+
* When set to 'true', profiling is enabled. When set to 'false' or unset, profiling is disabled.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```bash
|
|
7
|
+
* CP_PROFILING=true npm run dev
|
|
8
|
+
* ```
|
|
9
|
+
*/
|
|
1
10
|
export declare const PROFILER_ENABLED_ENV_VAR = "CP_PROFILING";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
11
|
+
/**
|
|
12
|
+
* Environment variable name for enabling debug mode for profiler state transitions.
|
|
13
|
+
* When set to 'true', profiler state transitions create performance marks for debugging.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```bash
|
|
17
|
+
* CP_PROFILER_DEBUG=true npm run dev
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export declare const PROFILER_DEBUG_ENV_VAR = "CP_PROFILER_DEBUG";
|
|
@@ -1,7 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Environment variable name for enabling/disabling profiling globally.
|
|
3
|
+
* When set to 'true', profiling is enabled. When set to 'false' or unset, profiling is disabled.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```bash
|
|
7
|
+
* CP_PROFILING=true npm run dev
|
|
8
|
+
* ```
|
|
9
|
+
*/
|
|
1
10
|
export const PROFILER_ENABLED_ENV_VAR = 'CP_PROFILING';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
11
|
+
/**
|
|
12
|
+
* Environment variable name for enabling debug mode for profiler state transitions.
|
|
13
|
+
* When set to 'true', profiler state transitions create performance marks for debugging.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```bash
|
|
17
|
+
* CP_PROFILER_DEBUG=true npm run dev
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export const PROFILER_DEBUG_ENV_VAR = 'CP_PROFILER_DEBUG';
|
|
7
21
|
//# sourceMappingURL=constants.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../src/lib/profiler/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,wBAAwB,GAAG,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../src/lib/profiler/constants.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,cAAc,CAAC;AAEvD;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,mBAAmB,CAAC"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import { type PerformanceObserverOptions } from '../performance-observer.js';
|
|
1
2
|
import { type ActionTrackConfigs, type MeasureCtxOptions, type MeasureOptions } from '../user-timing-extensibility-api-utils.js';
|
|
2
3
|
import type { ActionTrackEntryPayload, DevToolsColor, EntryMeta } from '../user-timing-extensibility-api.type.js';
|
|
4
|
+
import type { AppendableSink } from '../wal.js';
|
|
3
5
|
/**
|
|
4
6
|
* Generates a unique profiler ID based on performance time origin, process ID, thread ID, and instance count.
|
|
5
7
|
*/
|
|
@@ -137,4 +139,84 @@ export declare class Profiler<T extends ActionTrackConfigs> {
|
|
|
137
139
|
*/
|
|
138
140
|
measureAsync<R>(event: string, work: () => Promise<R>, options?: MeasureOptions<R>): Promise<R>;
|
|
139
141
|
}
|
|
142
|
+
/**
|
|
143
|
+
* Options for configuring a NodejsProfiler instance.
|
|
144
|
+
*
|
|
145
|
+
* Extends ProfilerOptions with a required sink parameter.
|
|
146
|
+
*
|
|
147
|
+
* @template Tracks - Record type defining available track names and their configurations
|
|
148
|
+
*/
|
|
149
|
+
export type NodejsProfilerOptions<DomainEvents, Tracks extends Record<string, ActionTrackEntryPayload>> = ProfilerOptions<Tracks> & Omit<PerformanceObserverOptions<DomainEvents>, 'sink'> & {
|
|
150
|
+
/**
|
|
151
|
+
* Sink for buffering and flushing performance data
|
|
152
|
+
*/
|
|
153
|
+
sink: AppendableSink<DomainEvents>;
|
|
154
|
+
/**
|
|
155
|
+
* Name of the environment variable to check for debug mode.
|
|
156
|
+
* When the env var is set to 'true', profiler state transitions create performance marks for debugging.
|
|
157
|
+
*
|
|
158
|
+
* @default 'CP_PROFILER_DEBUG'
|
|
159
|
+
*/
|
|
160
|
+
debugEnvVar?: string;
|
|
161
|
+
};
|
|
162
|
+
/**
|
|
163
|
+
* Performance profiler with automatic process exit handling for buffered performance data.
|
|
164
|
+
*
|
|
165
|
+
* This class extends the base {@link Profiler} with automatic flushing of performance data
|
|
166
|
+
* when the process exits. It accepts a {@link PerformanceObserverSink} that buffers performance
|
|
167
|
+
* entries and ensures they are written out during process termination, even for unexpected exits.
|
|
168
|
+
*
|
|
169
|
+
* The sink defines the output format for performance data, enabling flexible serialization
|
|
170
|
+
* to various formats such as DevTools TraceEvent JSON, OpenTelemetry protocol buffers,
|
|
171
|
+
* or custom domain-specific formats.
|
|
172
|
+
*
|
|
173
|
+
* The profiler automatically subscribes to the performance observer when enabled and installs
|
|
174
|
+
* exit handlers that flush buffered data on process termination (signals, fatal errors, or normal exit).
|
|
175
|
+
*
|
|
176
|
+
*/
|
|
177
|
+
export declare class NodejsProfiler<DomainEvents, Tracks extends Record<string, ActionTrackEntryPayload> = Record<string, ActionTrackEntryPayload>> extends Profiler<Tracks> {
|
|
178
|
+
#private;
|
|
179
|
+
/**
|
|
180
|
+
* Creates a NodejsProfiler instance.
|
|
181
|
+
* @param options - Configuration with required sink
|
|
182
|
+
*/
|
|
183
|
+
constructor(options: NodejsProfilerOptions<DomainEvents, Tracks>);
|
|
184
|
+
/**
|
|
185
|
+
* Returns whether debug mode is enabled for profiler state transitions.
|
|
186
|
+
*
|
|
187
|
+
* Debug mode is determined by the environment variable specified by `debugEnvVar`
|
|
188
|
+
* (defaults to 'CP_PROFILER_DEBUG'). When enabled, profiler state transitions create
|
|
189
|
+
* performance marks for debugging.
|
|
190
|
+
*
|
|
191
|
+
* @returns true if debug mode is enabled, false otherwise
|
|
192
|
+
*/
|
|
193
|
+
get debug(): boolean;
|
|
194
|
+
/**
|
|
195
|
+
* Closes profiler and releases resources. Idempotent, safe for exit handlers.
|
|
196
|
+
* **Exit Handler Usage**: Call only this method from process exit handlers.
|
|
197
|
+
*/
|
|
198
|
+
close(): void;
|
|
199
|
+
/** @returns Current profiler state */
|
|
200
|
+
get state(): 'idle' | 'running' | 'closed';
|
|
201
|
+
/** @returns Whether profiler is in 'running' state */
|
|
202
|
+
isEnabled(): boolean;
|
|
203
|
+
/** Enables profiling (start/stop) */
|
|
204
|
+
setEnabled(enabled: boolean): void;
|
|
205
|
+
/** @returns Queue statistics and profiling state for monitoring */
|
|
206
|
+
get stats(): {
|
|
207
|
+
debug: boolean;
|
|
208
|
+
state: "idle" | "running" | "closed";
|
|
209
|
+
walOpen: boolean;
|
|
210
|
+
isSubscribed: boolean;
|
|
211
|
+
queued: number;
|
|
212
|
+
dropped: number;
|
|
213
|
+
written: number;
|
|
214
|
+
maxQueueSize: number;
|
|
215
|
+
flushThreshold: number;
|
|
216
|
+
addedSinceLastFlush: number;
|
|
217
|
+
buffered: boolean;
|
|
218
|
+
};
|
|
219
|
+
/** Flushes buffered performance data to sink. */
|
|
220
|
+
flush(): void;
|
|
221
|
+
}
|
|
140
222
|
export {};
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
+
import { performance } from 'node:perf_hooks';
|
|
1
2
|
import process from 'node:process';
|
|
2
3
|
import { threadId } from 'node:worker_threads';
|
|
3
4
|
import { isEnvVarEnabled } from '../env.js';
|
|
5
|
+
import { PerformanceObserverSink, } from '../performance-observer.js';
|
|
6
|
+
import { objectToEntries } from '../transform.js';
|
|
4
7
|
import { asOptions, markerPayload, measureCtx, setupTracks, } from '../user-timing-extensibility-api-utils.js';
|
|
5
|
-
import { PROFILER_ENABLED_ENV_VAR } from './constants.js';
|
|
8
|
+
import { PROFILER_DEBUG_ENV_VAR, PROFILER_ENABLED_ENV_VAR, } from './constants.js';
|
|
6
9
|
/**
|
|
7
10
|
* Generates a unique profiler ID based on performance time origin, process ID, thread ID, and instance count.
|
|
8
11
|
*/
|
|
@@ -20,7 +23,7 @@ export function getProfilerId() {
|
|
|
20
23
|
export class Profiler {
|
|
21
24
|
static instanceCount = 0;
|
|
22
25
|
id = getProfilerId();
|
|
23
|
-
#enabled;
|
|
26
|
+
#enabled = false;
|
|
24
27
|
#defaults;
|
|
25
28
|
tracks;
|
|
26
29
|
#ctxOf;
|
|
@@ -96,7 +99,7 @@ export class Profiler {
|
|
|
96
99
|
* });
|
|
97
100
|
*/
|
|
98
101
|
marker(name, opt) {
|
|
99
|
-
if (!this
|
|
102
|
+
if (!this.isEnabled()) {
|
|
100
103
|
return;
|
|
101
104
|
}
|
|
102
105
|
performance.mark(name, asOptions(markerPayload({
|
|
@@ -122,7 +125,7 @@ export class Profiler {
|
|
|
122
125
|
*
|
|
123
126
|
*/
|
|
124
127
|
measure(event, work, options) {
|
|
125
|
-
if (!this
|
|
128
|
+
if (!this.isEnabled()) {
|
|
126
129
|
return work();
|
|
127
130
|
}
|
|
128
131
|
const { start, success, error } = this.#ctxOf(event, options);
|
|
@@ -154,7 +157,7 @@ export class Profiler {
|
|
|
154
157
|
*
|
|
155
158
|
*/
|
|
156
159
|
async measureAsync(event, work, options) {
|
|
157
|
-
if (!this
|
|
160
|
+
if (!this.isEnabled()) {
|
|
158
161
|
return await work();
|
|
159
162
|
}
|
|
160
163
|
const { start, success, error } = this.#ctxOf(event, options);
|
|
@@ -170,4 +173,143 @@ export class Profiler {
|
|
|
170
173
|
}
|
|
171
174
|
}
|
|
172
175
|
}
|
|
176
|
+
/**
|
|
177
|
+
* Performance profiler with automatic process exit handling for buffered performance data.
|
|
178
|
+
*
|
|
179
|
+
* This class extends the base {@link Profiler} with automatic flushing of performance data
|
|
180
|
+
* when the process exits. It accepts a {@link PerformanceObserverSink} that buffers performance
|
|
181
|
+
* entries and ensures they are written out during process termination, even for unexpected exits.
|
|
182
|
+
*
|
|
183
|
+
* The sink defines the output format for performance data, enabling flexible serialization
|
|
184
|
+
* to various formats such as DevTools TraceEvent JSON, OpenTelemetry protocol buffers,
|
|
185
|
+
* or custom domain-specific formats.
|
|
186
|
+
*
|
|
187
|
+
* The profiler automatically subscribes to the performance observer when enabled and installs
|
|
188
|
+
* exit handlers that flush buffered data on process termination (signals, fatal errors, or normal exit).
|
|
189
|
+
*
|
|
190
|
+
*/
|
|
191
|
+
export class NodejsProfiler extends Profiler {
|
|
192
|
+
#sink;
|
|
193
|
+
#performanceObserverSink;
|
|
194
|
+
#state = 'idle';
|
|
195
|
+
#debug;
|
|
196
|
+
/**
|
|
197
|
+
* Creates a NodejsProfiler instance.
|
|
198
|
+
* @param options - Configuration with required sink
|
|
199
|
+
*/
|
|
200
|
+
constructor(options) {
|
|
201
|
+
const { sink, encodePerfEntry, captureBufferedEntries, flushThreshold, maxQueueSize, enabled, debugEnvVar = PROFILER_DEBUG_ENV_VAR, ...profilerOptions } = options;
|
|
202
|
+
const initialEnabled = enabled ?? isEnvVarEnabled(PROFILER_ENABLED_ENV_VAR);
|
|
203
|
+
super({ ...profilerOptions, enabled: initialEnabled });
|
|
204
|
+
this.#sink = sink;
|
|
205
|
+
this.#debug = isEnvVarEnabled(debugEnvVar);
|
|
206
|
+
this.#performanceObserverSink = new PerformanceObserverSink({
|
|
207
|
+
sink,
|
|
208
|
+
encodePerfEntry,
|
|
209
|
+
captureBufferedEntries,
|
|
210
|
+
flushThreshold,
|
|
211
|
+
maxQueueSize,
|
|
212
|
+
debugEnvVar,
|
|
213
|
+
});
|
|
214
|
+
if (initialEnabled) {
|
|
215
|
+
this.#transition('running');
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* Returns whether debug mode is enabled for profiler state transitions.
|
|
220
|
+
*
|
|
221
|
+
* Debug mode is determined by the environment variable specified by `debugEnvVar`
|
|
222
|
+
* (defaults to 'CP_PROFILER_DEBUG'). When enabled, profiler state transitions create
|
|
223
|
+
* performance marks for debugging.
|
|
224
|
+
*
|
|
225
|
+
* @returns true if debug mode is enabled, false otherwise
|
|
226
|
+
*/
|
|
227
|
+
get debug() {
|
|
228
|
+
return this.#debug;
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* Creates a performance marker for a profiler state transition.
|
|
232
|
+
* @param transition - The state transition that occurred
|
|
233
|
+
*/
|
|
234
|
+
#transitionMarker(transition) {
|
|
235
|
+
const transitionMarkerPayload = {
|
|
236
|
+
dataType: 'marker',
|
|
237
|
+
color: 'primary',
|
|
238
|
+
tooltipText: `Profiler state transition: ${transition}`,
|
|
239
|
+
properties: [['Transition', transition], ...objectToEntries(this.stats)],
|
|
240
|
+
};
|
|
241
|
+
this.marker(transition, transitionMarkerPayload);
|
|
242
|
+
}
|
|
243
|
+
#transition(next) {
|
|
244
|
+
if (this.#state === next) {
|
|
245
|
+
return;
|
|
246
|
+
}
|
|
247
|
+
if (this.#state === 'closed') {
|
|
248
|
+
throw new Error('Profiler already closed');
|
|
249
|
+
}
|
|
250
|
+
const transition = `${this.#state}->${next}`;
|
|
251
|
+
switch (transition) {
|
|
252
|
+
case 'idle->running':
|
|
253
|
+
super.setEnabled(true);
|
|
254
|
+
this.#sink.open?.();
|
|
255
|
+
this.#performanceObserverSink.subscribe();
|
|
256
|
+
break;
|
|
257
|
+
case 'running->idle':
|
|
258
|
+
case 'running->closed':
|
|
259
|
+
super.setEnabled(false);
|
|
260
|
+
this.#performanceObserverSink.unsubscribe();
|
|
261
|
+
this.#sink.close?.();
|
|
262
|
+
break;
|
|
263
|
+
case 'idle->closed':
|
|
264
|
+
// No-op, was not open
|
|
265
|
+
break;
|
|
266
|
+
default:
|
|
267
|
+
throw new Error(`Invalid transition: ${this.#state} -> ${next}`);
|
|
268
|
+
}
|
|
269
|
+
this.#state = next;
|
|
270
|
+
if (this.#debug) {
|
|
271
|
+
this.#transitionMarker(transition);
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
/**
|
|
275
|
+
* Closes profiler and releases resources. Idempotent, safe for exit handlers.
|
|
276
|
+
* **Exit Handler Usage**: Call only this method from process exit handlers.
|
|
277
|
+
*/
|
|
278
|
+
close() {
|
|
279
|
+
this.#transition('closed');
|
|
280
|
+
}
|
|
281
|
+
/** @returns Current profiler state */
|
|
282
|
+
get state() {
|
|
283
|
+
return this.#state;
|
|
284
|
+
}
|
|
285
|
+
/** @returns Whether profiler is in 'running' state */
|
|
286
|
+
isEnabled() {
|
|
287
|
+
return this.#state === 'running';
|
|
288
|
+
}
|
|
289
|
+
/** Enables profiling (start/stop) */
|
|
290
|
+
setEnabled(enabled) {
|
|
291
|
+
if (enabled) {
|
|
292
|
+
this.#transition('running');
|
|
293
|
+
}
|
|
294
|
+
else {
|
|
295
|
+
this.#transition('idle');
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
/** @returns Queue statistics and profiling state for monitoring */
|
|
299
|
+
get stats() {
|
|
300
|
+
return {
|
|
301
|
+
...this.#performanceObserverSink.getStats(),
|
|
302
|
+
debug: this.#debug,
|
|
303
|
+
state: this.#state,
|
|
304
|
+
walOpen: !this.#sink.isClosed(),
|
|
305
|
+
};
|
|
306
|
+
}
|
|
307
|
+
/** Flushes buffered performance data to sink. */
|
|
308
|
+
flush() {
|
|
309
|
+
if (this.#state === 'closed') {
|
|
310
|
+
return; // No-op if closed
|
|
311
|
+
}
|
|
312
|
+
this.#performanceObserverSink.flush();
|
|
313
|
+
}
|
|
314
|
+
}
|
|
173
315
|
//# sourceMappingURL=profiler.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profiler.js","sourceRoot":"","sources":["../../../../src/lib/profiler/profiler.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,cAAc,CAAC;AACnC,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAIL,SAAS,EACT,aAAa,EACb,UAAU,EACV,WAAW,GACZ,MAAM,2CAA2C,CAAC;
|
|
1
|
+
{"version":3,"file":"profiler.js","sourceRoot":"","sources":["../../../../src/lib/profiler/profiler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,OAAO,MAAM,cAAc,CAAC;AACnC,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAEL,uBAAuB,GACxB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAIL,SAAS,EACT,aAAa,EACb,UAAU,EACV,WAAW,GACZ,MAAM,2CAA2C,CAAC;AAQnD,OAAO,EACL,sBAAsB,EACtB,wBAAwB,GACzB,MAAM,gBAAgB,CAAC;AAExB;;GAEG;AACH,MAAM,UAAU,aAAa;IAC3B,qDAAqD;IACrD,OAAO,GAAG,IAAI,CAAC,KA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C;QAEnB,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YAChB,IAAI,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAC;QACrC,CAAC;IACH,CAAC;IAED;;;OAGG;IACH,KAAK;QACH,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;IAC7B,CAAC;IAED,sCAAsC;IACtC,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAED,sDAAsD;IAC7C,SAAS;QAChB,OAAO,IAAI,CAAC,MAAM,KAAK,SAAS,CAAC;IACnC,CAAC;IAED,qCAAqC;IAC5B,UAAU,CAAC,OAAgB;QAClC,IAAI,OAAO,EAAE,CAAC;YACZ,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;QAC9B,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;QAC3B,CAAC;IACH,CAAC;IAED,mEAAmE;IACnE,IAAI,KAAK;QACP,OAAO;YACL,GAAG,IAAI,CAAC,wBAAwB,CAAC,QAAQ,EAAE;YAC3C,KAAK,EAAE,IAAI,CAAC,MAAM;YAClB,KAAK,EAAE,IAAI,CAAC,MAAM;YAClB,OAAO,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE;SAChC,CAAC;IACJ,CAAC;IAED,iDAAiD;IACjD,KAAK;QACH,IAAI,IAAI,CAAC,MAAM,KAAK,QAAQ,EAAE,CAAC;YAC7B,OAAO,CAAC,kBAAkB;QAC5B,CAAC;QACD,IAAI,CAAC,wBAAwB,CAAC,KAAK,EAAE,CAAC;IACxC,CAAC;CACF"}
|
package/src/lib/wal.d.ts
CHANGED
|
@@ -16,8 +16,20 @@ export type InvalidEntry<O = string> = {
|
|
|
16
16
|
* Interface for sinks that can append items.
|
|
17
17
|
* Allows for different types of appendable storage (WAL, in-memory, etc.)
|
|
18
18
|
*/
|
|
19
|
-
export type AppendableSink<T> = {
|
|
19
|
+
export type AppendableSink<T> = Recoverable & {
|
|
20
20
|
append: (item: T) => void;
|
|
21
|
+
isClosed: () => boolean;
|
|
22
|
+
open?: () => void;
|
|
23
|
+
close?: () => void;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Interface for sinks that support recovery operations.
|
|
27
|
+
* Represents the recoverable subset of AppendableSink functionality.
|
|
28
|
+
*/
|
|
29
|
+
export type Recoverable = {
|
|
30
|
+
recover: () => RecoverResult<unknown>;
|
|
31
|
+
repack: (out?: string) => void;
|
|
32
|
+
finalize?: (opt?: Record<string, unknown>) => void;
|
|
21
33
|
};
|
|
22
34
|
/**
|
|
23
35
|
* Result of recovering records from a WAL file.
|
package/src/lib/wal.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wal.js","sourceRoot":"","sources":["../../../src/lib/wal.ts"],"names":[],"mappings":"AAAA,8BAA8B;AAC9B,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,OAAO,MAAM,cAAc,CAAC;AACnC,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAoD/C,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAgB,KAGlD,EAAiC,EAAE;IAClC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC;IAEjC,OAAO;QACL,MAAM,EAAE,CAAC,CAAC,EAAE,CACV,CAAC,IAAI,OAAO,CAAC,KAAK,QAAQ,IAAI,WAAW,IAAI,CAAC;YAC5C,CAAC,CAAE,CAAqB,CAAC,GAAG;YAC5B,CAAC,CAAC,MAAM,CAAC,CAAM,CAAC;QACpB,MAAM,EAAE,CAAC,CAAC,EAAE;YACV,IAAI,CAAC;gBACH,OAAO,MAAM,CAAC,CAAC,CAAC,CAAC;YACnB,CAAC;YAAC,MAAM,CAAC;gBACP,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,GAAG,EAAE,C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