@mastra/server 0.0.1-alpha.4 → 0.0.1-alpha.6

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.
@@ -408,11 +408,11 @@ export declare function storeTelemetryHandler({ mastra, body }: Context & {
408
408
  }): Promise<{
409
409
  status: string;
410
410
  message: string;
411
- traceCount: number;
411
+ error: any;
412
412
  } | {
413
413
  status: string;
414
414
  message: string;
415
- error: any;
415
+ traceCount: number;
416
416
  }>;
417
417
 
418
418
  export declare function streamGenerateHandler({ mastra, agentId, body, }: Context & {
@@ -408,11 +408,11 @@ export declare function storeTelemetryHandler({ mastra, body }: Context & {
408
408
  }): Promise<{
409
409
  status: string;
410
410
  message: string;
411
- traceCount: number;
411
+ error: any;
412
412
  } | {
413
413
  status: string;
414
414
  message: string;
415
- error: any;
415
+ traceCount: number;
416
416
  }>;
417
417
 
418
418
  export declare function streamGenerateHandler({ mastra, agentId, body, }: Context & {
@@ -2,7 +2,6 @@
2
2
 
3
3
  var chunkZLBRQFDD_cjs = require('./chunk-ZLBRQFDD.cjs');
4
4
  var chunkFV45V6WC_cjs = require('./chunk-FV45V6WC.cjs');
5
- var storage = require('@mastra/core/storage');
6
5
 
7
6
  // src/server/handlers/telemetry.ts
8
7
  var telemetry_exports = {};
@@ -44,12 +43,24 @@ async function getTelemetryHandler({ mastra, body }) {
44
43
  }
45
44
  async function storeTelemetryHandler({ mastra, body }) {
46
45
  try {
47
- const storage$1 = mastra.getStorage();
48
- if (!storage$1) {
46
+ const storage = mastra.getStorage();
47
+ const logger = mastra.getLogger();
48
+ if (!storage) {
49
49
  throw new chunkFV45V6WC_cjs.HTTPException(400, { message: "Storage is not initialized" });
50
50
  }
51
51
  const now = /* @__PURE__ */ new Date();
52
52
  const items = body?.resourceSpans?.[0]?.scopeSpans;
53
+ logger.debug("[Telemetry Handler] Received spans:", {
54
+ totalSpans: items?.reduce((acc, scope) => acc + scope.spans.length, 0) || 0,
55
+ timestamp: now.toISOString()
56
+ });
57
+ if (!items?.length) {
58
+ return {
59
+ status: "success",
60
+ message: "No spans to process",
61
+ traceCount: 0
62
+ };
63
+ }
53
64
  const allSpans = items.reduce((acc, scopedSpans) => {
54
65
  const { scope, spans } = scopedSpans;
55
66
  for (const span of spans) {
@@ -96,8 +107,7 @@ async function storeTelemetryHandler({ mastra, body }) {
96
107
  }
97
108
  return acc;
98
109
  }, []);
99
- return storage$1.__batchInsert({
100
- tableName: storage.TABLE_TRACES,
110
+ return storage.__batchTraceInsert({
101
111
  records: allSpans
102
112
  }).then(() => {
103
113
  return {
@@ -1,6 +1,5 @@
1
1
  import { handleError } from './chunk-3AHQ5RGN.js';
2
2
  import { __export, HTTPException } from './chunk-TRDNDNGQ.js';
3
- import { TABLE_TRACES } from '@mastra/core/storage';
4
3
 
5
4
  // src/server/handlers/telemetry.ts
6
5
  var telemetry_exports = {};
@@ -43,11 +42,23 @@ async function getTelemetryHandler({ mastra, body }) {
43
42
  async function storeTelemetryHandler({ mastra, body }) {
44
43
  try {
45
44
  const storage = mastra.getStorage();
45
+ const logger = mastra.getLogger();
46
46
  if (!storage) {
47
47
  throw new HTTPException(400, { message: "Storage is not initialized" });
48
48
  }
49
49
  const now = /* @__PURE__ */ new Date();
50
50
  const items = body?.resourceSpans?.[0]?.scopeSpans;
51
+ logger.debug("[Telemetry Handler] Received spans:", {
52
+ totalSpans: items?.reduce((acc, scope) => acc + scope.spans.length, 0) || 0,
53
+ timestamp: now.toISOString()
54
+ });
55
+ if (!items?.length) {
56
+ return {
57
+ status: "success",
58
+ message: "No spans to process",
59
+ traceCount: 0
60
+ };
61
+ }
51
62
  const allSpans = items.reduce((acc, scopedSpans) => {
52
63
  const { scope, spans } = scopedSpans;
53
64
  for (const span of spans) {
@@ -94,8 +105,7 @@ async function storeTelemetryHandler({ mastra, body }) {
94
105
  }
95
106
  return acc;
96
107
  }, []);
97
- return storage.__batchInsert({
98
- tableName: TABLE_TRACES,
108
+ return storage.__batchTraceInsert({
99
109
  records: allSpans
100
110
  }).then(() => {
101
111
  return {
@@ -1,14 +1,14 @@
1
1
  'use strict';
2
2
 
3
- var chunkHKWIEBJD_cjs = require('../../chunk-HKWIEBJD.cjs');
3
+ var chunkCWSDZEZG_cjs = require('../../chunk-CWSDZEZG.cjs');
4
4
 
5
5
 
6
6
 
7
7
  Object.defineProperty(exports, "getTelemetryHandler", {
8
8
  enumerable: true,
9
- get: function () { return chunkHKWIEBJD_cjs.getTelemetryHandler; }
9
+ get: function () { return chunkCWSDZEZG_cjs.getTelemetryHandler; }
10
10
  });
11
11
  Object.defineProperty(exports, "storeTelemetryHandler", {
12
12
  enumerable: true,
13
- get: function () { return chunkHKWIEBJD_cjs.storeTelemetryHandler; }
13
+ get: function () { return chunkCWSDZEZG_cjs.storeTelemetryHandler; }
14
14
  });
@@ -1 +1 @@
1
- export { getTelemetryHandler, storeTelemetryHandler } from '../../chunk-RXBZWKUR.js';
1
+ export { getTelemetryHandler, storeTelemetryHandler } from '../../chunk-DVPP5S6I.js';
@@ -8,7 +8,7 @@ var chunkGV52BII2_cjs = require('../chunk-GV52BII2.cjs');
8
8
  var chunkVB7KH62D_cjs = require('../chunk-VB7KH62D.cjs');
9
9
  var chunk2FJURXCL_cjs = require('../chunk-2FJURXCL.cjs');
10
10
  var chunk5JOF627H_cjs = require('../chunk-5JOF627H.cjs');
11
- var chunkHKWIEBJD_cjs = require('../chunk-HKWIEBJD.cjs');
11
+ var chunkCWSDZEZG_cjs = require('../chunk-CWSDZEZG.cjs');
12
12
 
13
13
 
14
14
 
@@ -46,5 +46,5 @@ Object.defineProperty(exports, "network", {
46
46
  });
47
47
  Object.defineProperty(exports, "telemetry", {
48
48
  enumerable: true,
49
- get: function () { return chunkHKWIEBJD_cjs.telemetry_exports; }
49
+ get: function () { return chunkCWSDZEZG_cjs.telemetry_exports; }
50
50
  });
@@ -6,4 +6,4 @@ export { agents_exports as agents } from '../chunk-BMA2ORRT.js';
6
6
  export { logs_exports as logs } from '../chunk-2JQC6JWP.js';
7
7
  export { memory_exports as memory } from '../chunk-RBQASTUP.js';
8
8
  export { network_exports as network } from '../chunk-2YONKUWB.js';
9
- export { telemetry_exports as telemetry } from '../chunk-RXBZWKUR.js';
9
+ export { telemetry_exports as telemetry } from '../chunk-DVPP5S6I.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/server",
3
- "version": "0.0.1-alpha.4",
3
+ "version": "0.0.1-alpha.6",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "files": [
@@ -46,7 +46,7 @@
46
46
  "license": "ISC",
47
47
  "dependencies": {},
48
48
  "peerDependencies": {
49
- "@mastra/core": "^0.8.0-alpha.6"
49
+ "@mastra/core": "^0.8.0-alpha.8"
50
50
  },
51
51
  "devDependencies": {
52
52
  "@ai-sdk/openai": "^1.3.2",
@@ -58,7 +58,7 @@
58
58
  "typescript": "^5.8.2",
59
59
  "vitest": "^2.1.9",
60
60
  "zod-to-json-schema": "^3.24.3",
61
- "@mastra/core": "0.8.0-alpha.6",
61
+ "@mastra/core": "0.8.0-alpha.8",
62
62
  "@internal/lint": "0.0.1"
63
63
  },
64
64
  "scripts": {