/** * Discovery operations for the v-next Postgres observability domain. * * Backed by a single cache table (`mastra_observability_discovery`) keyed by a * cacheKey string. Reads use stale-while-revalidate semantics: * * - if no cache row exists, compute synchronously and serve. * - if cache row exists and is fresher than `discoveryTtlSeconds`, serve as-is. * - if cache row is stale, kick off an async refresh and serve the cached * value. The refresh upserts on a single row keyed by cacheKey, so * concurrent readers race harmlessly with last-write-wins semantics. * * No in-memory caching: the table-backed cache works across multiple * frontends pointing at the same database and survives serverless restarts. */ import type { IMastraLogger } from '@mastra/core/logger'; import type { GetEntityNamesArgs, GetEntityNamesResponse, GetEntityTypesArgs, GetEntityTypesResponse, GetEnvironmentsArgs, GetEnvironmentsResponse, GetMetricLabelKeysArgs, GetMetricLabelKeysResponse, GetMetricLabelValuesArgs, GetMetricLabelValuesResponse, GetMetricNamesArgs, GetMetricNamesResponse, GetServiceNamesArgs, GetServiceNamesResponse, GetTagsArgs, GetTagsResponse } from '@mastra/core/storage'; import type { DbClient } from '../../../client.js'; export interface DiscoveryConfig { /** TTL for cached values in seconds. Default 300 (5 minutes). */ ttlSeconds?: number; /** * Only scan events newer than this many seconds when refreshing a discovery * value. Default 2592000 (30 days). * * The predicate targets each signal table's partition range key * (`SIGNAL_TIME_COLUMN`), so bounding the window lets Postgres prune * partitions on native/pg_partman layouts and exclude chunks on Timescale * instead of visiting all history on every refresh. * * Set to 0 to scan all history (the behavior before this option existed). * Note that a value last seen outside the window disappears from discovery * results until it is seen again. */ lookbackSeconds?: number; /** * Logger used to report background refresh failures. Injected by the * domain class (`ObservabilityStoragePostgresVNext`) so discovery * warnings land in the framework logger alongside the rest of the store. * Falls back to `console.warn` when absent so direct callers (tests, * scripts) still see refresh failures. * @internal */ logger?: IMastraLogger; } export declare function getEntityTypes(client: DbClient, schema: string, _args: GetEntityTypesArgs, config: DiscoveryConfig): Promise; export declare function getEntityNames(client: DbClient, schema: string, args: GetEntityNamesArgs, config: DiscoveryConfig): Promise; export declare function getServiceNames(client: DbClient, schema: string, _args: GetServiceNamesArgs, config: DiscoveryConfig): Promise; export declare function getEnvironments(client: DbClient, schema: string, _args: GetEnvironmentsArgs, config: DiscoveryConfig): Promise; export declare function getTags(client: DbClient, schema: string, args: GetTagsArgs, config: DiscoveryConfig): Promise; export declare function getMetricNames(client: DbClient, schema: string, args: GetMetricNamesArgs, config: DiscoveryConfig): Promise; export declare function getMetricLabelKeys(client: DbClient, schema: string, args: GetMetricLabelKeysArgs, config: DiscoveryConfig): Promise; export declare function getMetricLabelValues(client: DbClient, schema: string, args: GetMetricLabelValuesArgs, config: DiscoveryConfig): Promise; /** * Force-refresh the six unscoped discovery cache keys: `entity_types`, * `entity_names`, `service_names`, `environments`, `tags`, and * `metric_names`. Scoped keys (`entity_names:`, * `tags:`, `metric_label_keys:`, * `metric_label_values::`) are not touched here — they refresh * lazily on read against their own keys. * * Intended for the future `mastra observability discovery refresh` CLI * command. */ export declare function refreshAllDiscoveryCaches(client: DbClient, schema: string, config: DiscoveryConfig): Promise; //# sourceMappingURL=discovery.d.ts.map