{"record":{"id":"7695a83561deae15","repo":"apache/seatunnel","slug":"the-value-of-metric-does-not-support-metrictype","errorCode":null,"errorMessage":"The value of Metric does not support ${metricType} data type","messagePattern":"The value of Metric does not support (.+?) data type","errorType":"exception","errorClass":"SeaTunnelException","httpStatus":null,"severity":"error","filePath":"seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/metrics/SeaTunnelMetricsContext.java","lineNumber":56,"sourceCode":"    public void provideDynamicMetrics(MetricDescriptor tagger, MetricsCollectionContext context) {\n        metrics.forEach(\n                (name, metric) -> {\n                    if (metric instanceof Counter) {\n                        context.collect(\n                                tagger.copy(),\n                                name,\n                                ProbeLevel.INFO,\n                                toProbeUnit(metric.unit()),\n                                ((Counter) metric).getCount());\n                    } else if (metric instanceof Meter) {\n                        context.collect(\n                                tagger.copy(),\n                                name,\n                                ProbeLevel.INFO,\n                                toProbeUnit(metric.unit()),\n                                ((Meter) metric).getRate());\n                    } else {\n                        throw new SeaTunnelException(\n                                \"The value of Metric does not support \"\n                                        + metric.getClass().getSimpleName()\n                                        + \" data type\");\n                    }\n                });\n    }\n\n    private ProbeUnit toProbeUnit(Unit unit) {\n        return ProbeUnit.valueOf(unit.name());\n    }\n}\n","sourceCodeStart":38,"sourceCodeEnd":68,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/metrics/SeaTunnelMetricsContext.java#L38-L68","documentation":"SeaTunnelMetricsContext.provideDynamicMetrics converts SeaTunnel Metric values into Hazelcast/Micrometer probes. It handles Counter and Meter; any other Metric implementation hits the else branch and throws SeaTunnelException 'The value of Metric does not support <SimpleName> data type'. This happens while serving dynamic metrics for the cluster/web UI.","triggerScenarios":"A registered connector metric object's runtime class is neither Counter nor Meter (e.g. a custom Metric subclass or Gauge) when metrics are probed via provideDynamicMetrics, typically triggered by a metrics scrape or the SeaTunnel web UI.","commonSituations":"Custom connectors with custom Metric implementations; classpath mixing different metric API versions so an object that looks like a Counter is not java.util.function-type-matching; plugins compiled against a different SeaTunnel API version.","solutions":["Change the connector metric implementation to standard Counter or Meter from the engine API.","Rebuild the connector against the same SeaTunnel API version as the engine to avoid class identity mismatches.","Remove or disable the offending metric declaration in the connector.","Check the reported class SimpleName in the message to identify which plugin/metric is at fault."],"exampleFix":"// before\nreturn new Metric() { ... }; // custom implementation\n// after\nprivate final Counter rows = new CounterImpl();\npublic Counter getRows() { return rows; }","handlingStrategy":"type-guard","validationCode":"if (!(metric instanceof Counter) && !(metric instanceof Meter)) {\n    throw new IllegalArgumentException(\"metric type not probeable: \" + metric.getClass().getName());\n}","typeGuard":"static boolean isProbeableMetric(Object m) {\n    return m instanceof Counter || m instanceof Meter;\n}","tryCatchPattern":"try {\n    metricsContext.provideDynamicMetrics(...);\n} catch (SeaTunnelException e) {\n    if (e.getMessage().startsWith(\"The value of Metric does not support\")) {\n        log.warn(\"unprobeable metric skipped: {}\", e.getMessage());\n    } else throw e;\n}","preventionTips":["Use only Counter/Meter implementations from the engine API in connectors.","Rebuild plugins against the exact engine version to keep class identity consistent.","Keep one SeaTunnel API jar on the classpath - no mixed versions."],"tags":["metrics","connector","type-mismatch"],"backgroundTag":"unsupported-dtype","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}