UNPKG

@zendesk/retrace

Version:

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

38 lines (37 loc) 2.83 kB
import type { SpanMatch, SpanMatcherFn } from './matchSpan'; import type { SpanAndAnnotation } from './spanAnnotationTypes'; import type { FinalTransition, OnEnterStatePayload } from './Trace'; import type { TraceRecording } from './traceRecordingTypes'; import type { DraftTraceContext, RelationSchemasBase, TraceContext } from './types'; export declare function isSuppressedError<RelationSchemasT extends RelationSchemasBase<RelationSchemasT>>(trace: DraftTraceContext<keyof RelationSchemasT, RelationSchemasT, string>, spanAndAnnotation: SpanAndAnnotation<RelationSchemasT>): boolean; export declare function formatMs(ms?: number): string; export declare function getConfigSummary<SelectedRelationNameT extends keyof RelationSchemasT, RelationSchemasT extends RelationSchemasBase<RelationSchemasT>, VariantsT extends string>(traceContext: Pick<DraftTraceContext<SelectedRelationNameT, RelationSchemasT, VariantsT>, 'definition' | 'input'>): { timeout: number; debounce: number | undefined; interactive: number | undefined; }; export declare function getComputedResults<RelationSchemasT extends RelationSchemasBase<RelationSchemasT>>(traceContext: TraceContext<any, RelationSchemasT, any>, finalTransition: FinalTransition<RelationSchemasT>): TraceRecording<any, RelationSchemasT> | undefined; /** * Extract timing offsets from a transition object */ export declare const extractTimingOffsets: <RelationSchemasT extends RelationSchemasBase<RelationSchemasT>>(transition: OnEnterStatePayload<RelationSchemasT>) => { lastRequiredSpanOffset: number | undefined; completeSpanOffset: number | undefined; cpuIdleSpanOffset: number | undefined; }; /** * Attempt to create a more descriptive name from the definition * This part needs customization based on how 'fromDefinition' is structured. * Example: Check for specific properties like 'name', 'type', 'label' etc. */ export declare function getMatcherLabelFromCombinator<RelationSchemasT extends RelationSchemasBase<RelationSchemasT>, SelectedRelationNameT extends keyof RelationSchemasT, VariantsT extends string>(def: SpanMatch<SelectedRelationNameT, RelationSchemasT, VariantsT>, index?: number): string; /** * Formats a SpanMatcherFn into a more readable string representation. * This is a basic implementation and can be significantly improved * based on the actual structure of `matcher.fromDefinition`. * * @param matcher The matcher function to format. * @param index Optional index for generic naming. * @returns A string representation of the matcher. */ export declare function formatMatcher<SelectedRelationNameT extends keyof RelationSchemasT, RelationSchemasT extends RelationSchemasBase<RelationSchemasT>, VariantsT extends string>(matcher: SpanMatcherFn<SelectedRelationNameT, RelationSchemasT, VariantsT>, index?: number): string;