@mastra/pg 1.22.3 → 1.23.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import { ErrorCategory, ErrorDomain, MastraError } from "@mastra/core/error";
2
+ import * as coreStorage from "@mastra/core/storage";
2
3
  import { AgentsStorage, BRANCH_SPAN_TYPES, BackgroundTasksStorage, BlobStore, ChannelsStorage, DATASETS_SCHEMA, DATASET_ITEMS_SCHEMA, DATASET_VERSIONS_SCHEMA, DatasetsStorage, EXPERIMENTS_SCHEMA, EXPERIMENT_RESULTS_SCHEMA, EntityType, ExperimentsStorage, FactoryStorage, FavoritesStorage, KNOWLEDGE_ACTIVITY_SCHEMA, KNOWLEDGE_CURSORS_SCHEMA, KNOWLEDGE_MENTIONS_SCHEMA, KNOWLEDGE_NODES_SCHEMA, KNOWLEDGE_RECORDS_SCHEMA, KNOWLEDGE_SEMANTIC_OUTBOX_SCHEMA, KnowledgeConflictError, KnowledgeNotFoundError, KnowledgeStorage, MCPClientsStorage, MCPServersStorage, METRIC_DISTINCT_COLUMNS, MastraCompositeStore, MemoryStorage, NotificationsStorage, OBSERVATIONAL_MEMORY_TABLE_SCHEMA, ObservabilityStorage, PromptBlocksStorage, SchedulesStorage, ScorerDefinitionsStorage, ScoresStorage, SkillsStorage, TABLE_AGENTS, TABLE_AGENT_VERSIONS, TABLE_BACKGROUND_TASKS, TABLE_CHANNEL_CONFIG, TABLE_CHANNEL_INSTALLATIONS, TABLE_CONFIGS, TABLE_DATASETS, TABLE_DATASET_ITEMS, TABLE_DATASET_VERSIONS, TABLE_EXPERIMENTS, TABLE_EXPERIMENT_RESULTS, TABLE_FAVORITES, TABLE_KNOWLEDGE_ACTIVITY, TABLE_KNOWLEDGE_CURSORS, TABLE_KNOWLEDGE_MENTIONS, TABLE_KNOWLEDGE_NODES, TABLE_KNOWLEDGE_RECORDS, TABLE_KNOWLEDGE_SEMANTIC_OUTBOX, TABLE_MCP_CLIENTS, TABLE_MCP_CLIENT_VERSIONS, TABLE_MCP_SERVERS, TABLE_MCP_SERVER_VERSIONS, TABLE_MESSAGES, TABLE_NOTIFICATIONS, TABLE_PROMPT_BLOCKS, TABLE_PROMPT_BLOCK_VERSIONS, TABLE_RESOURCES, TABLE_SCHEDULES, TABLE_SCHEDULE_TRIGGERS, TABLE_SCHEMAS, TABLE_SCORERS, TABLE_SCORER_DEFINITIONS, TABLE_SCORER_DEFINITION_VERSIONS, TABLE_SKILLS, TABLE_SKILL_BLOBS, TABLE_SKILL_VERSIONS, TABLE_SPANS, TABLE_THREADS, TABLE_THREAD_STATE, TABLE_TOOL_PROVIDER_CONNECTIONS, TABLE_WORKFLOW_DEFINITIONS, TABLE_WORKFLOW_SNAPSHOT, TABLE_WORKSPACES, TABLE_WORKSPACE_VERSIONS, ThreadStateStorage, ToolProviderConnectionsStorage, TraceStatus, UniqueViolationError, WorkflowDefinitionsStorage, WorkflowsStorage, WorkspacesStorage, assertKnowledgeCeilingRaised, assertKnowledgeScopeWithinCeiling, calculatePagination, canonicalizeKnowledgeScope, createKnowledgeUlid, createStorageErrorId, createVectorErrorId, ensureDate, getDefaultValue, getSqlType, hasErrorCode, isKnowledgeScopeVisible, knowledgeScopeKey, knowledgeSemanticDocumentId, knowledgeSemanticIdempotencyKey, listBranchesArgsSchema, listFeedbackArgsSchema, listLogsArgsSchema, listMetricsArgsSchema, listScoresArgsSchema, listTracesArgsSchema, matchesExpectedWorkflowStatus, mergeWorkflowStepResult, normalizePerPage, normalizeScheduleTarget, parseDuration, parseKnowledgeNodeCursor, parseKnowledgeWikilinks, safelyParseJSON, storageMessageMatchesMetadataFilter, toTraceSpans, transformScoreRow, validateStorageMetadataFilter } from "@mastra/core/storage";
