UNPKG

@iota-big3/sdk-security

Version:

Advanced security features including zero trust, quantum-safe crypto, and ML threat detection

93 lines 3.02 kB
/** * @iota-big3/sdk-security - Distributed Tracing * OpenTelemetry-based request tracking across security services */ import { EventEmitter } from 'events'; interface Span { spanId: string; traceId: string; parentSpanId?: string; operationName: string; startTime: number; endTime?: number; duration?: number; status: 'OK' | 'ERROR' | 'CANCELLED'; attributes: Record<string, any>; events: SpanEvent[]; links: SpanLink[]; } interface SpanEvent { name: string; timestamp: number; attributes?: Record<string, any>; } interface SpanLink { traceId: string; spanId: string; attributes?: Record<string, any>; } interface TraceContext { traceId: string; spanId: string; traceFlags: number; traceState?: string; } export interface TracingConfig { enabled: boolean; serviceName: string; endpoint?: string; samplingRate: number; propagators?: string[]; exportInterval?: number; maxQueueSize?: number; } export interface TracedOperation { name: string; service: string; traceId: string; spanId: string; parentSpanId?: string; startTime: number; attributes: Record<string, any>; } export declare class DistributedTracer extends EventEmitter { private config; private spans; private traces; private exportQueue; private exportInterval?; private isActive; constructor(config: TracingConfig); initialize(): Promise<void>; shutdown(): Promise<void>; startSpan(operationName: string, parentContext?: TraceContext, attributes?: Record<string, any>): Span; endSpan(spanId: string, status?: 'OK' | 'ERROR' | 'CANCELLED'): void; addEvent(spanId: string, name: string, attributes?: Record<string, any>): void; setAttributes(spanId: string, attributes: Record<string, any>): void; recordException(spanId: string, error: Error): void; addLink(spanId: string, linkedTraceId: string, linkedSpanId: string, attributes?: Record<string, any>): void; inject(span: Span): Record<string, string>; extract(headers: Record<string, string>): TraceContext | null; getCurrentTrace(traceId: string): Span[]; getSpan(spanId: string): Span | undefined; traceAuthentication(userId: string, method: string, success: boolean): Span; traceAuthorization(userId: string, resource: string, action: string, allowed: boolean): Span; traceComplianceCheck(framework: string, passed: boolean, score: number): Span; traceThreatDetection(threatType: string, severity: string, mitigated: boolean): Span; private exportSpans; private formatForJaeger; private formatForZipkin; private formatForOTLP; private generateId; private hexToBase64; private toAttributeValue; getTracingMetrics(): { activeSpans: number; completedSpans: number; errorRate: number; averageDuration: number; tracesInMemory: number; }; } export {}; //# sourceMappingURL=distributed-tracing.d.ts.map