/** * Summarizes a sequence of measurements */ export declare class SmePerformanceSummary { label: string; startTime: number; totalLoadTime: number; timestamps: { [index: string]: number; }; } /** * Web Vitals metrics to track. See more details at https://web.dev/vitals/ */ export declare enum WebVitalFields { CLS = "CumulativeLayoutShift", LCP = "LargestContentfulPaint", FCP = "FirstContentfulPaint", FID = "FirstInputDelay", TTFB = "TimeToFirstByte", TBT = "TotalBlockingTime", TTI = "TimeToInteractive" } /** * List performance entry types that are relevant for our metrics. */ export declare enum PerformanceEntryType { LongTask = "longtask", Resource = "resource", Mark = "mark", Navigation = "navigation" } /** * Simplified performance entry type with only a start time, end time, and entryType. */ export declare class TaskTiming { startTime: number; endTime: number; entryType: PerformanceEntryType; } /** * Performance tracker class handles two things: * 1) Tracking lighthouse metrics (see https://web.dev/vitals/) * 2) Providing a wrapper to mark various times in code for performance measurement. * This is used primarily for shell and various tools to determine load times. */ export declare class PerformanceTracker { static get smePrefix(): string; /** * The source name to use when logging about this service. */ private static get logSourceName(); private static markIndexLoaded; private static markCoreEnvironmentInitStarted; private static markCoreEnvironmentInitCompleted; private static markManifestLoadStarted; private static markLocalizationStarted; private static markAccessibilityManagerStarted; private static markAppContextServiceStarted; private static markAppContextRpcInitStarted; private static markAppContextRpcInitComplete; private static markAppModuleInitialized; private static markAppComponentInitialized; private static markCriticalDataLoaded; private static markNavigationInitialized; private static markNavigationStarted; private static markNavigationCompleted; private static markNavigationMeasure; private static moduleOpening; /** * Used to keep track of various marks when measuring arbitrary timings. */ private static dataLoadMap; /** * Counter for total blocking time on initial loadup. This should be reset every time a new page is initialized. */ private static totalBlockingTime; private static lighthouseMetrics; private static ttiIntervalCheck; private static ttiInProgress; private static wacPo; private static fcp; private static tasks; static readonly timeToInteractiveNotFound = -1; static readonly quietWindowLength = 5000; static readonly ttiTimeout = 10000; static readonly ttiTimeoutThreshold = 2; static readonly totalBlockingTimeThresholdRequirement = 50; private static setLighthouseField; /** * Calculate Time to Interactive using list of longtask and resource events. Time to Interactive calculation * method can be found at https://web.dev/tti#what-is-tti * @param taskList List of all longtask and resource events from current time. * @returns Returns time to interactive if it exists, TTI_NOT_FOUND if not. */ static tryFindTti(taskList: TaskTiming[]): number; /** * Initialize interval to calculate time to interactive. TTI will only be calculated if WAC is in non-production mode; * b/c calculation itself is non-performant. In production, we will use FID as a proxy for TTI. */ static tryStartCalculatingTimeToInteractive(): void; /** * Initialize web-vitals trackers for all lighthouse metrics. If function not supported (eg due to browser limitations) * log warning and return. */ static initializeLighthouseMetricsTrackers(): void; static coreEnvironmentInitStarted(): void; static coreEnvironmentInitCompleted(): void; static manifestLoadStarted(): void; static localizationStarted(): void; static accessibilityManagerStarted(): void; static appContextServiceStarted(): void; static appContextRpcInitStarted(): void; static appContextRpcInitComplete(): void; static appModuleInitialized(): void; static appComponentInitialized(): void; static navigationInitialized(): void; static navigationStarted(): void; static navigationCompleted(moduleOpened: boolean): void; static criticalDataLoaded(): void; /** * Mark an arbitrary measurement with a label. Clear the previous mark(s) prior to starting new one - allow only one at * all times. * @param label The label for the mark and the index for the entry in the internal map. */ static markDataLoadStart(label: string): void; /** * Mark an arbitrary measurement with a label. Intended to be a midpoint between a start and end. * @param label The label for the entry in the data map. * @param specificLabel The label for the mark */ static markDataIntermediary(label: string, specificLabel?: string): void; /** * Get a summary object from the aggregate data points marked previously. * @param label The label for the entry in the data map dictionary * @param specificLabel The label for the new measurement * @returns The performance summary of the multiple marks. */ static markDataLoadEnd(label: string, specificLabel?: string): SmePerformanceSummary; /** * Log app component load time - this contains timings up to when the appComponent is loaded. */ private static logAppComponentLoadTime; /** * Log critical data load time - this measures the time from angular's startNavigation event to a module to the point at * which criticalDataLoad() is called, usually in the ngInit of a module */ private static logCriticalDataLoadTime; }