3
4
  import { parseFieldKey, parseSqlIdentifier } from "@mastra/core/utils";
4
5
  import { MastraVector, validateTopK, validateUpsertInput } from "@mastra/core/vector";
@@ -12145,12 +12146,20 @@ var MemoryPG = class MemoryPG extends MemoryStorage {
12145
12146
  };
12146
12147
  const lastBufferedAtTime = input.lastBufferedAtTime ? input.lastBufferedAtTime.toISOString() : null;
12147
12148
  if ((await this.#db.client.query(`UPDATE ${tableName} SET
12148
- "bufferedObservationChunks" = COALESCE("bufferedObservationChunks", '[]'::jsonb) || $1::jsonb,
12149
- "lastBufferedAtTime" = COALESCE($2, "lastBufferedAtTime"),
12150
- "updatedAt" = $3,
12151
- "updatedAtZ" = $4
12152
- WHERE id = $5`, [
12149
+ "bufferedObservationChunks" = CASE
12150
+ WHEN EXISTS (
12151
+ SELECT 1
12152
+ FROM jsonb_array_elements(COALESCE("bufferedObservationChunks", '[]'::jsonb)) AS chunk
12153
+ WHERE chunk->>'cycleId' = $2
12154
+ ) THEN COALESCE("bufferedObservationChunks", '[]'::jsonb)
12155
+ ELSE COALESCE("bufferedObservationChunks", '[]'::jsonb) || $1::jsonb
12156
+ END,
12157
+ "lastBufferedAtTime" = COALESCE($3, "lastBufferedAtTime"),
12158
+ "updatedAt" = $4,
12159
+ "updatedAtZ" = $5
12160
+ WHERE id = $6`, [
12153
12161
  JSON.stringify([newChunk]),
12162
+ input.chunk.cycleId,
12154
12163
  lastBufferedAtTime,
12155
12164
  nowStr,
12156
12165
  nowStr,
@@ -16715,6 +16724,304 @@ async function getScorePercentiles(client, schema, args) {
16715
16724
  return { series: percentileSeriesFromRows(await client.manyOrNone(sql, acc.params), args.percentiles) };
16716
16725
  }
16717
16726
  //#endregion
16727
+ //#region src/storage/domains/observability/v-next/trace-query.ts
16728
+ const TRACE_STATUS_SQL = `CASE WHEN r."error" IS NOT NULL THEN 'error' ELSE 'success' END`;
16729
+ const TRACE_FIELDS = {
16730
+ traceId: "r.\"traceId\"",
16731
+ threadId: "r.\"threadId\"",
16732
+ resourceId: "r.\"resourceId\"",
16733
+ startedAt: "r.\"startedAt\"",
16734
+ endedAt: "r.\"endedAt\"",
16735
+ entityName: "r.\"entityName\"",
16736
+ entityType: "r.\"entityType\"",
16737
+ environment: "r.\"environment\"",
16738
+ status: TRACE_STATUS_SQL
16739
+ };
16740
+ const SPAN_FIELDS = {
16741
+ spanType: "s.\"spanType\"",
16742
+ error: "s.\"error\""
16743
+ };
16744
+ const SCORE_FIELDS = {
16745
+ scorerId: "s.\"scorerId\"",
16746
+ score: "s.\"score\""
16747
+ };
16748
+ const TRACE_SELECT = `
16749
+ r."traceId" AS "traceId",
16750
+ r."spanId" AS "rootSpanId",
16751
+ r."threadId" AS "threadId",
16752
+ r."resourceId" AS "resourceId",
16753
+ r."startedAt" AS "startedAt",
16754
+ r."endedAt" AS "endedAt",
16755
+ r."entityName" AS "entityName",
16756
+ r."entityType" AS "entityType",
16757
+ r."environment" AS "environment",
16758
+ ${TRACE_STATUS_SQL} AS "status"`;
16759
+ function fieldSql(registry, field) {
16760
+ const sql = registry[field];
16761
+ if (sql === void 0) throw new Error(`Unsupported trusted trace-query field: ${field}`);
16762
+ return sql;
16763
+ }
16764
+ function placeholders(values, offset) {
16765
+ return values.map((_, index) => `$${offset + index}`).join(", ");
16766
+ }
16767
+ function compileScalarPredicate(predicate, registry, parameterOffset) {
16768
+ if (predicate.type === "boolean") {
16769
+ const values = [];
16770
+ return {
16771
+ sql: predicate.args.map((arg) => {
16772
+ const compiled = compileScalarPredicate(arg, registry, parameterOffset + values.length);
16773
+ values.push(...compiled.values);
16774
+ return `(${compiled.sql})`;
16775
+ }).join(predicate.operator === "and" ? " AND " : " OR "),
16776
+ values
16777
+ };
16778
+ }
16779
+ if (predicate.type === "not") {
16780
+ const compiled = compileScalarPredicate(predicate.arg, registry, parameterOffset);
16781
+ return {
16782
+ sql: `NOT (${compiled.sql})`,
16783
+ values: compiled.values
16784
+ };
16785
+ }
16786
+ const field = fieldSql(registry, predicate.field);
16787
+ if (predicate.type === "presence") return {
16788
+ sql: `${field} IS ${predicate.operator === "exists" ? "NOT " : ""}NULL`,
16789
+ values: []
16790
+ };
16791
+ if (predicate.type === "membership") {
16792
+ const list = placeholders(predicate.values, parameterOffset);
16793
+ if (predicate.operator === "in") return {
16794
+ sql: `${field} IS NOT NULL AND ${field} IN (${list})`,
16795
+ values: predicate.values
16796
+ };
16797
+ return {
16798
+ sql: `${field} IS NULL OR ${field} NOT IN (${list})`,
16799
+ values: predicate.values
16800
+ };
16801
+ }
16802
+ const parameter = `$${parameterOffset}`;
16803
+ const operators = {
16804
+ lt: "<",
16805
+ lte: "<=",
16806
+ gt: ">",
16807
+ gte: ">="
16808
+ };
16809
+ if (predicate.operator === "eq") return {
16810
+ sql: `${field} IS NOT DISTINCT FROM ${parameter}`,
16811
+ values: [predicate.value]
16812
+ };
16813
+ if (predicate.operator === "ne") return {
16814
+ sql: `${field} IS DISTINCT FROM ${parameter}`,
16815
+ values: [predicate.value]
16816
+ };
16817
+ const operator = operators[predicate.operator];
16818
+ if (operator === void 0) throw new Error(`Unsupported trusted trace-query operator: ${predicate.operator}`);
16819
+ return {
16820
+ sql: `${field} IS NOT NULL AND ${field} ${operator} ${parameter}`,
16821
+ values: [predicate.value]
16822
+ };
16823
+ }
16824
+ function latestRootPredicate$1(spanTable) {
16825
+ return `NOT EXISTS (
16826
+ SELECT 1 FROM ${spanTable} newer
16827
+ WHERE newer."traceId" = r."traceId"
16828
+ AND newer."parentSpanId" IS NULL
16829
+ AND newer."cursorId" > r."cursorId"
16830
+ )`;
16831
+ }
16832
+ function latestSpanPredicate$1(spanTable) {
16833
+ return `NOT EXISTS (
16834
+ SELECT 1 FROM ${spanTable} newer
16835
+ WHERE newer."traceId" = s."traceId"
16836
+ AND newer."spanId" = s."spanId"
16837
+ AND (newer."isPending" < s."isPending" OR (newer."isPending" = s."isPending" AND newer."cursorId" > s."cursorId"))
16838
+ )`;
16839
+ }
16840
+ function latestScorePredicate(scoreTable) {
16841
+ return `NOT EXISTS (
16842
+ SELECT 1 FROM ${scoreTable} newer
16843
+ WHERE newer."scoreId" = s."scoreId"
16844
+ AND newer."cursorId" > s."cursorId"
16845
+ )`;
16846
+ }
16847
+ function collectRelationCollections(predicate, collections = /* @__PURE__ */ new Set()) {
16848
+ if (!predicate) return collections;
16849
+ if (predicate.type === "relation") collections.add(predicate.collection);
16850
+ else if (predicate.type === "boolean") for (const arg of predicate.args) collectRelationCollections(arg, collections);
16851
+ else if (predicate.type === "not") collectRelationCollections(predicate.arg, collections);
16852
+ return collections;
16853
+ }
16854
+ function compilePredicate(predicate, parameterOffset) {
16855
+ if (predicate.type === "relation") {
16856
+ const registry = predicate.collection === "spans" ? SPAN_FIELDS : SCORE_FIELDS;
16857
+ const compiled = compileScalarPredicate(predicate.predicate, registry, parameterOffset);
16858
+ const existence = `EXISTS (
16859
+ SELECT 1 FROM ${predicate.collection === "spans" ? "current_spans" : "current_scores"} s
16860
+ WHERE s."traceId" = r."traceId"
16861
+ AND (${compiled.sql})
16862
+ )`;
16863
+ return {
16864
+ sql: predicate.quantifier === "some" ? existence : `NOT ${existence}`,
16865
+ values: compiled.values
16866
+ };
16867
+ }
16868
+ if (predicate.type === "boolean") {
16869
+ const values = [];
16870
+ return {
16871
+ sql: predicate.args.map((arg) => {
16872
+ const compiled = compilePredicate(arg, parameterOffset + values.length);
16873
+ values.push(...compiled.values);
16874
+ return `(${compiled.sql})`;
16875
+ }).join(predicate.operator === "and" ? " AND " : " OR "),
16876
+ values
16877
+ };
16878
+ }
16879
+ if (predicate.type === "not") {
16880
+ const compiled = compilePredicate(predicate.arg, parameterOffset);
16881
+ return {
16882
+ sql: `NOT (${compiled.sql})`,
16883
+ values: compiled.values
16884
+ };
16885
+ }
16886
+ return compileScalarPredicate(predicate, TRACE_FIELDS, parameterOffset);
16887
+ }
16888
+ function compilePostgresTraceQuery(schema, plan) {
16889
+ const spanTable = qualifiedTable(schema, TABLE_SPAN_EVENTS);
16890
+ const scoreTable = qualifiedTable(schema, TABLE_SCORE_EVENTS);
16891
+ const values = [plan.timeRange.from, plan.timeRange.to];
16892
+ const relationCollections = collectRelationCollections(plan.where);
16893
+ const ctes = [`root_scope AS MATERIALIZED (
16894
+ SELECT *
16895
+ FROM ${spanTable} r
16896
+ WHERE ${[
16897
+ `r."parentSpanId" IS NULL`,
16898
+ latestRootPredicate$1(spanTable),
16899
+ `NOT r."isPending"`,
16900
+ `r."endedAt" IS NOT NULL`,
16901
+ `r."startedAt" >= $1`,
16902
+ `r."startedAt" < $2`
16903
+ ].join("\n AND ")}
16904
+ )`];
16905
+ if (relationCollections.has("spans")) ctes.push(`current_spans AS MATERIALIZED (
16906
+ SELECT s."traceId", s."spanType", s."error"
16907
+ FROM ${spanTable} s
16908
+ WHERE s."traceId" IS NOT NULL
16909
+ AND s."traceId" IN (SELECT "traceId" FROM root_scope)
16910
+ AND ${latestSpanPredicate$1(spanTable)}
16911
+ )`);
16912
+ if (relationCollections.has("scores")) ctes.push(`current_scores AS MATERIALIZED (
16913
+ SELECT s."traceId", s."scorerId", s."score"
16914
+ FROM ${scoreTable} s
16915
+ WHERE s."traceId" IS NOT NULL
16916
+ AND s."traceId" IN (SELECT "traceId" FROM root_scope)
16917
+ AND ${latestScorePredicate(scoreTable)}
16918
+ )`);
16919
+ let predicateSql = "TRUE";
16920
+ if (plan.where) {
16921
+ const predicate = compilePredicate(plan.where, values.length + 1);
16922
+ predicateSql = predicate.sql;
16923
+ values.push(...predicate.values);
16924
+ }
16925
+ ctes.push(`candidates AS (
16926
+ SELECT ${TRACE_SELECT}
16927
+ FROM root_scope r
16928
+ WHERE ${predicateSql}
16929
+ )`);
16930
+ const candidates = `WITH ${ctes.join(",\n")}`;
16931
+ if (plan.result === "groups") {
16932
+ const pageCondition = plan.cursor ? `AND "threadId" > $${values.length + 1}` : "";
16933
+ if (plan.cursor) values.push(plan.cursor.threadId);
16934
+ values.push(plan.limit + 1);
16935
+ return {
16936
+ text: `${candidates}
16937
+ SELECT "threadId"
16938
+ FROM candidates
16939
+ WHERE "threadId" IS NOT NULL ${pageCondition}
16940
+ GROUP BY "threadId"
16941
+ ORDER BY "threadId" ASC
16942
+ LIMIT $${values.length}`,
16943
+ values
16944
+ };
16945
+ }
16946
+ const orderField = plan.orderBy.field === "startedAt" ? "\"startedAt\"" : "\"endedAt\"";
16947
+ const direction = plan.orderBy.direction === "asc" ? "ASC" : "DESC";
16948
+ let pageCondition = "";
16949
+ if (plan.cursor) {
16950
+ const comparison = plan.orderBy.direction === "asc" ? ">" : "<";
16951
+ const sortParameter = `$${values.length + 1}`;
16952
+ pageCondition = `WHERE (${orderField} ${comparison} ${sortParameter} OR (${orderField} = ${sortParameter} AND "traceId" > ${`$${values.length + 2}`}))`;
16953
+ values.push(plan.cursor.sortValue, plan.cursor.traceId);
16954
+ }
16955
+ values.push(plan.limit + 1);
16956
+ return {
16957
+ text: `${candidates}
16958
+ SELECT *
16959
+ FROM candidates
16960
+ ${pageCondition}
16961
+ ORDER BY ${orderField} ${direction}, "traceId" ASC
16962
+ LIMIT $${values.length}`,
16963
+ values
16964
+ };
16965
+ }
16966
+ function asIsoTimestamp$1(value) {
16967
+ if (value === null || value === void 0) throw new Error("Trace query returned a null timestamp");
16968
+ return value instanceof Date ? value.toISOString() : new Date(value).toISOString();
16969
+ }
16970
+ function isPostgresStatementTimeout(error) {
16971
+ if (!error || typeof error !== "object") return false;
16972
+ const candidate = error;
16973
+ return candidate.code === "57014" && String(candidate.message ?? "").includes("statement timeout");
16974
+ }
16975
+ async function runWithPostgresTraceQueryTimeout(client, timeoutMs, execute) {
16976
+ const resolvedTimeoutMs = coreStorage.resolveTraceQueryTimeoutMs(timeoutMs);
16977
+ try {
16978
+ return await client.tx(async (transaction) => {
16979
+ await transaction.query(`SELECT set_config('statement_timeout', $1, true)`, [`${resolvedTimeoutMs}ms`]);
16980
+ return execute(transaction);
16981
+ });
16982
+ } catch (error) {
16983
+ if (isPostgresStatementTimeout(error)) throw new coreStorage.TraceQueryExecutionError();
16984
+ throw error;
16985
+ }
16986
+ }
16987
+ async function queryTraces(client, schema, plan, timeoutMs) {
16988
+ const query = compilePostgresTraceQuery(schema, plan);
16989
+ const rows = await runWithPostgresTraceQueryTimeout(client, timeoutMs, (transaction) => transaction.any(query.text, query.values));
16990
+ const visibleRows = rows.slice(0, plan.limit);
16991
+ if (plan.result === "groups") {
16992
+ const groups = visibleRows.map((row) => ({ threadId: String(row.threadId) }));
16993
+ const last = groups.at(-1);
16994
+ return coreStorage.traceQueryResponseSchema.parse({
16995
+ groups,
16996
+ page: { next: rows.length > plan.limit && last ? coreStorage.encodeTraceQueryCursor(plan, {
16997
+ result: "groups",
16998
+ threadId: last.threadId
16999
+ }) : null }
17000
+ });
17001
+ }
17002
+ const traces = visibleRows.map((row) => ({
17003
+ traceId: String(row.traceId),
17004
+ rootSpanId: String(row.rootSpanId),
17005
+ threadId: row.threadId == null ? null : String(row.threadId),
17006
+ resourceId: row.resourceId == null ? null : String(row.resourceId),
17007
+ startedAt: asIsoTimestamp$1(row.startedAt),
17008
+ endedAt: asIsoTimestamp$1(row.endedAt),
17009
+ entityName: row.entityName == null ? null : String(row.entityName),
17010
+ entityType: row.entityType == null ? null : String(row.entityType),
17011
+ environment: row.environment == null ? null : String(row.environment),
17012
+ status: row.status
17013
+ }));
17014
+ const last = traces.at(-1);
17015
+ return coreStorage.traceQueryResponseSchema.parse({
17016
+ traces,
17017
+ page: { next: rows.length > plan.limit && last ? coreStorage.encodeTraceQueryCursor(plan, {
17018
+ result: "traces",
17019
+ sortValue: last[plan.orderBy.field],
17020
+ traceId: last.traceId
17021
+ }) : null }
17022
+ });
17023
+ }
17024
+ //#endregion
16718
17025
  //#region src/storage/domains/observability/v-next/traces.ts
16719
17026
  /**
16720
17027
  * Trace / branch list reads for the v-next Postgres observability domain.
@@ -17401,7 +17708,7 @@ async function dangerouslyClearTracing(client, schema) {
17401
17708
  * Use it through `MastraCompositeStore` with a dedicated Postgres connection.
17402
17709
  */
17403
17710
  function wrapError(op, error, details) {
17404
- if (error instanceof MastraError) throw error;
17711
+ if (error instanceof MastraError || error instanceof coreStorage.TraceQueryExecutionError) throw error;
17405
17712
  throw new MastraError({
17406
17713
  id: createStorageErrorId("PG", op, "FAILED"),
17407
17714
  domain: ErrorDomain.STORAGE,
@@ -17414,6 +17721,7 @@ var ObservabilityStoragePostgresVNext = class ObservabilityStoragePostgresVNext
17414
17721
  #schema;
17415
17722
  #partitioning;
17416
17723
  #discoveryConfig;
17724
+ #traceQueryTimeoutMs;
17417
17725
  #partitionMode;
17418
17726
  constructor(config) {
17419
17727
  super();
@@ -17422,6 +17730,7 @@ var ObservabilityStoragePostgresVNext = class ObservabilityStoragePostgresVNext
17422
17730
  this.#schema = schemaName ?? "public";
17423
17731
  this.#partitioning = config.partitioning ?? {};
17424
17732
  this.#discoveryConfig = config.discovery ?? {};
17733
+ this.#traceQueryTimeoutMs = coreStorage.resolveTraceQueryTimeoutMs(config.traceQueryTimeoutMs);
17425
17734
  }
17426
17735
  /**
17427
17736
  * Build the discovery config used at each call site, with the framework
@@ -17573,11 +17882,16 @@ var ObservabilityStoragePostgresVNext = class ObservabilityStoragePostgresVNext
17573
17882
  };
17574
17883
  }
17575
17884
  getFeatures() {
17576
- if (!deltaPollingFeatureEnabled()) return ["metrics", "logs"];
17885
+ if (!deltaPollingFeatureEnabled()) return [
17886
+ "metrics",
17887
+ "logs",
17888
+ "trace-query"
17889
+ ];
17577
17890
  return [
17578
17891
  "metrics",
17579
17892
  "logs",
17580
- "delta-polling"
17893
+ "delta-polling",
17894
+ "trace-query"
17581
17895
  ];
17582
17896
  }
17583
17897
  async #run(op, fn, details) {
@@ -17620,6 +17934,9 @@ var ObservabilityStoragePostgresVNext = class ObservabilityStoragePostgresVNext
17620
17934
  async listTraces(args) {
17621
17935
  return this.#run("LIST_TRACES", () => listTraces(this.#client, this.#schema, args));
17622
17936
  }
17937
+ async queryTraces(plan) {
17938
+ return this.#run("QUERY_TRACES", () => queryTraces(this.#client, this.#schema, plan, this.#traceQueryTimeoutMs));
17939
+ }
17623
17940
  async listBranches(args) {
17624
17941
  return this.#run("LIST_BRANCHES", () => listBranches(this.#client, this.#schema, args));
17625
17942
  }
@@ -22819,7 +23136,8 @@ var PostgresStoreVNext = class extends PostgresStore {
22819
23136
  client: observabilityClient,
22820
23137
  schemaName: obsConfig.schemaName ?? config.schemaName,
22821
23138
  partitioning: obsConfig.partitioning,
22822
- discovery: obsConfig.discovery
23139
+ discovery: obsConfig.discovery,
23140
+ traceQueryTimeoutMs: obsConfig.traceQueryTimeoutMs
22823
23141
  });
22824
23142
  this.stores = {
22825
23143
  ...this.stores,