UNPKG

@zendesk/react-measure-timing-hooks

Version:

react hooks for measuring time to interactive and time to render of components

36 lines (35 loc) 1.91 kB
import type { SpanMatcherFn } from './matchSpan'; import type { SpanAndAnnotation } from './spanAnnotationTypes'; import type { ComponentRenderSpan, Span } from './spanTypes'; import type { TraceRecording, TraceRecordingBase } from './traceRecordingTypes'; import type { TraceContext } from './types'; export interface EmbeddedEntry { count: number; totalDuration: number; spans: { startOffset: number; duration: number; error?: true | undefined; }[]; } export interface SpanSummaryAttributes { [typeAndName: string]: { [attributeName: string]: unknown; }; } export interface RumTraceRecording<RelationSchemaT> extends TraceRecordingBase<RelationSchemaT> { embeddedSpans: { [typeAndName: string]: EmbeddedEntry; }; nonEmbeddedSpans: string[]; /** * Merged attributes of the spans with the same type and name. * If attributes changed, most recent ones overwrite older ones. */ spanAttributes: SpanSummaryAttributes; [key: string]: unknown; } export declare function isRenderEntry<RelationSchemasT>(entry: Span<RelationSchemasT>): entry is ComponentRenderSpan<RelationSchemasT>; export declare const defaultEmbedSpanSelector: <RelationSchemasT>(spanAndAnnotation: SpanAndAnnotation<RelationSchemasT>) => boolean; export declare function getSpanSummaryAttributes<RelationSchemasT>(recordedItems: readonly SpanAndAnnotation<RelationSchemasT>[]): SpanSummaryAttributes; export declare function convertTraceToRUM<SelectedRelationNameT extends keyof RelationSchemasT, RelationSchemasT, const VariantsT extends string>(traceRecording: TraceRecording<SelectedRelationNameT, RelationSchemasT>, context: TraceContext<SelectedRelationNameT, RelationSchemasT, VariantsT>, embedSpanSelector?: SpanMatcherFn<SelectedRelationNameT, RelationSchemasT, VariantsT>): RumTraceRecording<RelationSchemasT[SelectedRelationNameT]>;