-
Notifications
You must be signed in to change notification settings - Fork 2.6k
/
IPerformanceClient.ts
80 lines (73 loc) · 2.35 KB
/
IPerformanceClient.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License.
*/
import { PerformanceEvent } from "./PerformanceEvent.js";
import { IPerformanceMeasurement } from "./IPerformanceMeasurement.js";
export type PerformanceCallbackFunction = (events: PerformanceEvent[]) => void;
export type InProgressPerformanceEvent = {
end: (
event?: Partial<PerformanceEvent>,
error?: unknown
) => PerformanceEvent | null;
discard: () => void;
add: (fields: { [key: string]: {} | undefined }) => void;
increment: (fields: { [key: string]: number | undefined }) => void;
event: PerformanceEvent;
/**
* @deprecated This attribute will be removed in the next major version
*/
measurement: IPerformanceMeasurement;
};
export interface IPerformanceClient {
startMeasurement(
measureName: string,
correlationId?: string
): InProgressPerformanceEvent;
endMeasurement(event: PerformanceEvent): PerformanceEvent | null;
discardMeasurements(correlationId: string): void;
addFields(
fields: { [key: string]: {} | undefined },
correlationId: string
): void;
incrementFields(
fields: { [key: string]: number | undefined },
correlationId: string
): void;
removePerformanceCallback(callbackId: string): boolean;
addPerformanceCallback(callback: PerformanceCallbackFunction): string;
emitEvents(events: PerformanceEvent[], correlationId: string): void;
/**
* @deprecated This method will be removed in the next major version
*/
startPerformanceMeasurement(
measureName: string,
correlationId: string
): IPerformanceMeasurement;
generateId(): string;
calculateQueuedTime(preQueueTime: number, currentTime: number): number;
addQueueMeasurement(
eventName: string,
correlationId?: string,
queueTime?: number,
manuallyCompleted?: boolean
): void;
setPreQueueTime(eventName: string, correlationId?: string): void;
}
/**
* Queue measurement type
*/
export type QueueMeasurement = {
/**
* Name of performance event
*/
eventName: string;
/**
* Time spent in JS queue
*/
queueTime: number;
/**
* Incomplete pre-queue events are instrumentation bugs that should be fixed.
*/
manuallyCompleted?: boolean;
};