UNPKG

autotel

Version:
109 lines (108 loc) 2.76 kB
import { ConsoleSpanExporter, InMemorySpanExporter, ReadableSpan, SpanExporter } from "@opentelemetry/sdk-trace-base"; //#region src/pretty-console-exporter.d.ts /** * Export result type for SpanExporter callback */ interface ExportResult { code: number; error?: Error; } /** * ANSI escape codes for terminal colors (zero dependencies) */ /** * Configuration options for PrettyConsoleExporter */ interface PrettyConsoleExporterOptions { /** * Enable ANSI colors in output * @default auto-detect TTY */ colors?: boolean; /** * Show span attributes in output * @default true */ showAttributes?: boolean; /** * Maximum length for attribute values before truncation * @default 50 */ maxValueLength?: number; /** * Show instrumentation scope name (e.g., [http], [pg]) * @default true */ showScope?: boolean; /** * Attribute keys to always hide from output * @default [] */ hideAttributes?: string[]; /** * Show trace ID for each root span * @default false */ showTraceId?: boolean; } /** * Pretty Console Exporter - colorized, hierarchical span output for development * * Features: * - Colorized status indicators (✓ green, ✗ red) * - Duration with color coding (fast=green, medium=yellow, slow=red) * - Hierarchical tree view showing parent-child relationships * - Attribute display with truncation * - Error message highlighting */ declare class PrettyConsoleExporter implements SpanExporter { private readonly options; constructor(options?: PrettyConsoleExporterOptions); /** * Export spans with pretty formatting */ export(spans: ReadableSpan[], resultCallback: (result: ExportResult) => void): void; /** * Group spans by their trace ID */ private groupByTrace; /** * Print a single trace with all its spans as a tree */ private printTrace; /** * Build a tree structure from flat spans using parent-child relationships */ private buildSpanTree; /** * Print a span node with indentation and tree characters */ private printNode; /** * Get short scope name from instrumentation scope */ private getScopeName; /** * Format span attributes as a comma-separated string */ private formatAttributes; /** * Truncate string to max length with ellipsis */ private truncate; /** * Apply ANSI color if colors are enabled */ private color; /** * Shutdown (no-op for console exporter) */ shutdown(): Promise<void>; /** * Force flush (no-op for console exporter) */ forceFlush(): Promise<void>; } //#endregion export { ConsoleSpanExporter, InMemorySpanExporter, PrettyConsoleExporter, type PrettyConsoleExporterOptions }; //# sourceMappingURL=exporters.d.ts.map