apache/beam · error · UnsupportedOperationException

BeamAccumulatorProvider doesn't support getTimer(String…

Error message

BeamAccumulatorProvider doesn't support getTimer(String name). Please specify namespace and name.

What it means

BeamAccumulatorProvider requires timers to be identified by namespace and name, matching Beam's Metrics API. The getTimer(String) single-name overload is intentionally unsupported and always throws UnsupportedOperationException pointing callers to the two-argument variant.

Solutions

  1. Call getTimer(namespace, name) with an explicit namespace.
  2. Refactor shared metric-resolution code to always pass namespace+name.
  3. Introduce a delegating wrapper that fills a default namespace when only a name is available.

Example fix

// before
Timer t = accumulatorProvider.getTimer("durations");
// after
Timer t = accumulatorProvider.getTimer("myOperator", "durations");
Defensive patterns

Strategy: try-catch

Try / catch

try {
  timer = provider.getTimer(name);
} catch (UnsupportedOperationException e) {
  timer = provider.getTimer(defaultNamespace, name);
}

Prevention

When it happens

Trigger: Calling accumulatorProvider.getTimer("myTimer") — the name-only overload — under the Beam runner's accumulator provider.

Common situations: Code ported from Flink/Spark timer providers that accept a bare name; generic instrumentation frameworks resolving timers by name only.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


AI-assisted analysis of apache/beam@12126d8942 (2026-09-13). Data as JSON: /api/errors/499ff840f302cf33. Report an issue: GitHub.

Appendix: source

Thrown at sdks/java/extensions/euphoria/src/main/java/org/apache/beam/sdk/extensions/euphoria/core/translate/BeamAccumulatorProvider.java:82

        getMetricsKey(namespace, name), key -> new BeamMetricsCounter(namespace, name));
  }

  @Override
  public Histogram getHistogram(String name) {
    throw new UnsupportedOperationException(
        "BeamAccumulatorProvider doesn't support"
            + " getHistogram(String name). Please specify namespace and name.");
  }

  @Override
  public Histogram getHistogram(final String namespace, final String name) {
    return histogramMap.computeIfAbsent(
        getMetricsKey(namespace, name), key -> new BeamMetricsHistogram(namespace, name));
  }

  @Override
  public Timer getTimer(String name) {
    throw new UnsupportedOperationException(
        "BeamAccumulatorProvider doesn't support"
            + " getTimer(String name). Please specify namespace and name.");
  }

  /**
   * Metric key for accumulator map.
   *
   * @param namespace = operator name
   * @param name of metric
   * @return metricKey = namespace + SEPARATOR + name
   */
  private static String getMetricsKey(String namespace, String name) {
    return namespace.concat(KEY_METRIC_SEPARATOR).concat(name);
  }

  // ------------------------

  /** AccumulatorProvider Factory. */

View on GitHub (pinned to 12126d8942)