@mastra/clickhouse 1.7.1 → 1.7.2

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/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # @mastra/clickhouse
2
2
 
3
+ ## 1.7.2
4
+
5
+ ### Patch Changes
6
+
7
+ - Expose `GET /observability/traces/light` and storage support for fetching paginated trace-list rows without span payload data. ([#16608](https://github.com/mastra-ai/mastra/pull/16608))
8
+
9
+ - Updated dependencies [[`20787de`](https://github.com/mastra-ai/mastra/commit/20787de5965234a1af28fe35f49437c537dbfa0d), [`784ad98`](https://github.com/mastra-ai/mastra/commit/784ad989549de91dc5d33ab8ef36caa6f7dcd34e), [`fceae1f`](https://github.com/mastra-ai/mastra/commit/fceae1f5f5db4722cb078a663c6eb4bd22944123), [`090a647`](https://github.com/mastra-ai/mastra/commit/090a647ba5a66d36f203f9f49457e03a1ff4e6fb), [`bf02acb`](https://github.com/mastra-ai/mastra/commit/bf02acbb8a6110f638ac844e89f1ebf04cb7fe74), [`090a647`](https://github.com/mastra-ai/mastra/commit/090a647ba5a66d36f203f9f49457e03a1ff4e6fb), [`bdb4cbf`](https://github.com/mastra-ai/mastra/commit/bdb4cbf8ba4b685d7481f28bb9dc3de6c79c9ed2), [`0fd3fbe`](https://github.com/mastra-ai/mastra/commit/0fd3fbe40fb63657aedd72f6e7b38c8e8ee6940d), [`f84447d`](https://github.com/mastra-ai/mastra/commit/f84447d6c80f3471836a9b300d246b331fb47e0d), [`a1a5b3e`](https://github.com/mastra-ai/mastra/commit/a1a5b3e42ab2ca5161ea21db59ebf28442680fa7), [`af84f57`](https://github.com/mastra-ai/mastra/commit/af84f571ed762e92e8e61c5f9a72363520914274), [`8b3c6f9`](https://github.com/mastra-ai/mastra/commit/8b3c6f90f7879833ba7d1bc70937e1d8f69d0804), [`fed0475`](https://github.com/mastra-ai/mastra/commit/fed0475ccfea31e4fc251469ac05640d0742c1f0), [`0d53730`](https://github.com/mastra-ai/mastra/commit/0d53730c1ed87ef80c87caa5701c4170ea8028e6), [`522f44d`](https://github.com/mastra-ai/mastra/commit/522f44d947214bfc06cff50599bae1ef3494880d)]:
10
+ - @mastra/core@1.34.0
11
+
12
+ ## 1.7.2-alpha.0
13
+
14
+ ### Patch Changes
15
+
16
+ - Expose `GET /observability/traces/light` and storage support for fetching paginated trace-list rows without span payload data. ([#16608](https://github.com/mastra-ai/mastra/pull/16608))
17
+
18
+ - Updated dependencies [[`090a647`](https://github.com/mastra-ai/mastra/commit/090a647ba5a66d36f203f9f49457e03a1ff4e6fb), [`090a647`](https://github.com/mastra-ai/mastra/commit/090a647ba5a66d36f203f9f49457e03a1ff4e6fb), [`f84447d`](https://github.com/mastra-ai/mastra/commit/f84447d6c80f3471836a9b300d246b331fb47e0d), [`a1a5b3e`](https://github.com/mastra-ai/mastra/commit/a1a5b3e42ab2ca5161ea21db59ebf28442680fa7), [`af84f57`](https://github.com/mastra-ai/mastra/commit/af84f571ed762e92e8e61c5f9a72363520914274), [`8b3c6f9`](https://github.com/mastra-ai/mastra/commit/8b3c6f90f7879833ba7d1bc70937e1d8f69d0804)]:
19
+ - @mastra/core@1.34.0-alpha.3
20
+
3
21
  ## 1.7.1
4
22
 
5
23
  ### Patch Changes
@@ -3,7 +3,7 @@ name: mastra-clickhouse
3
3
  description: Documentation for @mastra/clickhouse. Use when working with @mastra/clickhouse APIs, configuration, or implementation.
4
4
  metadata:
5
5
  package: "@mastra/clickhouse"
6
- version: "1.7.1"
6
+ version: "1.7.2"
7
7
  ---
8
8
 
9
9
  ## When to use
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.7.1",
2
+ "version": "1.7.2",
3
3
  "package": "@mastra/clickhouse",
4
4
  "exports": {},
5
5
  "modules": {}
package/dist/index.cjs CHANGED
@@ -3687,6 +3687,26 @@ function rowToSpanRecord(row) {
3687
3687
  updatedAt: null
3688
3688
  };
3689
3689
  }
3690
+ function rowToLightSpanRecord(row) {
3691
+ const startedAt = toDate(row.startedAt);
3692
+ const endedAt = row.isEvent ? startedAt : toDateOrNull(row.endedAt);
3693
+ return {
3694
+ traceId: row.traceId,
3695
+ spanId: row.spanId,
3696
+ parentSpanId: nullableString(row.parentSpanId),
3697
+ name: row.name,
3698
+ spanType: row.spanType,
3699
+ isEvent: Boolean(row.isEvent),
3700
+ startedAt,
3701
+ endedAt,
3702
+ entityType: nullableEntityType(row.entityType),
3703
+ entityId: nullableString(row.entityId),
3704
+ entityName: nullableString(row.entityName),
3705
+ error: parseJson(row.error) ?? void 0,
3706
+ createdAt: startedAt,
3707
+ updatedAt: null
3708
+ };
3709
+ }
3690
3710
  function spanRecordToRow(span) {
3691
3711
  const endedAt = span.isEvent ? span.startedAt : span.endedAt ?? span.startedAt;
3692
3712
  const metadata = span.metadata ?? null;
@@ -5589,7 +5609,7 @@ async function getRootSpan(client, args) {
5589
5609
  if (!rows || rows.length === 0) return null;
5590
5610
  return { span: rowToSpanRecord(rows[0]) };
5591
5611
  }
5592
- async function listTraces(client, args) {
5612
+ async function listTraceRows(client, args, selectClause, mapRows) {
5593
5613
  const { filters, pagination, orderBy } = storage.listTracesArgsSchema.parse(args);
5594
5614
  const page = pagination?.page ?? 0;
5595
5615
  const perPage = pagination?.perPage ?? 10;
@@ -5637,8 +5657,8 @@ async function listTraces(client, args) {
5637
5657
  }
5638
5658
  const dataResult = await client.query({
5639
5659
  query: `
5640
- SELECT * FROM (
5641
- SELECT *
5660
+ SELECT ${selectClause} FROM (
5661
+ SELECT ${selectClause}
5642
5662
  FROM ${TABLE_TRACE_ROOTS} r
5643
5663
  ${whereClause}
5644
5664
  ORDER BY dedupeKey
@@ -5657,7 +5677,6 @@ async function listTraces(client, args) {
5657
5677
  clickhouse_settings: CH_SETTINGS
5658
5678
  });
5659
5679
  const rows = await dataResult.json();
5660
- const spans = rows.map(rowToSpanRecord);
5661
5680
  return {
5662
5681
  pagination: {
5663
5682
  total,
@@ -5665,9 +5684,29 @@ async function listTraces(client, args) {
5665
5684
  perPage,
5666
5685
  hasMore: (page + 1) * perPage < total
5667
5686
  },
5668
- spans: storage.toTraceSpans(spans)
5687
+ spans: mapRows(rows)
5669
5688
  };
5670
5689
  }
5690
+ async function listTraces(client, args) {
5691
+ return listTraceRows(client, args, "*", (rows) => storage.toTraceSpans(rows.map(rowToSpanRecord)));
5692
+ }
5693
+ var LIGHT_TRACE_ROOT_COLUMNS = [
5694
+ "traceId",
5695
+ "spanId",
5696
+ "parentSpanId",
5697
+ "name",
5698
+ "spanType",
5699
+ "isEvent",
5700
+ "startedAt",
5701
+ "endedAt",
5702
+ "entityType",
5703
+ "entityId",
5704
+ "entityName",
5705
+ "error"
5706
+ ].join(", ");
5707
+ async function listTracesLight(client, args) {
5708
+ return listTraceRows(client, args, LIGHT_TRACE_ROOT_COLUMNS, (rows) => rows.map(rowToLightSpanRecord));
5709
+ }
5671
5710
  var BRANCH_SPAN_TYPE_SQL_LIST = storage.BRANCH_SPAN_TYPES.map((t) => `'${t}'`).join(", ");
5672
5711
  async function createSpan(client, args) {
5673
5712
  const row = spanRecordToRow(args.span);
@@ -6288,6 +6327,21 @@ var ObservabilityStorageClickhouseVNext = class extends storage.ObservabilitySto
6288
6327
  );
6289
6328
  }
6290
6329
  }
6330
+ async listTracesLight(args) {
6331
+ try {
6332
+ return await listTracesLight(this.#client, args);
6333
+ } catch (error$1) {
6334
+ if (error$1 instanceof error.MastraError) throw error$1;
6335
+ throw new error.MastraError(
6336
+ {
6337
+ id: storage.createStorageErrorId("CLICKHOUSE", "LIST_TRACES_LIGHT", "FAILED"),
6338
+ domain: error.ErrorDomain.STORAGE,
6339
+ category: error.ErrorCategory.THIRD_PARTY
6340
+ },
6341
+ error$1
6342
+ );
6343
+ }
6344
+ }
6291
6345
  async listBranches(args) {
6292
6346
  try {
6293
6347
  return await listBranches(this.#client, args);