{"record":{"id":"440982128ea8b80d","repo":"mastra-ai/mastra","slug":"observability-storage-get-metric-breakdown-not-imp","errorCode":"OBSERVABILITY_STORAGE_GET_METRIC_BREAKDOWN_NOT_IMPLEMENTED","errorMessage":"This storage provider does not support metric breakdown","messagePattern":"This storage provider does not support metric breakdown","errorType":"error_code","errorClass":"MastraError","httpStatus":null,"severity":"error","filePath":"packages/core/src/storage/domains/observability/base.ts","lineNumber":459,"sourceCode":"    throw new MastraError({\n      id: 'OBSERVABILITY_STORAGE_LIST_METRICS_NOT_IMPLEMENTED',\n      domain: ErrorDomain.MASTRA_OBSERVABILITY,\n      category: ErrorCategory.SYSTEM,\n      text: 'This storage provider does not support listing metrics',\n    });\n  }\n\n  async getMetricAggregate(_args: GetMetricAggregateArgs): Promise<GetMetricAggregateResponse> {\n    throw new MastraError({\n      id: 'OBSERVABILITY_STORAGE_GET_METRIC_AGGREGATE_NOT_IMPLEMENTED',\n      domain: ErrorDomain.MASTRA_OBSERVABILITY,\n      category: ErrorCategory.SYSTEM,\n      text: 'This storage provider does not support metric aggregation',\n    });\n  }\n\n  async getMetricBreakdown(_args: GetMetricBreakdownArgs): Promise<GetMetricBreakdownResponse> {\n    throw new MastraError({\n      id: 'OBSERVABILITY_STORAGE_GET_METRIC_BREAKDOWN_NOT_IMPLEMENTED',\n      domain: ErrorDomain.MASTRA_OBSERVABILITY,\n      category: ErrorCategory.SYSTEM,\n      text: 'This storage provider does not support metric breakdown',\n    });\n  }\n\n  async getMetricTimeSeries(_args: GetMetricTimeSeriesArgs): Promise<GetMetricTimeSeriesResponse> {\n    throw new MastraError({\n      id: 'OBSERVABILITY_STORAGE_GET_METRIC_TIME_SERIES_NOT_IMPLEMENTED',\n      domain: ErrorDomain.MASTRA_OBSERVABILITY,\n      category: ErrorCategory.SYSTEM,\n      text: 'This storage provider does not support metric time series',\n    });\n  }\n\n  async getMetricPercentiles(_args: GetMetricPercentilesArgs): Promise<GetMetricPercentilesResponse> {\n    throw new MastraError({","sourceCodeStart":441,"sourceCodeEnd":477,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/packages/core/src/storage/domains/observability/base.ts#L441-L477","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\nconst rows = await storage.getMetricBreakdown({ metricName: 'llm_latency', groupBy: 'model' }); // throws\n// after\nconst rows = supportsMetricBreakdown(storage)\n  ? await storage.getMetricBreakdown({ metricName: 'llm_latency', groupBy: 'model' })\n  : [];","handlingStrategy":"fallback","validationCode":"import { MastraStorage } from '@mastra/core/storage';\n\nfunction supportsMetricBreakdown(storage: unknown): boolean {\n  return (\n    storage instanceof MastraStorage &&\n    (storage as MastraStorage).getMetricBreakdown !== MastraStorage.prototype.getMetricBreakdown\n  );\n}\n\nif (!supportsMetricBreakdown(storage)) {\n  console.warn('Metric breakdown unsupported by this storage adapter');\n}","typeGuard":"function supportsMetricBreakdown(s: unknown): s is MastraStorage & { getMetricBreakdown: (a: GetMetricBreakdownArgs) => Promise<GetMetricBreakdownResponse> } {\n  return s instanceof MastraStorage && s.getMetricBreakdown !== MastraStorage.prototype.getMetricBreakdown;\n}","tryCatchPattern":"import { MastraError } from '@mastra/core/error';\n\ntry {\n  const rows = await storage.getMetricBreakdown(args);\n} catch (err) {\n  if (err instanceof MastraError && err.id === 'OBSERVABILITY_STORAGE_GET_METRIC_BREAKDOWN_NOT_IMPLEMENTED') {\n    const rows = []; // show empty breakdown instead of throwing\n  } else {\n    throw err;\n  }\n}","preventionTips":["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."],"tags":["storage","observability","metrics","breakdown","not-implemented"],"backgroundTag":"storage-capability-not-implemented","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}