mastra-ai/mastra · error · MastraError

OBSERVABILITY_STORAGE_GET_METRIC_TIME_SERIES_NOT_IMPLEMENTED

OBSERVABILITY_STORAGE_GET_METRIC_TIME_SERIES_NOT_IMPLEMENTED

Error message

This storage provider does not support metric time series

What it means

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.

Source

Thrown at packages/core/src/storage/domains/observability/base.ts:468

    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({
      id: 'OBSERVABILITY_STORAGE_GET_METRIC_PERCENTILES_NOT_IMPLEMENTED',
      domain: ErrorDomain.MASTRA_OBSERVABILITY,
      category: ErrorCategory.SYSTEM,
      text: 'This storage provider does not support metric percentiles',
    });
  }

  // ============================================================================
  // Discovery / Metadata Methods

View on GitHub (pinned to 75dd419e61)

Solutions

  1. Use/upgrade to a storage adapter implementing metric time-series (check the adapter's observability support matrix).
  2. Reconfigure the Mastra instance's storage to a metrics-capable backend if time-series charts are required.
  3. Implement getMetricTimeSeries in your custom adapter (bin observations by the requested granularity) or return an empty series deliberately.
  4. Gate chart rendering on a capability check so the UI shows 'unsupported' rather than erroring.

Example fix

// before
const series = await storage.getMetricTimeSeries({ metricName: 'agent_latency', granularity: '1h' }); // throws
// after
const series = supportsMetricTimeSeries(storage)
  ? await storage.getMetricTimeSeries({ metricName: 'agent_latency', granularity: '1h' })
  : { points: [] };
Defensive patterns

Strategy: fallback

Validate before calling

import { MastraStorage } from '@mastra/core/storage';

function supportsMetricTimeSeries(storage: unknown): boolean {
  return (
    storage instanceof MastraStorage &&
    (storage as MastraStorage).getMetricTimeSeries !== MastraStorage.prototype.getMetricTimeSeries
  );
}

if (!supportsMetricTimeSeries(storage)) {
  console.warn('Metric time-series unsupported by this storage adapter');
}

Type guard

function supportsMetricTimeSeries(s: unknown): s is MastraStorage & { getMetricTimeSeries: (a: GetMetricTimeSeriesArgs) => Promise<GetMetricTimeSeriesResponse> } {
  return s instanceof MastraStorage && s.getMetricTimeSeries !== MastraStorage.prototype.getMetricTimeSeries;
}

Try / catch

import { MastraError } from '@mastra/core/error';

try {
  const series = await storage.getMetricTimeSeries(args);
} catch (err) {
  if (err instanceof MastraError && err.id === 'OBSERVABILITY_STORAGE_GET_METRIC_TIME_SERIES_NOT_IMPLEMENTED') {
    const series = { points: [] } as GetMetricTimeSeriesResponse; // render empty chart
  } else {
    throw err;
  }
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of mastra-ai/mastra@75dd419e61 (2026-08-30). Data as JSON: /api/errors/d308b59a6a6ef82f. Report an issue: GitHub.