{"record":{"id":"d308b59a6a6ef82f","repo":"mastra-ai/mastra","slug":"observability-storage-get-metric-time-series-not-i","errorCode":"OBSERVABILITY_STORAGE_GET_METRIC_TIME_SERIES_NOT_IMPLEMENTED","errorMessage":"This storage provider does not support metric time series","messagePattern":"This storage provider does not support metric time series","errorType":"error_code","errorClass":"MastraError","httpStatus":null,"severity":"error","filePath":"packages/core/src/storage/domains/observability/base.ts","lineNumber":468,"sourceCode":"    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({\n      id: 'OBSERVABILITY_STORAGE_GET_METRIC_PERCENTILES_NOT_IMPLEMENTED',\n      domain: ErrorDomain.MASTRA_OBSERVABILITY,\n      category: ErrorCategory.SYSTEM,\n      text: 'This storage provider does not support metric percentiles',\n    });\n  }\n\n  // ============================================================================\n  // Discovery / Metadata Methods","sourceCodeStart":450,"sourceCodeEnd":486,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/packages/core/src/storage/domains/observability/base.ts#L450-L486","documentation":"MastraError OBSERVABILITY_STORAGE_GET_METRIC_TIME_SERIES_NOT_IMPLEMENTED is thrown by the default getMetricTimeSeries() in the observability storage base class (packages/core/src/storage/domains/observability/base.ts:468). It means the storage adapter does not implement bucketed time-series queries over metrics. The base class throws for every unimplemented capability so callers get an explicit MastraError instead of silently empty results.","triggerScenarios":"Calling getMetricTimeSeries(args) (metric values binned over a time range/granularity) on a storage adapter that has not overridden the method — commonly via Studio metric charts.","commonSituations":"Rendering a metric chart in Studio connected to a minimal adapter (e.g. LibSQL/InMemory without metrics); custom MastraStorage subclass lacks getMetricTimeSeries; upgrading core while the storage adapter package lags behind.","solutions":["Use/upgrade to a storage adapter implementing metric time-series (check the adapter's observability support matrix).","Reconfigure the Mastra instance's storage to a metrics-capable backend if time-series charts are required.","Implement getMetricTimeSeries in your custom adapter (bin observations by the requested granularity) or return an empty series deliberately.","Gate chart rendering on a capability check so the UI shows 'unsupported' rather than erroring."],"exampleFix":"// before\nconst series = await storage.getMetricTimeSeries({ metricName: 'agent_latency', granularity: '1h' }); // throws\n// after\nconst series = supportsMetricTimeSeries(storage)\n  ? await storage.getMetricTimeSeries({ metricName: 'agent_latency', granularity: '1h' })\n  : { points: [] };","handlingStrategy":"fallback","validationCode":"import { MastraStorage } from '@mastra/core/storage';\n\nfunction supportsMetricTimeSeries(storage: unknown): boolean {\n  return (\n    storage instanceof MastraStorage &&\n    (storage as MastraStorage).getMetricTimeSeries !== MastraStorage.prototype.getMetricTimeSeries\n  );\n}\n\nif (!supportsMetricTimeSeries(storage)) {\n  console.warn('Metric time-series unsupported by this storage adapter');\n}","typeGuard":"function supportsMetricTimeSeries(s: unknown): s is MastraStorage & { getMetricTimeSeries: (a: GetMetricTimeSeriesArgs) => Promise<GetMetricTimeSeriesResponse> } {\n  return s instanceof MastraStorage && s.getMetricTimeSeries !== MastraStorage.prototype.getMetricTimeSeries;\n}","tryCatchPattern":"import { MastraError } from '@mastra/core/error';\n\ntry {\n  const series = await storage.getMetricTimeSeries(args);\n} catch (err) {\n  if (err instanceof MastraError && err.id === 'OBSERVABILITY_STORAGE_GET_METRIC_TIME_SERIES_NOT_IMPLEMENTED') {\n    const series = { points: [] } as GetMetricTimeSeriesResponse; // render empty chart\n  } else {\n    throw err;\n  }\n}","preventionTips":["Use a time-series-capable store if charts are a requirement (e.g. PostgreSQL adapter).","Keep core and storage adapter versions aligned; check release notes for new metrics APIs.","Implement getMetricTimeSeries in custom adapters or return an explicit empty series.","Feature-detect the method before mounting time-series charts.","Test time-series queries in the adapter's integration suite."],"tags":["storage","observability","metrics","time-series","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"}