/**
 * Configuration types for Mastra Observability
 *
 * These types define the configuration structure for observability,
 * including tracing configs, sampling strategies, and registry setup.
 */
import type { RequestContext } from '@mastra/core/di';
import type { ObservabilityInstance, ObservabilityExporter, ObservabilityBridge, SpanOutputProcessor, ConfigSelector, SerializationOptions, CardinalityConfig, LogLevel, AnyExportedSpan } from '@mastra/core/observability';
import { SpanType } from '@mastra/core/observability';
import { z } from 'zod/v4';
import type { SensitiveDataFilterOptions } from './span_processors/index.js';
/**
 * Sampling strategy types
 */
export declare enum SamplingStrategyType {
    ALWAYS = "always",
    NEVER = "never",
    RATIO = "ratio",
    CUSTOM = "custom"
}
/**
 * Options passed when using a custom sampler strategy
 */
export interface CustomSamplerOptions {
    requestContext?: RequestContext;
    metadata?: Record<string, any>;
}
/**
 * Sampling strategy configuration
 */
export type SamplingStrategy = {
    type: SamplingStrategyType.ALWAYS;
} | {
    type: SamplingStrategyType.NEVER;
} | {
    type: SamplingStrategyType.RATIO;
    probability: number;
} | {
    type: SamplingStrategyType.CUSTOM;
    sampler: (options?: CustomSamplerOptions) => boolean;
};
/**
 * Configuration for a single observability instance
 */
export interface ObservabilityInstanceConfig {
    /** Unique identifier for this config in the tracing registry */
    name: string;
    /** Service name for tracing */
    serviceName: string;
    /** Sampling strategy - controls whether tracing is collected (defaults to ALWAYS) */
    sampling?: SamplingStrategy;
    /** Custom exporters */
    exporters?: ObservabilityExporter[];
    /** Observability bridge (e.g., OpenTelemetry bridge for context extraction) */
    bridge?: ObservabilityBridge;
    /** Custom span output processors */
    spanOutputProcessors?: SpanOutputProcessor[];
    /** Set to `true` if you want to see spans internal to the operation of mastra */
    includeInternalSpans?: boolean;
    /**
     * Span types to exclude from export. Spans of these types are silently dropped
     * before reaching exporters. This is useful for reducing noise and costs in
     * observability platforms that charge per-span (e.g., Langfuse).
     *
     * @example
     * ```typescript
     * excludeSpanTypes: [SpanType.MODEL_CHUNK, SpanType.MODEL_STEP]
     * ```
     */
    excludeSpanTypes?: SpanType[];
    /**
     * Filter function to control which spans are exported. Return `true` to keep
     * the span, `false` to drop it. This runs after `excludeSpanTypes` and
     * `spanOutputProcessors`, giving you access to the final exported span data
     * for fine-grained filtering by type, attributes, entity, metadata, or any
     * combination.
     *
     * @example
     * ```typescript
     * spanFilter: (span) => {
     *   // Drop all model chunks
     *   if (span.type === SpanType.MODEL_CHUNK) return false;
     *   // Only keep tool calls that failed
     *   if (span.type === SpanType.TOOL_CALL && span.attributes?.success) return false;
     *   return true;
     * }
     * ```
     */
    spanFilter?: (span: AnyExportedSpan) => boolean;
    /**
     * RequestContext keys to automatically extract as metadata for all spans
     * created with this tracing configuration.
     * Supports dot notation for nested values.
     */
    requestContextKeys?: string[];
    /**
     * Options for controlling serialization of span data (input/output/attributes).
     * Use these to customize truncation limits for large payloads.
     */
    serializationOptions?: SerializationOptions;
    /**
     * Cardinality protection settings for metrics.
     * Controls which labels are blocked and whether UUID-like values are filtered.
     * Applied to all metrics (auto-extracted and user-defined).
     */
    cardinality?: CardinalityConfig;
    /**
     * Configuration for the observability logger (loggerVNext).
     * Controls log level filtering and whether dual-write logging is enabled.
     */
    logging?: {
        /** Set to `false` to disable dual-write logging to observability storage. Defaults to `true`. */
        enabled?: boolean;
        /** Minimum log level to write to observability storage. Defaults to `'warn'`. */
        level?: LogLevel;
    };
}
/**
 * Complete Observability registry configuration
 */
