{"record":{"id":"a46e84b313129ceb","repo":"mastra-ai/mastra","slug":"observability-storage-get-metric-names-not-impleme","errorCode":"OBSERVABILITY_STORAGE_GET_METRIC_NAMES_NOT_IMPLEMENTED","errorMessage":"This storage provider does not support metric name discovery","messagePattern":"This storage provider does not support metric name discovery","errorType":"error_code","errorClass":"MastraError","httpStatus":null,"severity":"warning","filePath":"packages/core/src/storage/domains/observability/base.ts","lineNumber":490,"sourceCode":"      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    });\n  }\n\n  async getMetricLabelKeys(_args: GetMetricLabelKeysArgs): Promise<GetMetricLabelKeysResponse> {\n    throw new MastraError({\n      id: 'OBSERVABILITY_STORAGE_GET_METRIC_LABEL_KEYS_NOT_IMPLEMENTED',\n      domain: ErrorDomain.MASTRA_OBSERVABILITY,\n      category: ErrorCategory.SYSTEM,\n      text: 'This storage provider does not support metric label key discovery',\n    });\n  }\n\n  async getMetricLabelValues(_args: GetMetricLabelValuesArgs): Promise<GetMetricLabelValuesResponse> {\n    throw new MastraError({","sourceCodeStart":472,"sourceCodeEnd":508,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/packages/core/src/storage/domains/observability/base.ts#L472-L508","documentation":"MastraError OBSERVABILITY_STORAGE_GET_METRIC_NAMES_NOT_IMPLEMENTED. The observability storage base class declares getMetricNames as an optional capability; the default implementation unconditionally throws this error. It is thrown when the active storage provider has not overridden getMetricNames, meaning metric name discovery is not available for that backend. It is a deliberate 'capability not implemented' signal, not a runtime failure.","triggerScenarios":"Calling getMetricNames(args) on a storage instance whose class extends MastraObservabilityStorage (base.ts) without overriding the method — e.g. an in-memory or minimal storage adapter used with the observability metrics API.","commonSituations":"Using a storage adapter (LibSQL, in-memory, or a custom driver) that predates observability metrics support; swapping storage backends and assuming all MastraStorage domains are fully implemented; calling the metrics discovery API through the server/API layer against a provider lacking the feature.","solutions":["Switch to a storage provider that implements metric name discovery (e.g. the official Postgres/ClickHouse observability backends)","Implement getMetricNames in your custom storage domain class, returning the metric names you persist","Wrap the call in try/catch and degrade gracefully (return an empty list or hide discovery UI) when the backend lacks support"],"exampleFix":"// before\nconst names = await storage.getMetricNames({});\n// after\nlet names = [];\ntry {\n  names = (await storage.getMetricNames({})).metricNames ?? [];\n} catch (e) {\n  if (e.id !== 'OBSERVABILITY_STORAGE_GET_METRIC_NAMES_NOT_IMPLEMENTED') throw e;\n}","handlingStrategy":"fallback","validationCode":"// capability probe\nasync function supportsMetricNames(storage) {\n  try { await storage.getMetricNames({}); return true; }\n  catch (e) { return e?.id === 'OBSERVABILITY_STORAGE_GET_METRIC_NAMES_NOT_IMPLEMENTED' ? false : true; }\n}","typeGuard":"function isNotImplementedError(e: unknown): e is MastraError {\n  return e instanceof MastraError && e.id === 'OBSERVABILITY_STORAGE_GET_METRIC_NAMES_NOT_IMPLEMENTED';\n}","tryCatchPattern":"try {\n  const res = await storage.getMetricNames(args);\n} catch (e) {\n  if (isNotImplementedError(e)) return { metricNames: [] };\n  throw e;\n}","preventionTips":["Check your storage provider's docs for observability metric discovery support before wiring the metrics API","Write a capability smoke test against your storage instance in CI","Centralize storage calls in a wrapper that degrades gracefully on not-implemented errors","Keep custom storage adapters in sync with MastraStorage interface updates on upgrades"],"tags":["storage","observability","not-implemented","metrics"],"backgroundTag":"storage-method-not-implemented","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}