Added enriched metrics (#2432)

This commit is contained in:
sunghyunkang1111
2026-03-25 10:50:57 -05:00
committed by GitHub
parent 8e1b041e3b
commit c42e35f97a
6 changed files with 186 additions and 81 deletions

View File

@@ -1,3 +1,4 @@
import type { PhaseTimings, WebVitals } from "Metrics/Constants";
import MetricScenario from "./MetricEvents";
// Common phases shared across all scenarios
@@ -15,25 +16,12 @@ export enum ApplicationMetricPhase {
// Combined type for all metric phases
export type MetricPhase = CommonMetricPhase | ApplicationMetricPhase;
export interface WebVitals {
lcp?: number; // Largest Contentful Paint
inp?: number; // Interaction to Next Paint
cls?: number; // Cumulative Layout Shift
fcp?: number; // First Contentful Paint
ttfb?: number; // Time to First Byte
}
export interface ScenarioConfig<TPhase extends string = MetricPhase> {
requiredPhases: TPhase[];
timeoutMs: number;
validate?: (ctx: ScenarioContextSnapshot<TPhase>) => boolean; // Optional custom validation
}
export interface PhaseTimings {
endTimeISO: string; // When the phase completed
durationMs: number; // Duration from scenario start to phase completion
}
export interface ScenarioContextSnapshot<TPhase extends string = MetricPhase> {
scenario: MetricScenario;
startTimeISO: string; // Human-readable ISO timestamp