@mastra/client-js 1.42.0 → 1.42.1-alpha.10
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 +81 -0
- package/dist/client.d.ts +1 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/docs/SKILL.md +2 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/docs/references/reference-observability-metrics-queries.md +462 -0
- package/dist/index.cjs +1 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/resources/agent-controller.d.ts.map +1 -1
- package/dist/route-types.generated.d.ts +13 -0
- package/dist/route-types.generated.d.ts.map +1 -1
- package/dist/types.d.ts +1 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +4 -4
|
@@ -0,0 +1,462 @@
|
|
|
1
|
+
> Discover all available pages from the documentation index: https://mastra.ai/llms.txt
|
|
2
|
+
|
|
3
|
+
# Metric queries
|
|
4
|
+
|
|
5
|
+
Metric queries read raw and aggregated metric data from the observability storage domain. For exporter and storage setup, see the [Metrics overview](https://mastra.ai/docs/observability/metrics/overview). For automatic metric names and labels, see the [Automatic metrics reference](https://mastra.ai/reference/observability/metrics/automatic-metrics).
|
|
6
|
+
|
|
7
|
+
## Access
|
|
8
|
+
|
|
9
|
+
### Observability store
|
|
10
|
+
|
|
11
|
+
Use the storage domain for in-process queries:
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
const observability = await mastra.getStorage()?.getStore('observability')
|
|
15
|
+
|
|
16
|
+
if (!observability) {
|
|
17
|
+
throw new Error('Observability storage is not configured')
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const result = await observability.getMetricAggregate({
|
|
21
|
+
name: ['mastra_agent_duration_ms'],
|
|
22
|
+
aggregation: 'avg',
|
|
23
|
+
filters: {
|
|
24
|
+
timestamp: { start: new Date(Date.now() - 60 * 60 * 1000) },
|
|
25
|
+
},
|
|
26
|
+
})
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
`getStore('observability')` returns `undefined` when the storage configuration doesn't provide the observability domain.
|
|
30
|
+
|
|
31
|
+
### Client SDK
|
|
32
|
+
|
|
33
|
+
`@mastra/client-js` exposes the analytics and metric discovery methods on `MastraClient`:
|
|
34
|
+
|
|
35
|
+
```typescript
|
|
36
|
+
import { MastraClient } from '@mastra/client-js'
|
|
37
|
+
|
|
38
|
+
const client = new MastraClient({
|
|
39
|
+
baseUrl: 'http://localhost:4111',
|
|
40
|
+
})
|
|
41
|
+
|
|
42
|
+
const result = await client.getMetricAggregate({
|
|
43
|
+
name: ['mastra_agent_duration_ms'],
|
|
44
|
+
aggregation: 'avg',
|
|
45
|
+
})
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
The client doesn't expose a raw `listMetrics()` method. Use the observability store or the `GET /api/observability/metrics` route to list raw metric records.
|
|
49
|
+
|
|
50
|
+
## Shared values
|
|
51
|
+
|
|
52
|
+
### Aggregations
|
|
53
|
+
|
|
54
|
+
The aggregate, breakdown, and time-series methods accept these `aggregation` values:
|
|
55
|
+
|
|
56
|
+
| Value | Result |
|
|
57
|
+
| ---------------- | ---------------------------------------------------------------------------------------------------- |
|
|
58
|
+
| `sum` | Sum of metric values |
|
|
59
|
+
| `avg` | Average metric value |
|
|
60
|
+
| `min` | Minimum metric value |
|
|
61
|
+
| `max` | Maximum metric value |
|
|
62
|
+
| `count` | Number of matching metric records |
|
|
63
|
+
| `count_distinct` | Approximate or exact number of distinct values in `distinctColumn`, depending on the storage backend |
|
|
64
|
+
| `last` | Most recent matching metric value |
|
|
65
|
+
|
|
66
|
+
When `aggregation` is `count_distinct`, `distinctColumn` is required. Supported columns are:
|
|
67
|
+
|
|
68
|
+
```text
|
|
69
|
+
entityType
|
|
70
|
+
entityName
|
|
71
|
+
parentEntityType
|
|
72
|
+
parentEntityName
|
|
73
|
+
rootEntityType
|
|
74
|
+
rootEntityName
|
|
75
|
+
name
|
|
76
|
+
provider
|
|
77
|
+
model
|
|
78
|
+
environment
|
|
79
|
+
executionSource
|
|
80
|
+
serviceName
|
|
81
|
+
threadId
|
|
82
|
+
resourceId
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### Intervals
|
|
86
|
+
|
|
87
|
+
Time-series and percentile queries accept `1m`, `5m`, `15m`, `1h`, or `1d`.
|
|
88
|
+
|
|
89
|
+
### Filters
|
|
90
|
+
|
|
91
|
+
All metric operations accept the same optional `filters` object. Raw list requests pass these fields as query parameters. Analytics methods pass them in the JSON request body.
|
|
92
|
+
|
|
93
|
+
| Field | Type | Description |
|
|
94
|
+
| ----------------------- | -------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- |
|
|
95
|
+
| `timestamp` | `{ start?: Date; end?: Date; startExclusive?: boolean; endExclusive?: boolean }` | Timestamp range. Boundaries are inclusive unless their corresponding exclusive flag is `true`. HTTP requests use ISO date strings. |
|
|
96
|
+
| `traceId` | `string` | Exact trace ID |
|
|
97
|
+
| `traceIds` | `string[]` | One to 1,000 trace IDs |
|
|
98
|
+
| `spanId` | `string` | Exact span ID |
|
|
99
|
+
| `entityType` | `EntityType` | Entity type |
|
|
100
|
+
| `entityName` | `string` | Entity name |
|
|
101
|
+
| `entityVersionId` | `string` | Entity version ID |
|
|
102
|
+
| `parentEntityType` | `EntityType` | Parent entity type |
|
|
103
|
+
| `parentEntityName` | `string` | Parent entity name |
|
|
104
|
+
| `parentEntityVersionId` | `string` | Parent entity version ID |
|
|
105
|
+
| `rootEntityType` | `EntityType` | Root entity type |
|
|
106
|
+
| `rootEntityName` | `string` | Root entity name |
|
|
107
|
+
| `rootEntityVersionId` | `string` | Root entity version ID |
|
|
108
|
+
| `userId` | `string` | User ID |
|
|
109
|
+
| `organizationId` | `string` | Organization ID |
|
|
110
|
+
| `experimentId` | `string` | Experiment or evaluation run ID |
|
|
111
|
+
| `serviceName` | `string` | Service name |
|
|
112
|
+
| `environment` | `string` | Environment name |
|
|
113
|
+
| `resourceId` | `string` | Resource ID |
|
|
114
|
+
| `runId` | `string` | Run ID |
|
|
115
|
+
| `sessionId` | `string` | Session ID |
|
|
116
|
+
| `threadId` | `string` | Thread ID |
|
|
117
|
+
| `requestId` | `string` | Request ID |
|
|
118
|
+
| `executionSource` | `string` | Execution source |
|
|
119
|
+
| `tags` | `string[]` | Records must contain all specified tags |
|
|
120
|
+
| `name` | `string[]` | One or more metric names |
|
|
121
|
+
| `provider` | `string` | Model provider |
|
|
122
|
+
| `model` | `string` | Model ID |
|
|
123
|
+
| `costUnit` | `string` | Cost unit |
|
|
124
|
+
| `labels` | `Record<string, string>` | Exact matches for all specified metric label key-value pairs |
|
|
125
|
+
| `source` | `string` | Deprecated. Use `executionSource`. |
|
|
126
|
+
|
|
127
|
+
## Analytics methods
|
|
128
|
+
|
|
129
|
+
### `getMetricAggregate(args)`
|
|
130
|
+
|
|
131
|
+
Returns one value across all matching records. The observability store and `MastraClient` expose this method.
|
|
132
|
+
|
|
133
|
+
#### Arguments
|
|
134
|
+
|
|
135
|
+
| Field | Type | Required | Description |
|
|
136
|
+
| ---------------- | -------------------------------------------------------- | -------------------- | ------------------------------------------------------------------------------------------ |
|
|
137
|
+
| `name` | `string[]` | Yes | One or more metric names |
|
|
138
|
+
| `aggregation` | `AggregationType` | Yes | Aggregation to apply |
|
|
139
|
+
| `distinctColumn` | `MetricDistinctColumn` | For `count_distinct` | Column whose distinct values are counted |
|
|
140
|
+
| `filters` | `MetricsFilter` | No | Shared metric filters |
|
|
141
|
+
| `comparePeriod` | `'previous_period' \| 'previous_day' \| 'previous_week'` | No | Adds comparison-period values. `previous_period` uses the duration of `filters.timestamp`. |
|
|
142
|
+
|
|
143
|
+
#### Returns
|
|
144
|
+
|
|
145
|
+
```typescript
|
|
146
|
+
{
|
|
147
|
+
value: number | null
|
|
148
|
+
previousValue?: number | null
|
|
149
|
+
changePercent?: number | null
|
|
150
|
+
estimatedCost?: number | null
|
|
151
|
+
costUnit?: string | null
|
|
152
|
+
previousEstimatedCost?: number | null
|
|
153
|
+
costChangePercent?: number | null
|
|
154
|
+
}
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
`costUnit` is `null` when the matching records don't have one shared unit. Cost fields are optional and may be `null` when the records don't include cost context.
|
|
158
|
+
|
|
159
|
+
```typescript
|
|
160
|
+
const result = await observability.getMetricAggregate({
|
|
161
|
+
name: ['mastra_model_total_input_tokens', 'mastra_model_total_output_tokens'],
|
|
162
|
+
aggregation: 'sum',
|
|
163
|
+
filters: {
|
|
164
|
+
timestamp: {
|
|
165
|
+
start: new Date('2026-08-24T00:00:00Z'),
|
|
166
|
+
end: new Date('2026-08-25T00:00:00Z'),
|
|
167
|
+
},
|
|
168
|
+
},
|
|
169
|
+
comparePeriod: 'previous_period',
|
|
170
|
+
})
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
**HTTP:** `POST /api/observability/metrics/aggregate`
|
|
174
|
+
|
|
175
|
+
### `getMetricBreakdown(args)`
|
|
176
|
+
|
|
177
|
+
Groups matching records by one or more dimensions and aggregates each group. The observability store and `MastraClient` expose this method.
|
|
178
|
+
|
|
179
|
+
#### Arguments
|
|
180
|
+
|
|
181
|
+
| Field | Type | Required | Description |
|
|
182
|
+
| ---------------- | ---------------------- | -------------------- | ----------------------------------------------------------------------------------- |
|
|
183
|
+
| `name` | `string[]` | Yes | One or more metric names |
|
|
184
|
+
| `groupBy` | `string[]` | Yes | One or more fields to group by |
|
|
185
|
+
| `aggregation` | `AggregationType` | Yes | Aggregation for each group |
|
|
186
|
+
| `distinctColumn` | `MetricDistinctColumn` | For `count_distinct` | Column whose distinct values are counted |
|
|
187
|
+
| `filters` | `MetricsFilter` | No | Shared metric filters |
|
|
188
|
+
| `limit` | `number` | No | Positive integer up to 1,000. Required for high-cardinality groupings. |
|
|
189
|
+
| `orderDirection` | `'ASC' \| 'DESC'` | No | Sort direction for the aggregated value. Storage implementations default to `DESC`. |
|
|
190
|
+
|
|
191
|
+
#### Returns
|
|
192
|
+
|
|
193
|
+
```typescript
|
|
194
|
+
{
|
|
195
|
+
groups: Array<{
|
|
196
|
+
dimensions: Record<string, string | null>
|
|
197
|
+
value: number
|
|
198
|
+
estimatedCost?: number | null
|
|
199
|
+
costUnit?: string | null
|
|
200
|
+
}>
|
|
201
|
+
}
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
```typescript
|
|
205
|
+
const result = await client.getMetricBreakdown({
|
|
206
|
+
name: ['mastra_model_total_input_tokens'],
|
|
207
|
+
groupBy: ['entityName'],
|
|
208
|
+
aggregation: 'sum',
|
|
209
|
+
limit: 10,
|
|
210
|
+
orderDirection: 'DESC',
|
|
211
|
+
})
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
**HTTP:** `POST /api/observability/metrics/breakdown`
|
|
215
|
+
|
|
216
|
+
### `getMetricTimeSeries(args)`
|
|
217
|
+
|
|
218
|
+
Buckets matching values by time interval, with optional grouping. The observability store and `MastraClient` expose this method.
|
|
219
|
+
|
|
220
|
+
#### Arguments
|
|
221
|
+
|
|
222
|
+
| Field | Type | Required | Description |
|
|
223
|
+
| ---------------- | ---------------------- | -------------------- | ------------------------------------------- |
|
|
224
|
+
| `name` | `string[]` | Yes | One or more metric names |
|
|
225
|
+
| `interval` | `AggregationInterval` | Yes | Time bucket interval |
|
|
226
|
+
| `aggregation` | `AggregationType` | Yes | Aggregation for each bucket |
|
|
227
|
+
| `distinctColumn` | `MetricDistinctColumn` | For `count_distinct` | Column whose distinct values are counted |
|
|
228
|
+
| `filters` | `MetricsFilter` | No | Shared metric filters |
|
|
229
|
+
| `groupBy` | `string[]` | No | Fields used to split the result into series |
|
|
230
|
+
|
|
231
|
+
#### Returns
|
|
232
|
+
|
|
233
|
+
```typescript
|
|
234
|
+
{
|
|
235
|
+
series: Array<{
|
|
236
|
+
name: string
|
|
237
|
+
costUnit?: string | null
|
|
238
|
+
points: Array<{
|
|
239
|
+
timestamp: Date
|
|
240
|
+
value: number
|
|
241
|
+
estimatedCost?: number | null
|
|
242
|
+
}>
|
|
243
|
+
}>
|
|
244
|
+
}
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
```typescript
|
|
248
|
+
const result = await client.getMetricTimeSeries({
|
|
249
|
+
name: ['mastra_model_total_input_tokens'],
|
|
250
|
+
interval: '1h',
|
|
251
|
+
aggregation: 'sum',
|
|
252
|
+
filters: {
|
|
253
|
+
timestamp: { start: new Date(Date.now() - 24 * 60 * 60 * 1000) },
|
|
254
|
+
},
|
|
255
|
+
})
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
**HTTP:** `POST /api/observability/metrics/timeseries`
|
|
259
|
+
|
|
260
|
+
### `getMetricPercentiles(args)`
|
|
261
|
+
|
|
262
|
+
Calculates percentile values in time buckets. The observability store and `MastraClient` expose this method.
|
|
263
|
+
|
|
264
|
+
#### Arguments
|
|
265
|
+
|
|
266
|
+
| Field | Type | Required | Description |
|
|
267
|
+
| ------------- | --------------------- | -------- | --------------------------------------- |
|
|
268
|
+
| `name` | `string` | Yes | One metric name |
|
|
269
|
+
| `percentiles` | `number[]` | Yes | One or more values from `0` through `1` |
|
|
270
|
+
| `interval` | `AggregationInterval` | Yes | Time bucket interval |
|
|
271
|
+
| `filters` | `MetricsFilter` | No | Shared metric filters |
|
|
272
|
+
|
|
273
|
+
#### Returns
|
|
274
|
+
|
|
275
|
+
```typescript
|
|
276
|
+
{
|
|
277
|
+
series: Array<{
|
|
278
|
+
percentile: number
|
|
279
|
+
points: Array<{
|
|
280
|
+
timestamp: Date
|
|
281
|
+
value: number
|
|
282
|
+
}>
|
|
283
|
+
}>
|
|
284
|
+
}
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
```typescript
|
|
288
|
+
const result = await client.getMetricPercentiles({
|
|
289
|
+
name: 'mastra_agent_duration_ms',
|
|
290
|
+
percentiles: [0.5, 0.95, 0.99],
|
|
291
|
+
interval: '1h',
|
|
292
|
+
})
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
**HTTP:** `POST /api/observability/metrics/percentiles`
|
|
296
|
+
|
|
297
|
+
## Raw metric records
|
|
298
|
+
|
|
299
|
+
### `listMetrics(args)`
|
|
300
|
+
|
|
301
|
+
Returns stored metric observations without aggregating them. This method is available on the observability store. The HTTP route accepts the same fields as query parameters.
|
|
302
|
+
|
|
303
|
+
#### Arguments
|
|
304
|
+
|
|
305
|
+
Page mode is the default:
|
|
306
|
+
|
|
307
|
+
```typescript
|
|
308
|
+
{
|
|
309
|
+
mode?: 'page'
|
|
310
|
+
filters?: MetricsFilter
|
|
311
|
+
pagination?: {
|
|
312
|
+
page?: number // Default: 0
|
|
313
|
+
perPage?: number // Default: 10; maximum: 100
|
|
314
|
+
}
|
|
315
|
+
orderBy?: {
|
|
316
|
+
field?: 'timestamp' // Default: 'timestamp'
|
|
317
|
+
direction?: 'ASC' | 'DESC' // Default: 'DESC'
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
Delta mode supports incremental polling:
|
|
323
|
+
|
|
324
|
+
```typescript
|
|
325
|
+
{
|
|
326
|
+
mode: 'delta'
|
|
327
|
+
filters?: MetricsFilter
|
|
328
|
+
after?: string
|
|
329
|
+
limit?: number // Default: 10; maximum: 100
|
|
330
|
+
}
|
|
331
|
+
```
|
|
332
|
+
|
|
333
|
+
`pagination` and `orderBy` aren't allowed in delta mode. `after` and `limit` aren't allowed in page mode. A backend that doesn't support delta polling returns an unsupported-operation error.
|
|
334
|
+
|
|
335
|
+
#### Returns
|
|
336
|
+
|
|
337
|
+
```typescript
|
|
338
|
+
{
|
|
339
|
+
metrics: MetricRecord[]
|
|
340
|
+
pagination?: {
|
|
341
|
+
total: number
|
|
342
|
+
page: number
|
|
343
|
+
perPage: number | false
|
|
344
|
+
hasMore: boolean
|
|
345
|
+
}
|
|
346
|
+
delta?: {
|
|
347
|
+
limit: number
|
|
348
|
+
hasMore: boolean
|
|
349
|
+
}
|
|
350
|
+
deltaCursor?: string
|
|
351
|
+
}
|
|
352
|
+
```
|
|
353
|
+
|
|
354
|
+
A `MetricRecord` has this shape:
|
|
355
|
+
|
|
356
|
+
```typescript
|
|
357
|
+
{
|
|
358
|
+
metricId?: string | null
|
|
359
|
+
timestamp: Date
|
|
360
|
+
name: string
|
|
361
|
+
value: number
|
|
362
|
+
traceId?: string | null
|
|
363
|
+
spanId?: string | null
|
|
364
|
+
entityType?: EntityType | null
|
|
365
|
+
entityId?: string | null
|
|
366
|
+
entityName?: string | null
|
|
367
|
+
parentEntityType?: EntityType | null
|
|
368
|
+
parentEntityId?: string | null
|
|
369
|
+
parentEntityName?: string | null
|
|
370
|
+
rootEntityType?: EntityType | null
|
|
371
|
+
rootEntityId?: string | null
|
|
372
|
+
rootEntityName?: string | null
|
|
373
|
+
userId?: string | null
|
|
374
|
+
organizationId?: string | null
|
|
375
|
+
resourceId?: string | null
|
|
376
|
+
runId?: string | null
|
|
377
|
+
sessionId?: string | null
|
|
378
|
+
threadId?: string | null
|
|
379
|
+
requestId?: string | null
|
|
380
|
+
environment?: string | null
|
|
381
|
+
serviceName?: string | null
|
|
382
|
+
scope?: Record<string, unknown> | null
|
|
383
|
+
entityVersionId?: string | null
|
|
384
|
+
parentEntityVersionId?: string | null
|
|
385
|
+
rootEntityVersionId?: string | null
|
|
386
|
+
experimentId?: string | null
|
|
387
|
+
executionSource?: string | null
|
|
388
|
+
tags?: string[] | null
|
|
389
|
+
source?: string | null // Deprecated
|
|
390
|
+
provider?: string | null
|
|
391
|
+
model?: string | null
|
|
392
|
+
estimatedCost?: number | null
|
|
393
|
+
costUnit?: string | null
|
|
394
|
+
costMetadata?: Record<string, unknown> | null
|
|
395
|
+
labels: Record<string, string>
|
|
396
|
+
metadata?: Record<string, unknown> | null
|
|
397
|
+
}
|
|
398
|
+
```
|
|
399
|
+
|
|
400
|
+
**HTTP:** `GET /api/observability/metrics`
|
|
401
|
+
|
|
402
|
+
## Metric discovery
|
|
403
|
+
|
|
404
|
+
The observability store and `MastraClient` expose the metric discovery methods. HTTP requests pass arguments as query parameters.
|
|
405
|
+
|
|
406
|
+
| Method | Arguments | Returns | HTTP route |
|
|
407
|
+
| ---------------------------- | --------------------------------------------------------------------------- | ---------------------- | ------------------------------------------------------ |
|
|
408
|
+
| `getMetricNames(args?)` | `{ prefix?: string; limit?: number }` | `{ names: string[] }` | `GET /api/observability/discovery/metric-names` |
|
|
409
|
+
| `getMetricLabelKeys(args)` | `{ metricName: string }` | `{ keys: string[] }` | `GET /api/observability/discovery/metric-label-keys` |
|
|
410
|
+
| `getMetricLabelValues(args)` | `{ metricName: string; labelKey: string; prefix?: string; limit?: number }` | `{ values: string[] }` | `GET /api/observability/discovery/metric-label-values` |
|
|
411
|
+
|
|
412
|
+
`limit` must be a positive integer when provided.
|
|
413
|
+
|
|
414
|
+
```typescript
|
|
415
|
+
const { names } = await client.getMetricNames({ prefix: 'mastra_model_' })
|
|
416
|
+
const { keys } = await client.getMetricLabelKeys({ metricName: names[0] })
|
|
417
|
+
const { values } = await client.getMetricLabelValues({
|
|
418
|
+
metricName: names[0],
|
|
419
|
+
labelKey: keys[0],
|
|
420
|
+
limit: 20,
|
|
421
|
+
})
|
|
422
|
+
```
|
|
423
|
+
|
|
424
|
+
The observability discovery API also exposes shared dimensions used by traces, logs, and metrics:
|
|
425
|
+
|
|
426
|
+
| Store or client method | Arguments | HTTP route |
|
|
427
|
+
| ----------------------- | ----------------------------------------- | ------------------------------------------------ |
|
|
428
|
+
| `getEntityTypes()` | None in `MastraClient`; `{}` in the store | `GET /api/observability/discovery/entity-types` |
|
|
429
|
+
| `getEntityNames(args?)` | `{ entityType?: EntityType }` | `GET /api/observability/discovery/entity-names` |
|
|
430
|
+
| `getServiceNames()` | None in `MastraClient`; `{}` in the store | `GET /api/observability/discovery/service-names` |
|
|
431
|
+
| `getEnvironments()` | None in `MastraClient`; `{}` in the store | `GET /api/observability/discovery/environments` |
|
|
432
|
+
| `getTags(args?)` | `{ entityType?: EntityType }` | `GET /api/observability/discovery/tags` |
|
|
433
|
+
|
|
434
|
+
## HTTP routes
|
|
435
|
+
|
|
436
|
+
| Method | Route | Input |
|
|
437
|
+
| ------ | -------------------------------------------------- | ---------------- |
|
|
438
|
+
| `GET` | `/api/observability/metrics` | Query parameters |
|
|
439
|
+
| `POST` | `/api/observability/metrics/aggregate` | JSON body |
|
|
440
|
+
| `POST` | `/api/observability/metrics/breakdown` | JSON body |
|
|
441
|
+
| `POST` | `/api/observability/metrics/timeseries` | JSON body |
|
|
442
|
+
| `POST` | `/api/observability/metrics/percentiles` | JSON body |
|
|
443
|
+
| `GET` | `/api/observability/discovery/metric-names` | Query parameters |
|
|
444
|
+
| `GET` | `/api/observability/discovery/metric-label-keys` | Query parameters |
|
|
445
|
+
| `GET` | `/api/observability/discovery/metric-label-values` | Query parameters |
|
|
446
|
+
| `GET` | `/api/observability/discovery/entity-types` | None |
|
|
447
|
+
| `GET` | `/api/observability/discovery/entity-names` | Query parameters |
|
|
448
|
+
| `GET` | `/api/observability/discovery/service-names` | None |
|
|
449
|
+
| `GET` | `/api/observability/discovery/environments` | None |
|
|
450
|
+
| `GET` | `/api/observability/discovery/tags` | Query parameters |
|
|
451
|
+
|
|
452
|
+
All routes require a configured observability domain. The aggregate, breakdown, time-series, and percentile routes require the `observability:read` permission when runtime authorization is enabled.
|
|
453
|
+
|
|
454
|
+
## Unsupported backends
|
|
455
|
+
|
|
456
|
+
The base observability storage implementation throws `*_NOT_IMPLEMENTED` errors for raw listing, analytics, and discovery methods. A configured observability domain can therefore exist while its backend doesn't implement metric queries.
|
|
457
|
+
|
|
458
|
+
DuckDB, ClickHouse, Postgres v-next observability storage, and in-memory observability storage implement metric queries. Google Cloud Spanner implements them only when `disableMetrics` is `false`. Metrics are disabled by default. Other storage adapters may support tracing without supporting metrics.
|
|
459
|
+
|
|
460
|
+
## CLI
|
|
461
|
+
|
|
462
|
+
The `mastra api metric` commands cover aggregate, breakdown, time-series, percentile, metric-name, label-key, and label-value queries. See the [`mastra api metric` CLI reference](https://mastra.ai/reference/cli/mastra) for commands, targeting, authentication, and schema inspection.
|
package/dist/index.cjs
CHANGED
|
@@ -5689,6 +5689,7 @@ const KNOWN_AGENT_CONTROLLER_EVENT_TYPES = new Set(Object.keys({
|
|
|
5689
5689
|
thread_changed: true,
|
|
5690
5690
|
thread_created: true,
|
|
5691
5691
|
thread_deleted: true,
|
|
5692
|
+
thread_title_updated: true,
|
|
5692
5693
|
subagent_start: true,
|
|
5693
5694
|
subagent_text_delta: true,
|
|
5694
5695
|
subagent_tool_start: true,
|