import { type IngestionEventType, QueueJobs } from "../"; export interface OtelIngestionProcessorConfig { projectId: string; publicKey?: string; } interface ResourceSpan { resource?: { attributes?: Array<{ key: string; value: any; }>; }; scopeSpans?: Array<{ scope?: { name: string; version?: string; attributes?: Array<{ key: string; value: any; }>; }; spans?: Array<{ traceId: { data?: Buffer; } | Buffer; spanId: { data?: Buffer; } | Buffer; parentSpanId?: { data?: Buffer; } | Buffer; name: string; kind: number; startTimeUnixNano: number | { low: number; high: number; }; endTimeUnixNano: number | { low: number; high: number; }; attributes?: Array<{ key: string; value: any; }>; events?: any[]; status?: { code?: number; message?: string; }; }>; }>; } /** * Processor class that encapsulates all logic for converting OpenTelemetry * resource spans into Langfuse ingestion events. * * Manages trace deduplication internally and provides a clean interface * for converting OTEL spans to Langfuse events. */ export declare class OtelIngestionProcessor { private seenTraces; private isInitialized; private traceEventCounts; private readonly projectId; private readonly publicKey?; constructor(config: OtelIngestionProcessorConfig); /** * Returns the current time as yyyy/mm/dd/hh/mm`. */ private getCurrentTimePath; /** * Uploads a batch of resourceSpans to blob storage and adds a job to process them * into the otel-ingestion-queue. */ publishToOtelIngestionQueue(resourceSpans: ResourceSpan[]): Promise>; /** * Process resource spans and convert them to Langfuse ingestion events. * Handles trace deduplication automatically using internal state. * Initializes seen traces from Redis automatically on first call. * Filters out shallow trace events if full trace events exist for the same traceId. */ processToIngestionEvents(resourceSpans: ResourceSpan[]): Promise; /** * Filter out shallow trace-create events if a full trace-create event exists for the same traceId. * Maintains optimal trace representation per traceId in the final event list. * * Performance: O(n) where n is the number of events */ private filterRedundantShallowTraces; /** * Determine if a trace event body represents a shallow trace. * Shallow traces only contain minimal fields: id, timestamp, environment. * Full traces have additional meaningful fields like: name, metadata, userId, etc. */ private isShallowTraceEvent; /** * Check if a value is meaningful (not null, undefined, empty string, or empty object/array) */ private hasMeaningfulValue; private processResourceSpan; private processSpan; private createTraceEvent; private isTracePublic; private createObservationEvent; private validatePublicKey; private hasTraceUpdates; private extractResourceAttributes; private extractScopeAttributes; private extractSpanAttributes; private convertValueToPlainJavascript; private convertKeyPathToNestedObject; private extractInputAndOutput; private extractEnvironment; private extractName; private extractMetadata; private extractUserId; private extractSessionId; private extractModelParameters; private sanitizeModelParams; private extractModelName; private extractUsageDetails; private extractCostDetails; private extractCompletionStartTime; private extractTags; private parseLangfusePromptFromAISDK; /** * Get a set of trace IDs that have been seen recently (from Redis cache). * Returns a Set of trace IDs that should not trigger new trace creation. */ private getSeenTracesSet; private parseId; /** * Convert OpenTelemetry nano timestamp to ISO string. * Handles various timestamp formats: string, number, or object with high/low bits. */ static convertNanoTimestampToISO(timestamp: number | string | { high: number; low: number; }): string; /** * Count the total number of spans across all resource spans. * Returns -1 if an error occurs during counting to avoid throwing exceptions. */ private getTotalSpanCount; } export {}; //# sourceMappingURL=OtelIngestionProcessor.d.ts.map