import { ObservabilityStorage } from '@mastra/core/storage'; import type { TracingStorageStrategy, ListTracesArgs, ListTracesResponse, UpdateSpanArgs, BatchDeleteTracesArgs, BatchUpdateSpansArgs, BatchCreateSpansArgs, CreateSpanArgs, GetSpanArgs, GetSpanResponse, GetRootSpanArgs, GetRootSpanResponse, GetTraceArgs, GetTraceResponse, GetTraceLightResponse, CreateIndexOptions, PruneOptions, PruneResult, RetentionTablesDescriptor, TableRetentionPolicy } from '@mastra/core/storage'; import type { PgDomainConfig } from '../../db/index.js'; export declare class ObservabilityPG extends ObservabilityStorage { #private; /** * Retention-eligible tables. The observability domain has a single physical * table (`mastra_ai_spans`); spans anchor on the timezone-aware `startedAtZ` * mirror column and are indexed for fast batched deletes. */ static readonly retentionTables: RetentionTablesDescriptor; /** Tables managed by this domain */ static readonly MANAGED_TABLES: readonly ["mastra_ai_spans"]; constructor(config: PgDomainConfig); init(): Promise; /** * Lazily ensures a btree index exists on each configured policy's retention * anchor column so age-based `prune()` deletes stay fast on large span tables. * Called from the prune path (not init) so only deployments that configure * retention pay the index's write/disk overhead. Best-effort: failures are * logged and pruning proceeds (correct, just slower). * Created even with `skipDefaultIndexes` — retention is an explicit opt-in, * so its supporting index is not part of the default index set. */ private ensureRetentionIndexes; /** * Returns default index definitions for the observability domain tables. * @param schemaPrefix - Prefix for index names (e.g. "my_schema_" or "") */ static getDefaultIndexDefs(schemaPrefix: string): CreateIndexOptions[]; /** * Returns all DDL statements for this domain: table, constraints, timestamp trigger, and indexes. * Used by exportSchemas to produce a complete, reproducible schema export. */ static getExportDDL(schemaName?: string): string[]; /** * Returns default index definitions for this instance's schema. */ getDefaultIndexDefinitions(): CreateIndexOptions[]; /** * Creates default indexes for optimal query performance. */ createDefaultIndexes(): Promise; /** * Creates custom user-defined indexes for this domain's tables. */ createCustomIndexes(): Promise; /** * Manually run the spans migration to deduplicate and add the unique constraint. * This is intended to be called from the CLI when duplicates are detected. * * @returns Migration result with status and details */ migrateSpans(): Promise<{ success: boolean; alreadyMigrated: boolean; duplicatesRemoved: number; message: string; }>; /** * Check migration status for the spans table. * Returns information about whether migration is needed. */ checkSpansMigrationStatus(): Promise<{ needsMigration: boolean; hasDuplicates: boolean; duplicateCount: number; constraintExists: boolean; tableName: string; }>; dangerouslyClearAll(): Promise; /** * Deletes spans older than the configured `maxAge`, in bounded, batched, * cancellable chunks. Unset = keep forever. */ prune(policies: Record, options?: PruneOptions): Promise; get tracingStrategy(): { preferred: TracingStorageStrategy; supported: TracingStorageStrategy[]; }; createSpan(args: CreateSpanArgs): Promise; getSpan(args: GetSpanArgs): Promise; getRootSpan(args: GetRootSpanArgs): Promise; getTrace(args: GetTraceArgs): Promise; getTraceLight(args: GetTraceArgs): Promise; updateSpan(args: UpdateSpanArgs): Promise; listTraces(args: ListTracesArgs): Promise; batchCreateSpans(args: BatchCreateSpansArgs): Promise; batchUpdateSpans(args: BatchUpdateSpansArgs): Promise; batchDeleteTraces(args: BatchDeleteTracesArgs): Promise; } //# sourceMappingURL=index.d.ts.map