import type { TracingEvent, InitExporterOptions, MetricEvent, LogEvent, ScoreEvent, FeedbackEvent } from '@mastra/core/observability';
import type { TracingStorageStrategy } from '@mastra/core/storage';
import type { BaseExporterConfig } from './base.js';
import { BaseExporter } from './base.js';
/** Configuration for the MastraStorageExporter's batching, retry, and strategy behavior. */
export interface MastraStorageExporterConfig extends BaseExporterConfig {
    maxBatchSize?: number;
    maxBufferSize?: number;
    maxBatchWaitMs?: number;
    maxRetries?: number;
    retryDelayMs?: number;
    strategy?: TracingStorageStrategy | 'auto';
}
/**
 * Storage-backed exporter. Buffers observability events and flushes them in
 * batches to the configured ObservabilityStorage backend with retry support.
 */
export declare class MastraStorageExporter extends BaseExporter {
    #private;
    name: string;
    constructor(config?: MastraStorageExporterConfig);
    /**
     * Initialize the exporter (called after all dependencies are ready)
     */
    init(options: InitExporterOptions): Promise<void>;
    /**
     * Checks if buffer should be flushed based on size or time triggers
     */
    private shouldFlush;
    /**
     * Schedules a flush using setTimeout
     */
    private scheduleFlush;
    /**
     * Checks flush triggers and schedules/triggers flush as needed.
     * Called after adding any event to the buffer.
     * Returns the flush promise when flushing so callers can await it.
     */
    private handleBatchedFlush;
    private sanitizeDropError;
    private emitDrop;
    /**
     * Flush a batch of create events for a single signal type.
     * On "not implemented" errors, disables the signal for future flushes.
     * On other errors, re-adds events to the buffer for retry.
     */
    private flushCreates;
    /**
     * Flush span update/end events, deferring any whose span hasn't been created yet.
     * When `isEnd` is true, successfully flushed spans are removed from tracking.
     */
    private flushSpanUpdates;
    /**
     * Flushes the current buffer to storage.
     *
     * Creates are flushed first, then their span keys are added to allCreatedSpans.
     * Updates are checked against allCreatedSpans — those whose span hasn't been
     * created yet are re-inserted into the live buffer for the next flush.
     * Completed spans (SPAN_ENDED) are cleaned up from allCreatedSpans after success.
     */
    private flushBuffer;
    _exportTracingEvent(event: TracingEvent): Promise<void>;
    /**
     * Resolves when an ongoing init call is finished
     * Doesn't wait for the caller to call init
     * @returns
     */
    private waitForInit;
    /**
     * Handle metric events — buffer for batch flush.
     */
    onMetricEvent(event: MetricEvent): Promise<void>;
    /**
     * Handle log events — buffer for batch flush.
     */
    onLogEvent(event: LogEvent): Promise<void>;
    /**
     * Handle score events — buffer for batch flush.
     */
    onScoreEvent(event: ScoreEvent): Promise<void>;
    /**
     * Handle feedback events — buffer for batch flush.
     */
    onFeedbackEvent(event: FeedbackEvent): Promise<void>;
    /**
     * Force flush any buffered spans without shutting down the exporter.
     * This is useful in serverless environments where you need to ensure spans
     * are exported before the runtime instance is terminated.
     */
    flush(): Promise<void>;
    shutdown(): Promise<void>;
}
//# sourceMappingURL=mastra-storage.d.ts.map