/**
 * Shared helpers for RAG/vector DB parsers.
 * Normalize attributes (OTel DB semantic conventions + vendor-specific) into standard RAGCall fields.
 * Uses Decimal.js for numeric calculations; all numeric fields guard against null/undefined/NaN.
 */
import type { Span } from '../types';
import type { RAGCall, RAGCallStatus, TraceRagDetailsCard } from './types';
/** Get first defined value from span attributes (and optional resourceAttributes) for given keys */
export declare function getAttr(span: Span, ...keys: string[]): string | number | undefined;
/**
 * Parse number from attribute; returns undefined for null/undefined/NaN/non-finite.
 * Use for optional numeric fields (topK, returnedRows).
 */
export declare function parseNum(value: unknown): number | undefined;
/**
 * Duration in milliseconds: prefer db.client.operation.duration, else span.duration.
 * Uses Decimal.js for calculation; returns 0 for null/undefined/NaN.
 * OTel db.client.operation.duration is seconds → multiply by 1000.
 * Span duration in this codebase is nanoseconds → divide by 1e6.
 */
export declare function getDurationMs(span: Span): number;
/** Duration in seconds (legacy helper). Prefer {@link getDurationMs} for aggregation (observeDashboard expects ms). */
export declare function getDurationSeconds(span: Span): number;
/** db.system.name or db.system */
export declare function getSystemName(span: Span, fallback: string): string;
/** db.operation.name or span name */
export declare function getOperationName(span: Span): string;
/** db.collection.name */
export declare function getCollectionName(span: Span): string | undefined;
/**
 * returned_rows: db.response.returned_rows, or estimate from db.query.summary / result-related
 * attributes when they encode actual result count (not request params like top_k).
 * Returns undefined for null/undefined/NaN; only returns finite integers.
 */
export declare function getReturnedRows(span: Span): number | undefined;
/** Infer status from span status, error events, or attributes */
export declare function getStatus(span: Span): RAGCallStatus;
/** top_k: common attribute names for vector DBs (incl. db.vector.query.top_k for Pinecone/Qdrant). Returns undefined for null/undefined/NaN. */
export declare function getTopK(span: Span): number | undefined;
/** Build a standard RAGCall from a span and optional overrides. All numeric fields are safe (no NaN/null/undefined). */
export declare function buildRAGCall(span: Span, options?: {
    systemName?: string;
    operationName?: string;
}): RAGCall;
/**
 * Build one display card from a RAGCall and its source span (for serviceName and span duration).
 * All formatting done here; frontend renders as-is.
 */
export declare function ragCallToDetailsCard(call: RAGCall, span?: Span): TraceRagDetailsCard;
/**
 * Convert RAGCall[] to TraceRagDetailsCard[] using spans to fill serviceName and span duration.
 */
export declare function buildTraceRagDetailsCards(ragCalls: RAGCall[], spans: Span[]): TraceRagDetailsCard[];
//# sourceMappingURL=utils.d.ts.map