export interface ObservabilityRegistryConfig {
    /**
     * Enables default exporters, with sampling: always, and sensitive data filtering
     * @deprecated Use explicit `configs` with MastraStorageExporter, MastraPlatformExporter, and SensitiveDataFilter instead.
     * This option will be removed in a future version.
     */
    default?: {
        enabled?: boolean;
    };
    /** Map of tracing instance names to their configurations or pre-instantiated instances */
    configs?: Record<string, Omit<ObservabilityInstanceConfig, 'name'> | ObservabilityInstance>;
    /** Optional selector function to choose which tracing instance to use */
    configSelector?: ConfigSelector;
    /**
     * Controls whether a `SensitiveDataFilter` span output processor is automatically
     * applied to every configured observability instance. This protects against
     * accidentally exporting secrets (API keys, tokens, passwords, etc.) to
     * exporters such as the Mastra cloud exporter.
     *
     * - `true` (default): apply `SensitiveDataFilter` with default options.
     * - `false`: do not auto-apply the filter. You can still add it manually via
     *   `spanOutputProcessors` on a specific config.
     * - an object: apply `SensitiveDataFilter` with the provided options.
     *
     * If a config already includes a `SensitiveDataFilter` in
     * `spanOutputProcessors`, the auto-applied filter is skipped to avoid
     * double redaction. The auto-applied filter runs last (after any
     * user-provided processors) so that sensitive data introduced or
     * surfaced by upstream processors is still redacted before export.
     * Pre-instantiated `ObservabilityInstance` values are not modified.
     */
    sensitiveDataFilter?: boolean | SensitiveDataFilterOptions;
}
/**
 * Zod schema for SamplingStrategy
 */
export declare const samplingStrategySchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
    type: z.ZodLiteral<SamplingStrategyType.ALWAYS>;
}, z.core.$strip>, z.ZodObject<{
    type: z.ZodLiteral<SamplingStrategyType.NEVER>;
}, z.core.$strip>, z.ZodObject<{
    type: z.ZodLiteral<SamplingStrategyType.RATIO>;
    probability: z.ZodNumber;
}, z.core.$strip>, z.ZodObject<{
    type: z.ZodLiteral<SamplingStrategyType.CUSTOM>;
    sampler: z.ZodCustom<(...args: any[]) => unknown, (...args: any[]) => unknown>;
}, z.core.$strip>], "type">;
/**
 * Zod schema for SerializationOptions
 */
export declare const serializationOptionsSchema: z.ZodOptional<z.ZodObject<{
    maxStringLength: z.ZodOptional<z.ZodNumber>;
    maxDepth: z.ZodOptional<z.ZodNumber>;
    maxArrayLength: z.ZodOptional<z.ZodNumber>;
    maxObjectKeys: z.ZodOptional<z.ZodNumber>;
}, z.core.$strip>>;
/**
 * Zod schema for ObservabilityInstanceConfig
 * Note: exporters, spanOutputProcessors, bridge, and configSelector are validated as any
 * since they're complex runtime objects
 */
export declare const observabilityInstanceConfigSchema: z.ZodObject<{
    serviceName: z.ZodString;
    sampling: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
        type: z.ZodLiteral<SamplingStrategyType.ALWAYS>;
    }, z.core.$strip>, z.ZodObject<{
        type: z.ZodLiteral<SamplingStrategyType.NEVER>;
    }, z.core.$strip>, z.ZodObject<{
        type: z.ZodLiteral<SamplingStrategyType.RATIO>;
        probability: z.ZodNumber;
    }, z.core.$strip>, z.ZodObject<{
        type: z.ZodLiteral<SamplingStrategyType.CUSTOM>;
        sampler: z.ZodCustom<(...args: any[]) => unknown, (...args: any[]) => unknown>;
    }, z.core.$strip>], "type">>;
    exporters: z.ZodOptional<z.ZodArray<z.ZodAny>>;
    bridge: z.ZodOptional<z.ZodAny>;
    spanOutputProcessors: z.ZodOptional<z.ZodArray<z.ZodAny>>;
    includeInternalSpans: z.ZodOptional<z.ZodBoolean>;
    excludeSpanTypes: z.ZodOptional<z.ZodArray<z.ZodEnum<typeof SpanType>>>;
    spanFilter: z.ZodOptional<z.ZodCustom<(...args: any[]) => unknown, (...args: any[]) => unknown>>;
    requestContextKeys: z.ZodOptional<z.ZodArray<z.ZodString>>;
    serializationOptions: z.ZodOptional<z.ZodObject<{
        maxStringLength: z.ZodOptional<z.ZodNumber>;
        maxDepth: z.ZodOptional<z.ZodNumber>;
        maxArrayLength: z.ZodOptional<z.ZodNumber>;
        maxObjectKeys: z.ZodOptional<z.ZodNumber>;
    }, z.core.$strip>>;
    cardinality: z.ZodOptional<z.ZodObject<{
        blockedLabels: z.ZodOptional<z.ZodArray<z.ZodString>>;
        blockUUIDs: z.ZodOptional<z.ZodBoolean>;
    }, z.core.$strip>>;
    logging: z.ZodOptional<z.ZodObject<{
        enabled: z.ZodOptional<z.ZodBoolean>;
        level: z.ZodOptional<z.ZodEnum<{
            error: "error";
            debug: "debug";
            info: "info";
            warn: "warn";
            fatal: "fatal";
        }>>;
    }, z.core.$strip>>;
    name: z.ZodString;
}, z.core.$strip>;
/**
 * Zod schema for config values in the configs map
 * This is the config object without the name field
 */
