{"record":{"id":"e9e555c455cdece3","repo":"apache/beam","slug":"getmonitoringinfos-is-not-implemented-on-this","errorCode":null,"errorMessage":"getMonitoringInfos is not implemented on this MetricsContainer.","messagePattern":"getMonitoringInfos is not implemented on this MetricsContainer\\.","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"sdks/java/core/src/main/java/org/apache/beam/sdk/metrics/MetricsContainer.java","lineNumber":77,"sourceCode":"  StringSet getStringSet(MetricName metricName);\n\n  /**\n   * Return the {@link BoundedTrie} that should be used for implementing the given {@code\n   * metricName} in this container.\n   */\n  BoundedTrie getBoundedTrie(MetricName metricName);\n\n  /**\n   * Return the {@link Histogram} that should be used for implementing the given {@code metricName}\n   * in this container.\n   */\n  default Histogram getHistogram(MetricName metricName, HistogramData.BucketType bucketType) {\n    return NoOpHistogram.getInstance();\n  }\n\n  /** Return the cumulative values for any metrics in this container as MonitoringInfos. */\n  default Iterable<MetricsApi.MonitoringInfo> getMonitoringInfos() {\n    throw new RuntimeException(\"getMonitoringInfos is not implemented on this MetricsContainer.\");\n  }\n}\n","sourceCodeStart":59,"sourceCodeEnd":80,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/core/src/main/java/org/apache/beam/sdk/metrics/MetricsContainer.java#L59-L80","documentation":"MetricsContainer is an interface where getMonitoringInfos is a default method that throws RuntimeException. Containers that do not override it (no-op or partially implemented containers) throw this error when someone asks for their cumulative MonitoringInfo values.","triggerScenarios":"Calling getMonitoringInfos() on a MetricsContainer implementation that only implements the metric-getter methods but not getMonitoringInfos — e.g. a custom container or a test stub.","commonSituations":"Custom runner integrations that extract metrics from their own containers, unit tests stubbing MetricsContainer, or harness code pulling MonitoringInfos from containers that never supported export.","solutions":["Override getMonitoringInfos() in the MetricsContainer implementation to return the accumulated MonitoringInfo values.","If the container is intentionally a no-op, return an empty iterable instead of relying on the throwing default.","Use a fully supported container implementation (e.g. from runners-core) that implements the export.","Wrap the call and fall back to per-metric getters when export is unsupported."],"exampleFix":"// before\ncontainer.getMonitoringInfos(); // throws\n// after\nList<MonitoringInfo> infos = container instanceof MyContainer\n    ? ((MyContainer) container).getMonitoringInfos()\n    : Collections.emptyList();","handlingStrategy":"try-catch","validationCode":"boolean supportsExport = container.getClass().getMethod(\"getMonitoringInfos\").getDeclaringClass() != MetricsContainer.class;","typeGuard":null,"tryCatchPattern":"try { infos = container.getMonitoringInfos(); } catch (RuntimeException e) { infos = Collections.emptyList(); }","preventionTips":["Implement getMonitoringInfos() in all custom MetricsContainer classes","Never rely on throwing default interface methods in stubs","Return empty iterables from no-op containers instead of throwing"],"tags":["apache-beam","metrics","interface-default-method"],"backgroundTag":"method-not-implemented","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}