@zendesk/retrace
Version:
define and capture Product Operation Traces along with computed metrics with an optional friendly React beacon API
22 lines (21 loc) • 942 B
TypeScript
import type { HierarchicalSpanAndAnnotation, MappedSpanAndAnnotation } from '../types';
/**
* Builds a hierarchical tree structure from flat spans using parentSpanId relationships
*/
export declare function buildSpanHierarchy(spans: MappedSpanAndAnnotation[]): HierarchicalSpanAndAnnotation[];
/**
* Flattens a hierarchical span tree into a flat array, respecting expansion states
*/
export declare function flattenHierarchicalSpans(hierarchicalSpans: HierarchicalSpanAndAnnotation[], expandedSpanIds: Set<string>): HierarchicalSpanAndAnnotation[];
/**
* Validates span hierarchy for circular references and other issues
*/
export declare function validateSpanHierarchy(spans: MappedSpanAndAnnotation[]): {
isValid: boolean;
errors: string[];
missingParentIds: string[];
};
/**
* Gets all descendant span IDs for a given span
*/
export declare function getDescendantSpanIds(span: HierarchicalSpanAndAnnotation): string[];