mastra-ai/mastra · error · MastraError
OBSERVABILITY_STORAGE_GET_METRIC_BREAKDOWN_NOT_IMPLEMENTED
OBSERVABILITY_STORAGE_GET_METRIC_BREAKDOWN_NOT_IMPLEMENTED
Error message
This storage provider does not support metric breakdown
What it means
MastraError OBSERVABILITY_STORAGE_GET_METRIC_BREAKDOWN_NOT_IMPLEMENTED is thrown by the default getMetricBreakdown() in the observability storage base class (packages/core/src/storage/domains/observability/base.ts:459). It means the configured storage provider cannot group a metric by label/dimension values. Like the other observability methods, the base implementation always throws so unsupported adapters surface a clear capability error.
Source
Thrown at packages/core/src/storage/domains/observability/base.ts:459
throw new MastraError({
id: 'OBSERVABILITY_STORAGE_LIST_METRICS_NOT_IMPLEMENTED',
domain: ErrorDomain.MASTRA_OBSERVABILITY,
category: ErrorCategory.SYSTEM,
text: 'This storage provider does not support listing metrics',
});
}
async getMetricAggregate(_args: GetMetricAggregateArgs): Promise<GetMetricAggregateResponse> {
throw new MastraError({
id: 'OBSERVABILITY_STORAGE_GET_METRIC_AGGREGATE_NOT_IMPLEMENTED',
domain: ErrorDomain.MASTRA_OBSERVABILITY,
category: ErrorCategory.SYSTEM,
text: 'This storage provider does not support metric aggregation',
});
}
async getMetricBreakdown(_args: GetMetricBreakdownArgs): Promise<GetMetricBreakdownResponse> {
throw new MastraError({
id: 'OBSERVABILITY_STORAGE_GET_METRIC_BREAKDOWN_NOT_IMPLEMENTED',
domain: ErrorDomain.MASTRA_OBSERVABILITY,
category: ErrorCategory.SYSTEM,
text: 'This storage provider does not support metric breakdown',
});
}
async getMetricTimeSeries(_args: GetMetricTimeSeriesArgs): Promise<GetMetricTimeSeriesResponse> {
throw new MastraError({
id: 'OBSERVABILITY_STORAGE_GET_METRIC_TIME_SERIES_NOT_IMPLEMENTED',
domain: ErrorDomain.MASTRA_OBSERVABILITY,
category: ErrorCategory.SYSTEM,
text: 'This storage provider does not support metric time series',
});
}
async getMetricPercentiles(_args: GetMetricPercentilesArgs): Promise<GetMetricPercentilesResponse> {
throw new MastraError({View on GitHub (pinned to 75dd419e61)
Solutions
- Switch to or upgrade to a storage adapter implementing the metric breakdown capability (e.g. latest PostgreSQL/upstash adapters).
- If the breakdown comes from a dashboard/Studio view you don't control, either point the server at a metrics-capable store or remove the breakdown widget.
- For custom adapters, implement getMetricBreakdown (group by the requested label keys) or return an empty response explicitly.
- Feature-detect support before calling: compare the method against MastraStorage.prototype.getMetricBreakdown.
Example fix
// before
const rows = await storage.getMetricBreakdown({ metricName: 'llm_latency', groupBy: 'model' }); // throws
// after
const rows = supportsMetricBreakdown(storage)
? await storage.getMetricBreakdown({ metricName: 'llm_latency', groupBy: 'model' })
: []; Defensive patterns
Strategy: fallback
Validate before calling
import { MastraStorage } from '@mastra/core/storage';
function supportsMetricBreakdown(storage: unknown): boolean {
return (
storage instanceof MastraStorage &&
(storage as MastraStorage).getMetricBreakdown !== MastraStorage.prototype.getMetricBreakdown
);
}
if (!supportsMetricBreakdown(storage)) {
console.warn('Metric breakdown unsupported by this storage adapter');
} Type guard
function supportsMetricBreakdown(s: unknown): s is MastraStorage & { getMetricBreakdown: (a: GetMetricBreakdownArgs) => Promise<GetMetricBreakdownResponse> } {
return s instanceof MastraStorage && s.getMetricBreakdown !== MastraStorage.prototype.getMetricBreakdown;
} Try / catch
import { MastraError } from '@mastra/core/error';
try {
const rows = await storage.getMetricBreakdown(args);
} catch (err) {
if (err instanceof MastraError && err.id === 'OBSERVABILITY_STORAGE_GET_METRIC_BREAKDOWN_NOT_IMPLEMENTED') {
const rows = []; // show empty breakdown instead of throwing
} else {
throw err;
}
} Prevention
- Confirm breakdown (group-by-label) support in the adapter docs before exposing group-by UI.
- Upgrade the storage adapter when core adds new observability query methods.
- In custom MastraStorage subclasses, implement getMetricBreakdown or explicitly document it as unsupported.
- Probe capabilities at startup and disable breakdown-dependent features.
- Add a focused test asserting getMetricBreakdown behavior for your adapter.
When it happens
Trigger: Calling getMetricBreakdown(args) (group metric by labels, e.g. per-agent or per-model breakdown) on a storage adapter that has not overridden the method.
Common situations: Viewing per-label metric breakdowns in Studio while connected to a minimal adapter; a custom storage adapter omits getMetricBreakdown; core/storage package version mismatch after breakdown support was introduced.
Related errors
- OBSERVABILITY_STORAGE_BATCH_CREATE_METRICS_NOT_IMPLEMENTED
- OBSERVABILITY_STORAGE_LIST_METRICS_NOT_IMPLEMENTED
- OBSERVABILITY_STORAGE_GET_METRIC_AGGREGATE_NOT_IMPLEMENTED
- OBSERVABILITY_STORAGE_GET_METRIC_TIME_SERIES_NOT_IMPLEMENTED
- OBSERVABILITY_STORAGE_GET_METRIC_PERCENTILES_NOT_IMPLEMENTED
AI-assisted analysis of mastra-ai/mastra@75dd419e61 (2026-08-30).
Data as JSON: /api/errors/440982128ea8b80d.
Report an issue: GitHub.