{"record":{"id":"ec0c75b44b0b2f5f","repo":"mastra-ai/mastra","slug":"observability-storage-get-metric-percentiles-not-i","errorCode":"OBSERVABILITY_STORAGE_GET_METRIC_PERCENTILES_NOT_IMPLEMENTED","errorMessage":"This storage provider does not support metric percentiles","messagePattern":"This storage provider does not support metric percentiles","errorType":"error_code","errorClass":"MastraError","httpStatus":null,"severity":"error","filePath":"packages/core/src/storage/domains/observability/base.ts","lineNumber":477,"sourceCode":"    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\n  // ============================================================================\n\n  async getMetricNames(_args: GetMetricNamesArgs): Promise<GetMetricNamesResponse> {\n    throw new MastraError({\n      id: 'OBSERVABILITY_STORAGE_GET_METRIC_NAMES_NOT_IMPLEMENTED',\n      domain: ErrorDomain.MASTRA_OBSERVABILITY,\n      category: ErrorCategory.SYSTEM,\n      text: 'This storage provider does not support metric name discovery',\n    });","sourceCodeStart":459,"sourceCodeEnd":495,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/packages/core/src/storage/domains/observability/base.ts#L459-L495","documentation":"MastraError OBSERVABILITY_STORAGE_GET_METRIC_PERCENTILES_NOT_IMPLEMENTED is thrown by the default getMetricPercentiles() in the observability storage base class (packages/core/src/storage/domains/observability/base.ts:477). It means the storage adapter does not implement percentile (p50/p90/p99-style) metric queries. Like its sibling methods, the base implementation always throws so unsupported providers fail loudly with a typed MastraError.","triggerScenarios":"Calling getMetricPercentiles(args) on a storage adapter that has not overridden it — e.g. requesting latency percentiles through the metrics API or Studio metrics view.","commonSituations":"Requesting p50/p95/p99 latency panels in Studio against an adapter without percentile support; custom storage adapter missing getMetricPercentiles; version skew between @mastra/core and the storage adapter after percentile APIs shipped.","solutions":["Switch to or upgrade a storage adapter that implements getMetricPercentiles (e.g. PostgreSQL-based adapters).","If percentiles are not essential, drop the percentile query/panel or replace it with an aggregate the adapter supports.","For a custom adapter, implement getMetricPercentiles (compute quantiles over stored observations) or return an explicit empty response.","Check capabilities at startup (method override check) and disable percentile-dependent features before users hit the error."],"exampleFix":"// before\nconst pct = await storage.getMetricPercentiles({ metricName: 'llm_latency', percentiles: [50, 95, 99] }); // throws\n// after\nconst pct = supportsMetricPercentiles(storage)\n  ? await storage.getMetricPercentiles({ metricName: 'llm_latency', percentiles: [50, 95, 99] })\n  : null;","handlingStrategy":"fallback","validationCode":"import { MastraStorage } from '@mastra/core/storage';\n\nfunction supportsMetricPercentiles(storage: unknown): boolean {\n  return (\n    storage instanceof MastraStorage &&\n    (storage as MastraStorage).getMetricPercentiles !== MastraStorage.prototype.getMetricPercentiles\n  );\n}\n\nif (!supportsMetricPercentiles(storage)) {\n  console.warn('Metric percentiles unsupported by this storage adapter');\n}","typeGuard":"function supportsMetricPercentiles(s: unknown): s is MastraStorage & { getMetricPercentiles: (a: GetMetricPercentilesArgs) => Promise<GetMetricPercentilesResponse> } {\n  return s instanceof MastraStorage && s.getMetricPercentiles !== MastraStorage.prototype.getMetricPercentiles;\n}","tryCatchPattern":"import { MastraError } from '@mastra/core/error';\n\ntry {\n  const pct = await storage.getMetricPercentiles(args);\n} catch (err) {\n  if (err instanceof MastraError && err.id === 'OBSERVABILITY_STORAGE_GET_METRIC_PERCENTILES_NOT_IMPLEMENTED') {\n    const pct = null; // hide percentile panel instead of failing\n  } else {\n    throw err;\n  }\n}","preventionTips":["Check that the adapter computes percentiles (histogram/quantile queries) before requesting them.","Keep @mastra/core and storage adapter versions synchronized to avoid missing newer percentile APIs.","Override getMetricPercentiles in custom adapters or return an explicit empty response.","Run a capability check at startup and disable percentile features that the backend lacks.","Cover getMetricPercentiles in the adapter's integration tests."],"tags":["storage","observability","metrics","percentiles","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"}