/** * Tracing Types * * Type definitions for OpenTelemetry distributed tracing. */ /** * Trace context that propagates through the execution pipeline */ export interface TraceContext { /** Unique trace ID (W3C trace context format: 32 hex chars) */ traceId: string; /** Current span ID (W3C span format: 16 hex chars) */ spanId: string; /** Parent span ID if this is a child span */ parentSpanId?: string; /** Trace flags (e.g., sampled) */ traceFlags?: number; /** Trace state for vendor-specific data */ traceState?: string; } /** * Span status codes following OpenTelemetry conventions */ export declare enum SpanStatusCode { ERROR = 2, OK = 1, UNSET = 0 } /** * Span kind following OpenTelemetry conventions */ export declare enum SpanKind { /** Internal operation within the application */ INTERNAL = 0, /** Server-side handling of a remote request */ SERVER = 1, /** Client-side of a remote request */ CLIENT = 2, /** Producer of a message (async) */ PRODUCER = 3, /** Consumer of a message (async) */ CONSUMER = 4 } /** * Span attributes following semantic conventions */ export interface SpanAttributes { [key: string]: boolean | boolean[] | number | number[] | string | string[] | undefined; } /** * Span event for recording discrete occurrences during a span */ export interface SpanEvent { /** Event name */ name: string; /** Event timestamp */ timestamp: number; /** Event attributes */ attributes?: SpanAttributes; } /** * Span link for associating spans across traces */ export interface SpanLink { /** Trace context of the linked span */ context: TraceContext; /** Link attributes */ attributes?: SpanAttributes; } /** * Span data structure */ export interface SpanData { /** Span name/operation name */ name: string; /** Trace context */ context: TraceContext; /** Span kind */ kind: SpanKind; /** Start time (Unix timestamp in milliseconds) */ startTime: number; /** End time (Unix timestamp in milliseconds) */ endTime?: number; /** Span status */ status: { code: SpanStatusCode; message?: string; }; /** Span attributes */ attributes: SpanAttributes; /** Span events */ events: SpanEvent[]; /** Span links */ links: SpanLink[]; /** Resource attributes (service name, version, etc.) */ resource: SpanAttributes; } /** * Options for creating a span */ export interface SpanOptions { /** Span kind */ kind?: SpanKind; /** Initial attributes */ attributes?: SpanAttributes; /** Links to other spans */ links?: SpanLink[]; /** Start time override */ startTime?: number; /** Parent trace context */ parent?: TraceContext; } /** * Tracer configuration */ export interface TracerConfig { /** Service name for resource identification */ serviceName: string; /** Service version */ serviceVersion: string; /** Environment (development, production, etc.) */ environment: string; /** Whether tracing is enabled */ enabled: boolean; /** Sampling rate (0.0 to 1.0) */ samplingRate: number; /** Export endpoint URL (OTLP HTTP) */ exporterUrl?: string; /** Export to console (for development) */ consoleExport: boolean; /** Batch export interval in milliseconds */ batchExportInterval: number; /** Maximum batch size */ maxBatchSize: number; /** Maximum queue size */ maxQueueSize: number; } /** * Semantic attribute keys following OpenTelemetry conventions */ export declare const SemanticAttributes: { readonly SERVICE_NAME: "service.name"; readonly SERVICE_NAMESPACE: "service.namespace"; readonly SERVICE_VERSION: "service.version"; readonly LLM_COMPLETION_TOKENS: "llm.completion_tokens"; readonly LLM_FINISH_REASON: "llm.finish_reason"; readonly LLM_MODEL: "llm.model"; readonly LLM_PROMPT_TOKENS: "llm.prompt_tokens"; readonly LLM_PROVIDER: "llm.provider"; readonly LLM_TEMPERATURE: "llm.temperature"; readonly LLM_TOTAL_TOKENS: "llm.total_tokens"; readonly TOOL_ARGUMENTS: "tool.arguments"; readonly TOOL_CACHE_HIT: "tool.cache_hit"; readonly TOOL_IDEMPOTENCY_KEY: "tool.idempotency_key"; readonly TOOL_NAME: "tool.name"; readonly TOOL_RESULT_SIZE: "tool.result_size"; readonly TOOL_SUCCESS: "tool.success"; readonly AGENT_ROLE: "agent.role"; readonly COMMAND_NAME: "command.name"; readonly PIPELINE_NAME: "pipeline.name"; readonly STAGE_INDEX: "stage.index"; readonly STAGE_NAME: "stage.name"; readonly REQUEST_ID: "request.id"; readonly SESSION_ID: "session.id"; readonly SESSION_RESUMED: "session.resumed"; readonly MCP_TOOL_NAME: "mcp.tool_name"; readonly MCP_TRANSPORT: "mcp.transport"; readonly ERROR_MESSAGE: "error.message"; readonly ERROR_STACK: "error.stack"; readonly ERROR_TYPE: "error.type"; readonly HTTP_METHOD: "http.method"; readonly HTTP_STATUS_CODE: "http.status_code"; readonly HTTP_URL: "http.url"; }; export type SemanticAttributeKey = (typeof SemanticAttributes)[keyof typeof SemanticAttributes]; //# sourceMappingURL=tracing.types.d.ts.map