{"record":{"id":"01343b0fc7185a62","repo":"apache/beam","slug":"timer-not-supported-use-histogram-instead","errorCode":null,"errorMessage":"Timer not supported. Use histogram instead.","messagePattern":"Timer not supported\\. Use histogram instead\\.","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"sdks/java/extensions/euphoria/src/main/java/org/apache/beam/sdk/extensions/euphoria/core/translate/collector/AdaptableCollector.java","lineNumber":88,"sourceCode":"\n  @Override\n  public Context asContext() {\n    return this;\n  }\n\n  @Override\n  public Counter getCounter(String name) {\n    return accumulators.getCounter(requireNonNull(operatorName, UNSUPPORTED), name);\n  }\n\n  @Override\n  public Histogram getHistogram(String name) {\n    return accumulators.getHistogram(requireNonNull(operatorName, UNSUPPORTED), name);\n  }\n\n  @Override\n  public Timer getTimer(String name) {\n    throw new UnsupportedOperationException(\"Timer not supported. Use histogram instead.\");\n  }\n\n  public void setProcessContext(DoFn<InputT, OutputT>.ProcessContext context) {\n    this.context = requireNonNull(context);\n  }\n}\n","sourceCodeStart":70,"sourceCodeEnd":95,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/extensions/euphoria/src/main/java/org/apache/beam/sdk/extensions/euphoria/core/translate/collector/AdaptableCollector.java#L70-L95","documentation":"AdaptableCollector explicitly rejects timers: getTimer always throws UnsupportedOperationException. The adapter layer maps counters and histograms onto Beam accumulators but has no timer equivalent, so users are directed to histograms.","triggerScenarios":"Calling collector.getTimer(name) from inside a Euphoria user function (map/flatmap/reduce) running through the Beam translation with an AdaptableCollector.","commonSituations":"Porting Flink/Spark Euphoria code that used timers to Beam; measuring operation durations in user DoFns.","solutions":["Use getHistogram(name) instead and record elapsed milliseconds","Remove timer metrics from the user function","Accumulate timing values in your own state and report them outside the collector"],"exampleFix":"// before\ncollector.getTimer(\"myTimer\").update(elapsed);\n// after\ncollector.getHistogram(\"myDurationMs\").update(elapsed);","handlingStrategy":"validation","validationCode":"// never call getTimer on AdaptableCollector; use histogram for durations\n// long ms = ...; collector.getHistogram(\"durationMs\").update(ms);","typeGuard":"null","tryCatchPattern":"try { collector.getTimer(\"t\"); } catch (UnsupportedOperationException e) { /* use getHistogram instead */ }","preventionTips":["Treat timers as unavailable in Beam Euphoria user functions","Standardize on histograms for timing metrics","Search code for getTimer before porting to Beam"],"tags":["unsupported-operation","timer","histogram","beam"],"backgroundTag":"operation-not-supported","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-20T03:17:13.778Z"}