@mastra/server 1.79.0-alpha.7 → 1.79.0-alpha.8
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/{api-schema-manifest-CXmfl718.js → api-schema-manifest-CXiWNHBm.js} +2 -2
- package/dist/{api-schema-manifest-CXmfl718.js.map → api-schema-manifest-CXiWNHBm.js.map} +1 -1
- package/dist/{api-schema-manifest-D06vSmIN.cjs → api-schema-manifest-Cs2cYG-m.cjs} +2 -2
- package/dist/{api-schema-manifest-D06vSmIN.cjs.map → api-schema-manifest-Cs2cYG-m.cjs.map} +1 -1
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/docs/references/reference-observability-tracing-advanced-queries.md +28 -21
- package/dist/{observability-new-endpoints-DMbbmOzO.js → observability-new-endpoints-7wGwP3se.js} +5 -3
- package/dist/observability-new-endpoints-7wGwP3se.js.map +1 -0
- package/dist/{observability-new-endpoints-s3ccgoif.cjs → observability-new-endpoints-outfOdc8.cjs} +4 -2
- package/dist/observability-new-endpoints-outfOdc8.cjs.map +1 -0
- package/dist/{routes-kj3891v4.js → routes-BYcXmjX3.js} +2 -2
- package/dist/{routes-kj3891v4.js.map → routes-BYcXmjX3.js.map} +1 -1
- package/dist/{routes-BTqI1f9k.cjs → routes-gZRBp2vK.cjs} +2 -2
- package/dist/{routes-BTqI1f9k.cjs.map → routes-gZRBp2vK.cjs.map} +1 -1
- package/dist/server/handlers/observability-new-endpoints.cjs +1 -1
- package/dist/server/handlers/observability-new-endpoints.d.ts +12 -4
- package/dist/server/handlers/observability-new-endpoints.d.ts.map +1 -1
- package/dist/server/handlers/observability-new-endpoints.js +1 -1
- package/dist/server/handlers/observability-shared.cjs +13 -0
- package/dist/server/handlers/observability-shared.cjs.map +1 -1
- package/dist/server/handlers/observability-shared.d.ts +6 -0
- package/dist/server/handlers/observability-shared.d.ts.map +1 -1
- package/dist/server/handlers/observability-shared.js +12 -1
- package/dist/server/handlers/observability-shared.js.map +1 -1
- package/dist/server/handlers/observability.cjs +1 -1
- package/dist/server/handlers/observability.js +1 -1
- package/dist/server/handlers/system.cjs +2 -2
- package/dist/server/handlers/system.d.ts +2 -0
- package/dist/server/handlers/system.d.ts.map +1 -1
- package/dist/server/handlers/system.js +2 -2
- package/dist/server/schemas/index.cjs +1 -1
- package/dist/server/schemas/index.js +1 -1
- package/dist/server/schemas/system.d.ts +2 -0
- package/dist/server/schemas/system.d.ts.map +1 -1
- package/dist/server/server-adapter/index.cjs +1 -1
- package/dist/server/server-adapter/index.js +1 -1
- package/dist/server/server-adapter/routes/observability.d.ts +6 -2
- package/dist/server/server-adapter/routes/observability.d.ts.map +1 -1
- package/dist/server/server-adapter/routes/system.d.ts +2 -0
- package/dist/server/server-adapter/routes/system.d.ts.map +1 -1
- package/dist/{system-CiAOa3RO.js → system-BLcPGYXT.js} +2 -1
- package/dist/system-BLcPGYXT.js.map +1 -0
- package/dist/{system-wG9idyeI.cjs → system-DvpPWdIa.cjs} +2 -1
- package/dist/system-DvpPWdIa.cjs.map +1 -0
- package/package.json +5 -5
- package/dist/observability-new-endpoints-DMbbmOzO.js.map +0 -1
- package/dist/observability-new-endpoints-s3ccgoif.cjs.map +0 -1
- package/dist/system-CiAOa3RO.js.map +0 -1
- package/dist/system-wG9idyeI.cjs.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { c as schemaToJsonSchema } from "./route-builder-BfQYtclb.js";
|
|
2
|
-
import { t as SERVER_ROUTES } from "./routes-
|
|
2
|
+
import { t as SERVER_ROUTES } from "./routes-BYcXmjX3.js";
|
|
3
3
|
//#region src/server/server-adapter/api-schema-manifest.ts
|
|
4
4
|
function convertSchema(schema) {
|
|
5
5
|
return schema ? schemaToJsonSchema(schema) : void 0;
|
|
@@ -58,4 +58,4 @@ function buildApiSchemaManifest(routes = SERVER_ROUTES) {
|
|
|
58
58
|
//#endregion
|
|
59
59
|
export { buildApiSchemaManifest };
|
|
60
60
|
|
|
61
|
-
//# sourceMappingURL=api-schema-manifest-
|
|
61
|
+
//# sourceMappingURL=api-schema-manifest-CXiWNHBm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-schema-manifest-
|
|
1
|
+
{"version":3,"file":"api-schema-manifest-CXiWNHBm.js","names":[],"sources":["../src/server/server-adapter/api-schema-manifest.ts"],"sourcesContent":["import type { JSONSchema7 } from '@mastra/schema-compat';\nimport { schemaToJsonSchema } from './openapi-utils';\nimport { SERVER_ROUTES } from './routes/index';\nimport type { ServerRoute } from './routes/index';\n\nexport interface ApiSchemaResponseShape {\n kind: 'array' | 'record' | 'object-property' | 'single' | 'unknown';\n listProperty?: string;\n paginationProperty?: string;\n}\n\nexport interface ApiSchemaManifestRoute {\n method: string;\n path: string;\n responseType: string;\n pathParamSchema?: JSONSchema7;\n queryParamSchema?: JSONSchema7;\n bodySchema?: JSONSchema7;\n responseSchema?: JSONSchema7;\n responseShape: ApiSchemaResponseShape;\n}\n\nexport interface ApiSchemaManifest {\n version: 1;\n routes: ApiSchemaManifestRoute[];\n}\n\nfunction convertSchema(schema: ServerRoute['bodySchema']): JSONSchema7 | undefined {\n return schema ? schemaToJsonSchema(schema) : undefined;\n}\n\nfunction asJsonSchema(value: unknown): JSONSchema7 | undefined {\n return value && typeof value === 'object' && !Array.isArray(value) ? (value as JSONSchema7) : undefined;\n}\n\nfunction schemaType(schema: JSONSchema7 | undefined): JSONSchema7['type'] | undefined {\n const type = schema?.type;\n return Array.isArray(type) ? type.find(Boolean) : type;\n}\n\nfunction inferResponseShape(responseSchema: JSONSchema7 | undefined): ApiSchemaResponseShape {\n if (!responseSchema) return { kind: 'unknown' };\n\n const alternatives: unknown[] | undefined = responseSchema.anyOf ?? responseSchema.oneOf;\n if (alternatives?.length) {\n const shapes = alternatives.map(schema => inferResponseShape(asJsonSchema(schema)));\n const first = shapes[0]!;\n return shapes.every(\n shape =>\n shape.kind === first.kind &&\n shape.listProperty === first.listProperty &&\n shape.paginationProperty === first.paginationProperty,\n )\n ? first\n : { kind: 'single' };\n }\n\n const type = schemaType(responseSchema);\n if (type === 'array') return { kind: 'array' };\n if (type !== 'object') return { kind: 'single' };\n\n const properties =\n responseSchema.properties && !Array.isArray(responseSchema.properties) ? responseSchema.properties : {};\n const propertyNames = Object.keys(properties);\n const paginationProperty = 'page' in properties ? 'page' : 'pagination' in properties ? 'pagination' : undefined;\n const listProperty = Object.entries(properties).find(\n ([, property]) => schemaType(asJsonSchema(property)) === 'array',\n )?.[0];\n\n if (listProperty && (paginationProperty || propertyNames.length <= 2)) {\n return { kind: 'object-property', listProperty, paginationProperty };\n }\n if (responseSchema.additionalProperties && propertyNames.length === 0) return { kind: 'record' };\n return { kind: 'single' };\n}\n\n/** CLI flags cover all request variants; the endpoint still validates the selected variant. */\nexport function getApiSchemaPropertyNames(schema: JSONSchema7 | undefined): string[] {\n if (!schema) return [];\n const names = Object.keys(schema.properties ?? {});\n for (const branch of schema.anyOf ?? schema.oneOf ?? [])\n names.push(...getApiSchemaPropertyNames(asJsonSchema(branch)));\n return [...new Set(names)].sort();\n}\n\nfunction isManifestRoute(route: ServerRoute): boolean {\n return route.responseType === 'json' && !route.deprecated;\n}\n\nexport function buildApiSchemaManifest(routes: readonly ServerRoute[] = SERVER_ROUTES): ApiSchemaManifest {\n return {\n version: 1,\n routes: routes.filter(isManifestRoute).map(route => {\n const responseSchema = convertSchema(route.responseSchema);\n return {\n method: route.method,\n path: route.path,\n responseType: route.responseType,\n pathParamSchema: convertSchema(route.pathParamSchema),\n queryParamSchema: convertSchema(route.queryParamSchema),\n bodySchema: convertSchema(route.bodySchema),\n responseSchema,\n responseShape: inferResponseShape(responseSchema),\n };\n }),\n };\n}\n"],"mappings":";;;AA2BA,SAAS,cAAc,QAA4D;CACjF,OAAO,SAAS,mBAAmB,MAAM,IAAI,KAAA;AAC/C;AAEA,SAAS,aAAa,OAAyC;CAC7D,OAAO,SAAS,OAAO,UAAU,Y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,iBAAiB,UAAU,CAAC,MAAM;AACjD;AAEA,SAAgB,uBAAuB,SAAiC,eAAkC;CACxG,OAAO;EACL,SAAS;EACT,QAAQ,OAAO,OAAO,eAAe,CAAC,CAAC,KAAI,UAAS;GAClD,MAAM,iBAAiB,cAAc,MAAM,cAAc;GACzD,OAAO;IACL,QAAQ,MAAM;IACd,MAAM,MAAM;IACZ,cAAc,MAAM;IACpB,iBAAiB,cAAc,MAAM,eAAe;IACpD,kBAAkB,cAAc,MAAM,gBAAgB;IACtD,YAAY,cAAc,MAAM,UAAU;IAC1C;IACA,eAAe,mBAAmB,cAAc;GAClD;EACF,CAAC;CACH;AACF"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
require("./rolldown-runtime-Bd6kNlEP.cjs");
|
|
2
2
|
const require_route_builder = require("./route-builder-BNZs643f.cjs");
|
|
3
|
-
const require_routes = require("./routes-
|
|
3
|
+
const require_routes = require("./routes-gZRBp2vK.cjs");
|
|
4
4
|
//#region src/server/server-adapter/api-schema-manifest.ts
|
|
5
5
|
function convertSchema(schema) {
|
|
6
6
|
return schema ? require_route_builder.schemaToJsonSchema(schema) : void 0;
|
|
@@ -59,4 +59,4 @@ function buildApiSchemaManifest(routes = require_routes.SERVER_ROUTES) {
|
|
|
59
59
|
//#endregion
|
|
60
60
|
exports.buildApiSchemaManifest = buildApiSchemaManifest;
|
|
61
61
|
|
|
62
|
-
//# sourceMappingURL=api-schema-manifest-
|
|
62
|
+
//# sourceMappingURL=api-schema-manifest-Cs2cYG-m.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-schema-manifest-
|
|
1
|
+
{"version":3,"file":"api-schema-manifest-Cs2cYG-m.cjs","names":["schemaToJsonSchema","SERVER_ROUTES"],"sources":["../src/server/server-adapter/api-schema-manifest.ts"],"sourcesContent":["import type { JSONSchema7 } from '@mastra/schema-compat';\nimport { schemaToJsonSchema } from './openapi-utils';\nimport { SERVER_ROUTES } from './routes/index';\nimport type { ServerRoute } from './routes/index';\n\nexport interface ApiSchemaResponseShape {\n kind: 'array' | 'record' | 'object-property' | 'single' | 'unknown';\n listProperty?: string;\n paginationProperty?: string;\n}\n\nexport interface ApiSchemaManifestRoute {\n method: string;\n path: string;\n responseType: string;\n pathParamSchema?: JSONSchema7;\n queryParamSchema?: JSONSchema7;\n bodySchema?: JSONSchema7;\n responseSchema?: JSONSchema7;\n responseShape: ApiSchemaResponseShape;\n}\n\nexport interface ApiSchemaManifest {\n version: 1;\n routes: ApiSchemaManifestRoute[];\n}\n\nfunction convertSchema(schema: ServerRoute['bodySchema']): JSONSchema7 | undefined {\n return schema ? schemaToJsonSchema(schema) : undefined;\n}\n\nfunction asJsonSchema(value: unknown): JSONSchema7 | undefined {\n return value && typeof value === 'object' && !Array.isArray(value) ? (value as JSONSchema7) : undefined;\n}\n\nfunction schemaType(schema: JSONSchema7 | undefined): JSONSchema7['type'] | undefined {\n const type = schema?.type;\n return Array.isArray(type) ? type.find(Boolean) : type;\n}\n\nfunction inferResponseShape(responseSchema: JSONSchema7 | undefined): ApiSchemaResponseShape {\n if (!responseSchema) return { kind: 'unknown' };\n\n const alternatives: unknown[] | undefined = responseSchema.anyOf ?? responseSchema.oneOf;\n if (alternatives?.length) {\n const shapes = alternatives.map(schema => inferResponseShape(asJsonSchema(schema)));\n const first = shapes[0]!;\n return shapes.every(\n shape =>\n shape.kind === first.kind &&\n shape.listProperty === first.listProperty &&\n shape.paginationProperty === first.paginationProperty,\n )\n ? first\n : { kind: 'single' };\n }\n\n const type = schemaType(responseSchema);\n if (type === 'array') return { kind: 'array' };\n if (type !== 'object') return { kind: 'single' };\n\n const properties =\n responseSchema.properties && !Array.isArray(responseSchema.properties) ? responseSchema.properties : {};\n const propertyNames = Object.keys(properties);\n const paginationProperty = 'page' in properties ? 'page' : 'pagination' in properties ? 'pagination' : undefined;\n const listProperty = Object.entries(properties).find(\n ([, property]) => schemaType(asJsonSchema(property)) === 'array',\n )?.[0];\n\n if (listProperty && (paginationProperty || propertyNames.length <= 2)) {\n return { kind: 'object-property', listProperty, paginationProperty };\n }\n if (responseSchema.additionalProperties && propertyNames.length === 0) return { kind: 'record' };\n return { kind: 'single' };\n}\n\n/** CLI flags cover all request variants; the endpoint still validates the selected variant. */\nexport function getApiSchemaPropertyNames(schema: JSONSchema7 | undefined): string[] {\n if (!schema) return [];\n const names = Object.keys(schema.properties ?? {});\n for (const branch of schema.anyOf ?? schema.oneOf ?? [])\n names.push(...getApiSchemaPropertyNames(asJsonSchema(branch)));\n return [...new Set(names)].sort();\n}\n\nfunction isManifestRoute(route: ServerRoute): boolean {\n return route.responseType === 'json' && !route.deprecated;\n}\n\nexport function buildApiSchemaManifest(routes: readonly ServerRoute[] = SERVER_ROUTES): ApiSchemaManifest {\n return {\n version: 1,\n routes: routes.filter(isManifestRoute).map(route => {\n const responseSchema = convertSchema(route.responseSchema);\n return {\n method: route.method,\n path: route.path,\n responseType: route.responseType,\n pathParamSchema: convertSchema(route.pathParamSchema),\n queryParamSchema: convertSchema(route.queryParamSchema),\n bodySchema: convertSchema(route.bodySchema),\n responseSchema,\n responseShape: inferResponseShape(responseSchema),\n };\n }),\n };\n}\n"],"mappings":";;;;AA2BA,SAAS,cAAc,QAA4D;CACjF,OAAO,SAASA,sBAAAA,mBAAmB,MAAM,IAAI,KAAA;AAC/C;AAEA,SAAS,aAAa,OAAyC;CAC7D,OAAO,SAAS,OAAO,UAAU,YAAY,CAAC,MAAM,QAAQ,KAAK,IAAK,QAAwB,KAAA;AAChG;AAEA,SAAS,WAAW,QAAkE;CACpF,MAAM,OAAO,QAAQ;CACrB,OAAO,MAAM,QAAQ,IAAI,IAAI,KAAK,KAAK,OAAO,IAAI;AACpD;AAEA,SAAS,mBAAmB,gBAAiE;CAC3F,IAAI,CAAC,gBAAgB,OAAO,EAAE,MAAM,UAAU;CAE9C,MAAM,eAAsC,eAAe,SAAS,eAAe;CACnF,IAAI,cAAc,QAAQ;EACxB,MAAM,SAAS,aAAa,KAA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AAM,UAAU;IAC1C;IACA,eAAe,mBAAmB,cAAc;GAClD;EACF,CAAC;CACH;AACF"}
|
package/dist/docs/SKILL.md
CHANGED
|
@@ -21,16 +21,17 @@ For hosted traces, see [Query observability data on Mastra Platform](https://mas
|
|
|
21
21
|
|
|
22
22
|
The configured observability store must support each API. Call `getObservabilityCapabilities()` or `GET /api/observability/capabilities` and check these flags before showing a feature:
|
|
23
23
|
|
|
24
|
-
| Capability
|
|
25
|
-
|
|
|
26
|
-
| `traceQuery`
|
|
27
|
-
| `traceAggregate`
|
|
28
|
-
| `traceQueryRootDuration`
|
|
29
|
-
| `traceQueryTimeToFirstChunk`
|
|
30
|
-
| `
|
|
31
|
-
| `
|
|
32
|
-
| `
|
|
33
|
-
| `
|
|
24
|
+
| Capability | Store feature | Enables |
|
|
25
|
+
| -------------------------------- | -------------------------------------- | -------------------------------------------------------------------------------------- |
|
|
26
|
+
| `traceQuery` | `trace-query` | `queryTraces()` |
|
|
27
|
+
| `traceAggregate` | `trace-aggregate` | `aggregateTraces()` |
|
|
28
|
+
| `traceQueryRootDuration` | `trace-query-root-duration` | Trace-scope `durationMs` predicates |
|
|
29
|
+
| `traceQueryTimeToFirstChunk` | `trace-query-time-to-first-chunk` | `timeToFirstChunkMs` predicates and results |
|
|
30
|
+
| `traceQueryTimeToFirstChunkSort` | `trace-query-time-to-first-chunk-sort` | `orderBy` on `timeToFirstChunkMs` |
|
|
31
|
+
| `traceQueryContextIds` | `trace-query-context-ids` | `runId`, `sessionId`, `userId`, and `organizationId` predicates |
|
|
32
|
+
| `traceQueryRootSpanFields` | `trace-query-root-span-fields` | Trace-scope `name` and `spanType` predicates, dimensions, and `countDistinct` measures |
|
|
33
|
+
| `traceQueryDiscovery` | `trace-query-discovery` | [Field and value discovery](#discover-fields-and-values) |
|
|
34
|
+
| `traceQueryTenantScope` | `trace-query-tenant-scope` | [Trusted tenant scope](#trusted-tenant-scope) |
|
|
34
35
|
|
|
35
36
|
A missing `traceAggregate` value means the server doesn't support aggregation. Servers without the aggregate route return `404`, and stores without the feature return `501 TRACE_AGGREGATE_UNSUPPORTED`. Against a store without a sub-feature, a request that uses a gated field returns `501` before storage runs. Root span `name` and `spanType` are the exception and return `422` with a `field_not_allowed` issue.
|
|
36
37
|
|
|
@@ -128,7 +129,13 @@ const slowFirstChunk = {
|
|
|
128
129
|
|
|
129
130
|
The value is `null` when the span didn't stream a chunk, for example a tool call or a workflow run. A `null` value counts as missing, so it matches `notExists` and never matches ordered predicates. A value of `0` isn't missing. It means the first chunk arrived in the same millisecond the span started.
|
|
130
131
|
|
|
131
|
-
Trace query results include the root span's `timeToFirstChunkMs`, and `querySpans()` results include each span's value.
|
|
132
|
+
Trace query results include the root span's `timeToFirstChunkMs`, and `querySpans()` results include each span's value. Stores advertise support through the `trace-query-time-to-first-chunk` feature, and the server reports it as the `traceQueryTimeToFirstChunk` capability. Against an older store, results omit the field, a predicate on it returns `501` before storage runs, and field discovery omits it.
|
|
133
|
+
|
|
134
|
+
#### Sort by time to first chunk
|
|
135
|
+
|
|
136
|
+
Pass `orderBy: [{ field: 'timeToFirstChunkMs', direction: 'desc' }]` to list the slowest first chunks first. Traces sort by the root span's value. Missing values sort last in both directions, and `0` sorts as a value. Ties break by `traceId` for traces and by span identity for `querySpans()`.
|
|
137
|
+
|
|
138
|
+
Stores advertise the sort through the `trace-query-time-to-first-chunk-sort` feature, and the server reports it as the `traceQueryTimeToFirstChunkSort` capability. Against an older store, the sort returns `501` before storage runs.
|
|
132
139
|
|
|
133
140
|
#### Filter by context identifiers
|
|
134
141
|
|
|
@@ -437,16 +444,16 @@ curl --request POST \
|
|
|
437
444
|
|
|
438
445
|
### Request fields
|
|
439
446
|
|
|
440
|
-
| Field | Required | Description
|
|
441
|
-
| ------------ | -------- |
|
|
442
|
-
| `timeRange` | Yes | Trace start-time boundary. `from` is inclusive and `to` is exclusive. Both values must be ISO timestamps, and `from` must be earlier than `to`.
|
|
443
|
-
| `where` | No | Recursive trace predicate. Supports scalar conditions and `spans.some` or `spans.none` clauses.
|
|
444
|
-
| `orderBy` | No | One item ordering results by `startedAt` or `
|
|
445
|
-
| `page` | No | `{ limit, after }`. `limit` defaults to 100 and has a maximum of 1000. Pass the opaque `page.next` value as `after`.
|
|
446
|
-
| `pagination` | No | Numbered pages: `{ page, perPage }`. Defaults to page 0 and 10 results. `perPage` has a maximum of 100.
|
|
447
|
-
| `mode` | No | Set to `'delta'` to poll using a delta cursor instead of `page` or `pagination`.
|
|
448
|
-
| `after` | No | Delta mode only. Opaque `deltaCursor` from a numbered page or previous poll. Omit to establish the current watermark.
|
|
449
|
-
| `limit` | No | Delta mode only. Maximum results per batch. Defaults to 10 and has a maximum of 100.
|
|
447
|
+
| Field | Required | Description |
|
|
448
|
+
| ------------ | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
449
|
+
| `timeRange` | Yes | Trace start-time boundary. `from` is inclusive and `to` is exclusive. Both values must be ISO timestamps, and `from` must be earlier than `to`. |
|
|
450
|
+
| `where` | No | Recursive trace predicate. Supports scalar conditions and `spans.some` or `spans.none` clauses. |
|
|
451
|
+
| `orderBy` | No | One item ordering results by `startedAt`, `endedAt`, or `timeToFirstChunkMs`, in `asc` or `desc` order. Defaults to `startedAt desc`. Not accepted in delta mode. |
|
|
452
|
+
| `page` | No | `{ limit, after }`. `limit` defaults to 100 and has a maximum of 1000. Pass the opaque `page.next` value as `after`. |
|
|
453
|
+
| `pagination` | No | Numbered pages: `{ page, perPage }`. Defaults to page 0 and 10 results. `perPage` has a maximum of 100. |
|
|
454
|
+
| `mode` | No | Set to `'delta'` to poll using a delta cursor instead of `page` or `pagination`. |
|
|
455
|
+
| `after` | No | Delta mode only. Opaque `deltaCursor` from a numbered page or previous poll. Omit to establish the current watermark. |
|
|
456
|
+
| `limit` | No | Delta mode only. Maximum results per batch. Defaults to 10 and has a maximum of 100. |
|
|
450
457
|
|
|
451
458
|
Unknown fields are rejected. Requests can't select a projection, declare joins, request counts or measures, or control authorization. Use [`aggregateTraces()`](#aggregate-traces) for counts and measures. Request bodies are limited to 256 KiB.
|
|
452
459
|
|
package/dist/{observability-new-endpoints-DMbbmOzO.js → observability-new-endpoints-7wGwP3se.js}
RENAMED
|
@@ -3,8 +3,8 @@ import { a as wrapSchemaForQueryParams, i as pickParams, n as createRoute } from
|
|
|
3
3
|
import { d as MASTRA_USER_ROLES_KEY, h as isStudioClientTypeHeader, l as MASTRA_USER_KEY } from "./constants-DazK_RZj.js";
|
|
4
4
|
import { handleError } from "./server/handlers/error.js";
|
|
5
5
|
import { paginationArgsSchema as paginationArgsSchema$1 } from "./server/handlers/observability-list-query-schemas.js";
|
|
6
|
-
import { NEW_ROUTE_DEFS, NO_OBSERVABILITY_STORAGE_CAPABILITIES, OBSERVABILITY_LIST_ENDPOINTS, OBSERVABILITY_TRACE_QUERY_TENANT_SCOPE_UPGRADE_MESSAGE, assertObservabilityDeltaSupported, assertObservabilitySpanQueryFieldsSupported, assertObservabilitySpanQuerySupported, assertObservabilityThreadQuerySupported, assertObservabilityTraceAggregateSupported, assertObservabilityTraceQueryContextIdsSupported, assertObservabilityTraceQueryDiscoverySupported, assertObservabilityTraceQueryRootDurationSupported, assertObservabilityTraceQueryRootSpanFieldsSupported, assertObservabilityTraceQueryRootSpanValuesSupported, assertObservabilityTraceQuerySupported, assertObservabilityTraceQueryTenantScopeSupported, assertObservabilityTraceQueryTimeToFirstChunkSupported, createObservabilityListQuerySchema, getObservabilityStorageCapabilities, getObservabilityStore, isTraceQueryContextIdField, isTraceQueryRootSpanField, supportsObservabilityTraceAggregate, supportsObservabilityTraceQueryContextIds, supportsObservabilityTraceQueryRootDuration, supportsObservabilityTraceQueryRootSpanFields, supportsObservabilityTraceQueryTimeToFirstChunk, supportsSpanQueryCore, supportsTraceAggregateCore, supportsTraceQueryDiscoveryCore, withDiscoveryFallback } from "./server/handlers/observability-shared.js";
|
|
7
|
-
import { l as observabilityStorageCapabilitiesSchema } from "./system-
|
|
6
|
+
import { NEW_ROUTE_DEFS, NO_OBSERVABILITY_STORAGE_CAPABILITIES, OBSERVABILITY_LIST_ENDPOINTS, OBSERVABILITY_TRACE_QUERY_TENANT_SCOPE_UPGRADE_MESSAGE, assertObservabilityDeltaSupported, assertObservabilitySpanQueryFieldsSupported, assertObservabilitySpanQuerySupported, assertObservabilityThreadQuerySupported, assertObservabilityTraceAggregateSupported, assertObservabilityTraceQueryContextIdsSupported, assertObservabilityTraceQueryDiscoverySupported, assertObservabilityTraceQueryRootDurationSupported, assertObservabilityTraceQueryRootSpanFieldsSupported, assertObservabilityTraceQueryRootSpanValuesSupported, assertObservabilityTraceQuerySupported, assertObservabilityTraceQueryTenantScopeSupported, assertObservabilityTraceQueryTimeToFirstChunkSortSupported, assertObservabilityTraceQueryTimeToFirstChunkSupported, createObservabilityListQuerySchema, getObservabilityStorageCapabilities, getObservabilityStore, isTraceQueryContextIdField, isTraceQueryRootSpanField, supportsObservabilityTraceAggregate, supportsObservabilityTraceQueryContextIds, supportsObservabilityTraceQueryRootDuration, supportsObservabilityTraceQueryRootSpanFields, supportsObservabilityTraceQueryTimeToFirstChunk, supportsSpanQueryCore, supportsTraceAggregateCore, supportsTraceQueryDiscoveryCore, withDiscoveryFallback } from "./server/handlers/observability-shared.js";
|
|
7
|
+
import { l as observabilityStorageCapabilitiesSchema } from "./system-BLcPGYXT.js";
|
|
8
8
|
import { prepareAuthorEnrichment } from "./server/handlers/author-enrichment.js";
|
|
9
9
|
import { getCallerPermissions } from "./server/handlers/authorship.js";
|
|
10
10
|
import { z } from "zod/v4";
|
|
@@ -1032,6 +1032,7 @@ const QUERY_TRACES = createNewRoute(NEW_ROUTE_DEFS.QUERY_TRACES, {
|
|
|
1032
1032
|
assertObservabilityTraceQueryContextIdsSupported(observabilityStore, plan.where);
|
|
1033
1033
|
assertObservabilityTraceQueryTimeToFirstChunkSupported(observabilityStore, plan.where);
|
|
1034
1034
|
assertObservabilityTraceQueryRootSpanFieldsSupported(observabilityStore, plan);
|
|
1035
|
+
assertObservabilityTraceQueryTimeToFirstChunkSortSupported(observabilityStore, plan.orderBy);
|
|
1035
1036
|
assertObservabilityTraceQueryTenantScopeSupported(observabilityStore, plan.scope);
|
|
1036
1037
|
if (plan.paginationMode === "delta" && !observabilityStore.getFeatures()?.includes("delta-polling")) throw new HTTPException(501, { message: "This storage provider does not support observability delta polling" });
|
|
1037
1038
|
} catch (error) {
|
|
@@ -1247,6 +1248,7 @@ const QUERY_SPANS = createNewRoute(NEW_ROUTE_DEFS.QUERY_SPANS, {
|
|
|
1247
1248
|
assertObservabilitySpanQuerySupported(observabilityStore);
|
|
1248
1249
|
assertObservabilitySpanQueryFieldsSupported(observabilityStore, plan.where);
|
|
1249
1250
|
assertObservabilityTraceQueryTimeToFirstChunkSupported(observabilityStore, plan.where);
|
|
1251
|
+
assertObservabilityTraceQueryTimeToFirstChunkSortSupported(observabilityStore, plan.orderBy);
|
|
1250
1252
|
assertObservabilityTraceQueryTenantScopeSupported(observabilityStore, plan.scope);
|
|
1251
1253
|
} catch (error) {
|
|
1252
1254
|
if (error instanceof coreStorage.TraceQueryValidationError) throwTraceQueryError(422, {
|
|
@@ -1970,4 +1972,4 @@ const NEW_ROUTES = {
|
|
|
1970
1972
|
//#endregion
|
|
1971
1973
|
export { LIST_FEEDBACK as A, GET_SCORE_BREAKDOWN as C, GET_TAGS as D, GET_SERVICE_NAMES as E, QUERY_SPANS as F, QUERY_THREADS as I, QUERY_TRACES as L, LIST_METRICS as M, LIST_SCORES as N, GET_TRACE_QUERY_FIELDS as O, NEW_ROUTES as P, UPDATE_FEEDBACK_REVIEW_STATUS as R, GET_SCORE_AGGREGATE as S, GET_SCORE_TIME_SERIES as T, GET_METRIC_LABEL_VALUES as _, DELETE_SCORES as a, GET_METRIC_TIME_SERIES as b, GET_ENTITY_TYPES as c, GET_FEEDBACK_BREAKDOWN as d, GET_FEEDBACK_PERCENTILES as f, GET_METRIC_LABEL_KEYS as g, GET_METRIC_BREAKDOWN as h, DELETE_FEEDBACK as i, LIST_LOGS as j, GET_TRACE_QUERY_VALUES as k, GET_ENVIRONMENTS as l, GET_METRIC_AGGREGATE as m, CREATE_FEEDBACK as n, GET_CAPABILITIES as o, GET_FEEDBACK_TIME_SERIES as p, CREATE_SCORE as r, GET_ENTITY_NAMES as s, AGGREGATE_TRACES as t, GET_FEEDBACK_AGGREGATE as u, GET_METRIC_NAMES as v, GET_SCORE_PERCENTILES as w, GET_SCORE as x, GET_METRIC_PERCENTILES as y };
|
|
1972
1974
|
|
|
1973
|
-
//# sourceMappingURL=observability-new-endpoints-
|
|
1975
|
+
//# sourceMappingURL=observability-new-endpoints-7wGwP3se.js.map
|