UNPKG

@zendesk/retrace

Version:

define and capture Product Operation Traces along with computed metrics with an optional friendly React beacon API

43 lines (42 loc) 1.77 kB
import type { IGardenTheme } from '@zendeskgarden/react-theming'; import type { SpanAnnotation } from '../v3/spanAnnotationTypes'; import type { Attributes } from '../v3/spanTypes'; import type { RecordedSpan, TraceRecording } from '../v3/traceRecordingTypes'; import type { Timestamp } from '../v3/types'; import type { SupportedSpanTypes } from './constants'; import type { MappedOperation } from './mapOperationForVisualization'; type DistributiveOmit<T, K extends keyof any> = T extends T ? Omit<T, K> : never; export type MinimalSpanAnnotation = Omit<SpanAnnotation, 'id' | 'occurrence' | 'recordedInState' | 'labels'> & Partial<SpanAnnotation>; export type MinimalSpan = DistributiveOmit<RecordedSpan<any>, 'startTime' | 'attributes' | 'getParentSpan'> & { startTime: Pick<Timestamp, 'now'> & Partial<Timestamp>; attributes?: Attributes; }; export interface MappedSpanAndAnnotation { span: MinimalSpan; annotation: MinimalSpanAnnotation; groupName: string; type: SupportedSpanTypes; } export type RecordingInputFile = TraceRecording<any, any>; export interface HierarchicalSpanAndAnnotation extends MappedSpanAndAnnotation { children: HierarchicalSpanAndAnnotation[]; isExpanded: boolean; depth: number; parentId?: string; } export interface HierarchicalOperation extends Omit<MappedOperation, 'spansWithDuration'> { spans: HierarchicalSpanAndAnnotation[]; expandedSpanIds: Set<string>; } export interface ExpansionState { expandedSpans: Set<string>; toggleSpanExpansion: (spanId: string) => void; isSpanExpanded: (spanId: string) => boolean; collapseAll: () => void; expandAll: () => void; } declare module 'styled-components' { interface DefaultTheme extends IGardenTheme { } } export {};