export declare const observabilityConfigValueSchema: z.ZodObject<{
    serviceName: z.ZodString;
    sampling: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
        type: z.ZodLiteral<SamplingStrategyType.ALWAYS>;
    }, z.core.$strip>, z.ZodObject<{
        type: z.ZodLiteral<SamplingStrategyType.NEVER>;
    }, z.core.$strip>, z.ZodObject<{
        type: z.ZodLiteral<SamplingStrategyType.RATIO>;
        probability: z.ZodNumber;
    }, z.core.$strip>, z.ZodObject<{
        type: z.ZodLiteral<SamplingStrategyType.CUSTOM>;
        sampler: z.ZodCustom<(...args: any[]) => unknown, (...args: any[]) => unknown>;
    }, z.core.$strip>], "type">>;
    exporters: z.ZodOptional<z.ZodArray<z.ZodAny>>;
    bridge: z.ZodOptional<z.ZodAny>;
    spanOutputProcessors: z.ZodOptional<z.ZodArray<z.ZodAny>>;
    includeInternalSpans: z.ZodOptional<z.ZodBoolean>;
    excludeSpanTypes: z.ZodOptional<z.ZodArray<z.ZodEnum<typeof SpanType>>>;
    spanFilter: z.ZodOptional<z.ZodCustom<(...args: any[]) => unknown, (...args: any[]) => unknown>>;
    requestContextKeys: z.ZodOptional<z.ZodArray<z.ZodString>>;
    serializationOptions: z.ZodOptional<z.ZodObject<{
        maxStringLength: z.ZodOptional<z.ZodNumber>;
        maxDepth: z.ZodOptional<z.ZodNumber>;
        maxArrayLength: z.ZodOptional<z.ZodNumber>;
        maxObjectKeys: z.ZodOptional<z.ZodNumber>;
    }, z.core.$strip>>;
    cardinality: z.ZodOptional<z.ZodObject<{
        blockedLabels: z.ZodOptional<z.ZodArray<z.ZodString>>;
        blockUUIDs: z.ZodOptional<z.ZodBoolean>;
    }, z.core.$strip>>;
    logging: z.ZodOptional<z.ZodObject<{
        enabled: z.ZodOptional<z.ZodBoolean>;
        level: z.ZodOptional<z.ZodEnum<{
            error: "error";
            debug: "debug";
            info: "info";
            warn: "warn";
            fatal: "fatal";
        }>>;
    }, z.core.$strip>>;
}, z.core.$strip>;
export declare const observabilityRegistryConfigSchema: z.ZodObject<{
    default: z.ZodNullable<z.ZodOptional<z.ZodObject<{
        enabled: z.ZodOptional<z.ZodBoolean>;
    }, z.core.$strip>>>;
    configs: z.ZodOptional<z.ZodUnion<readonly [z.ZodRecord<z.ZodString, z.ZodAny>, z.ZodArray<z.ZodAny>, z.ZodNull]>>;
    configSelector: z.ZodOptional<z.ZodCustom<(...args: any[]) => unknown, (...args: any[]) => unknown>>;
    sensitiveDataFilter: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodObject<{
        sensitiveFields: z.ZodOptional<z.ZodArray<z.ZodString>>;
        redactionToken: z.ZodOptional<z.ZodString>;
        redactionStyle: z.ZodOptional<z.ZodEnum<{
            full: "full";
            partial: "partial";
        }>>;
    }, z.core.$strict>]>>;
}, z.core.$loose>;
//# sourceMappingURL=config.d.ts.map