@mastra/duckdb 1.11.1-alpha.0 → 1.11.1

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.
@@ -3773,6 +3773,14 @@ function reconstructForAnchorsWithBoundParam(reconstructSelect, anchorCte) {
3773
3773
  AND (traceId, spanId) IN (SELECT traceId, spanId FROM ${anchorCte})
3774
3774
  GROUP BY traceId, spanId`;
3775
3775
  }
3776
+ /**
3777
+ * Event spans are point-in-time, so they end at the instant they start. Rows
3778
+ * written before event spans carried an end time have a null endedAt.
3779
+ */
3780
+ function rowEndedAt(row) {
3781
+ if (row.isEvent) return toDate(row.startedAt);
3782
+ return toDateOrNull(row.endedAt);
3783
+ }
3776
3784
  function rowToLightSpanRecord(row) {
3777
3785
  return {
3778
3786
  traceId: row.traceId,
@@ -3782,13 +3790,13 @@ function rowToLightSpanRecord(row) {
3782
3790
  parentSpanId: row.parentSpanId ?? null,
3783
3791
  isEvent: row.isEvent,
3784
3792
  startedAt: toDate(row.startedAt),
3785
- endedAt: toDateOrNull(row.endedAt),
3793
+ endedAt: rowEndedAt(row),
3786
3794
  entityType: row.entityType ?? null,
3787
3795
  entityId: row.entityId ?? null,
3788
3796
  entityName: row.entityName ?? null,
3789
3797
  error: parseJson(row.error),
3790
3798
  createdAt: toDate(row.startedAt),
3791
- updatedAt: toDateOrNull(row.endedAt)
3799
+ updatedAt: rowEndedAt(row)
3792
3800
  };
3793
3801
  }
3794
3802
  function rowToLightSpanRecordWithPreview(row) {
@@ -3809,7 +3817,7 @@ function rowToSpanRecord(row) {
3809
3817
  parentSpanId: row.parentSpanId ?? null,
3810
3818
  isEvent: row.isEvent,
3811
3819
  startedAt: toDate(row.startedAt),
3812
- endedAt: toDateOrNull(row.endedAt),
3820
+ endedAt: rowEndedAt(row),
3813
3821
  experimentId: row.experimentId ?? null,
3814
3822
  entityType: row.entityType ?? null,
3815
3823
  entityId: row.entityId ?? null,
@@ -4010,7 +4018,7 @@ function createStartSpanRow(s) {
4010
4018
  name: s.name,
4011
4019
  spanType: s.spanType,
4012
4020
  isEvent: s.isEvent,
4013
- endedAt: null,
4021
+ endedAt: s.isEvent ? s.startedAt : null,
4014
4022
  experimentId: s.experimentId ?? null,
4015
4023
  entityType: s.entityType ?? null,
4016
4024
  entityId: s.entityId ?? null,
@@ -4081,7 +4089,7 @@ function createEndSpanRow(s) {
4081
4089
  /** Insert a 'start' event for a new span. */
4082
4090
  async function createSpan(db, args) {
4083
4091
  const rows = [createStartSpanRow(args.span)];
4084
- if (args.span.endedAt) rows.push(createEndSpanRow(args.span));
4092
+ if (args.span.endedAt && !args.span.isEvent) rows.push(createEndSpanRow(args.span));
4085
4093
  await insertSpanEvents(db, rows);
4086
4094
  }
4087
4095
  /** Insert 'start' events for multiple spans in a single statement. */
@@ -4089,7 +4097,7 @@ async function batchCreateSpans(db, args) {
4089
4097
  if (args.records.length === 0) return;
4090
4098
  await insertSpanEvents(db, args.records.flatMap((record) => {
4091
4099
  const events = [createStartSpanRow(record)];
4092
- if (record.endedAt) events.push(createEndSpanRow(record));
4100
+ if (record.endedAt && !record.isEvent) events.push(createEndSpanRow(record));
4093
4101
  return events;
4094
4102
  }));
4095
4103
  }
@@ -4874,21 +4882,35 @@ var ObservabilityStorageDuckDB = class ObservabilityStorageDuckDB extends Observ
4874
4882
  if (!deltaPollingFeatureEnabled()) return [
4875
4883
  "metrics",
4876
4884
  "logs",
4885
+ "entity-type-discovery",
4886
+ "entity-name-discovery",
4887
+ "service-name-discovery",
4888
+ "environment-discovery",
4889
+ "tag-discovery",
4890
+ "metric-discovery",
4877
4891
  "trace-query",
4878
4892
  "trace-query-root-duration",
4879
4893
  "trace-query-discovery",
4880
4894
  "thread-query",
4881
- "trace-query-tenant-scope"
4895
+ "trace-query-tenant-scope",
4896
+ "feedback"
4882
4897
  ];
4883
4898
  return [
4884
4899
  "metrics",
4885
4900
  "logs",
4901
+ "entity-type-discovery",
4902
+ "entity-name-discovery",
4903
+ "service-name-discovery",
4904
+ "environment-discovery",
4905
+ "tag-discovery",
4906
+ "metric-discovery",
4886
4907
  "delta-polling",
4887
4908
  "trace-query",
4888
4909
  "trace-query-root-duration",
4889
4910
  "trace-query-discovery",
4890
4911
  "thread-query",
4891
- "trace-query-tenant-scope"
4912
+ "trace-query-tenant-scope",
4913
+ "feedback"
4892
4914
  ];
4893
4915
  }
4894
4916
  async createSpan(args) {
@@ -5043,4 +5065,4 @@ var ObservabilityStorageDuckDB = class ObservabilityStorageDuckDB extends Observ
5043
5065
  //#endregion
5044
5066
  export { ObservabilityStorageDuckDB };
5045
5067
 
5046
- //# sourceMappingURL=observability-By_TJb9K.js.map
5068
+ //# sourceMappingURL=observability-BVE7R9Oz.js.map