pinpoint-apm/pinpoint · warning

Unknown CpuLoadMetric

Error message

Unknown CpuLoadMetric : {}

What it means

CpuLoadMetricProvider.createCpuLoadMetric logs 'Unknown CpuLoadMetric' when Class.forName succeeds but the loaded class has no public no-arg constructor (NoSuchMethodException). It returns CpuLoadMetric.UNSUPPORTED_CPU_LOAD_METRIC so the agent continues without CPU load metrics. This branch is distinct from the general ReflectiveOperationException branch that logs 'Error creating CpuLoadMetric'.

Solutions

  1. Verify the class named in the log has a public no-arg constructor; add one if it is your custom implementation
  2. Check whether your Pinpoint version's class map matches the target OS/JVM and upgrade the agent if the platform is newer than the mapping
  3. Confirm the fallback UNSUPPORTED_CPU_LOAD_METRIC is acceptable — if CPU metrics matter, provide a compatible implementation

Example fix

// before
class MyCpuLoadMetric implements CpuLoadMetric {
    MyCpuLoadMetric(OperatingSystemMXBean os) { ... }
}
// after
class MyCpuLoadMetric implements CpuLoadMetric {
    public MyCpuLoadMetric() { this(getPlatformBean()); }
    MyCpuLoadMetric(OperatingSystemMXBean os) { ... }
}
Defensive patterns

Strategy: fallback

Validate before calling

try { Class<?> c = Class.forName(metricClassName); c.getConstructor(); } catch (ClassNotFoundException | NoSuchMethodException e) { /* resolve before enabling cpu metrics */ }

Try / catch

try { return ctor.newInstance(); } catch (NoSuchMethodException e) { logger.warn("Unknown CpuLoadMetric : {}", classToLoad); return CpuLoadMetric.UNSUPPORTED_CPU_LOAD_METRIC; }

Prevention

When it happens

Trigger: A CPU load metric class name (built from OS/JVM type/version mapping) resolves to a class that changed its constructor signature or was replaced with one requiring arguments.

Common situations: JVM/OS mapping table points at a class refactored between Pinpoint versions; custom CpuLoadMetric implementation without a no-arg constructor configured for the platform.

Related errors


AI-assisted analysis of pinpoint-apm/pinpoint@744c3d3075 (2026-09-07). Data as JSON: /api/errors/4d9327ae68364611. Report an issue: GitHub.

Appendix: source

Thrown at agent-module/profiler/src/main/java/com/navercorp/pinpoint/profiler/context/provider/stat/cpu/CpuLoadMetricProvider.java:85

        if (jvmType == JvmType.IBM) {
            return IBM_CPU_LOAD_METRIC;
        }
        return null;
    }

    private CpuLoadMetric createCpuLoadMetric(String classToLoad) {
        if (classToLoad == null) {
            return CpuLoadMetric.UNSUPPORTED_CPU_LOAD_METRIC;
        }
        try {
            @SuppressWarnings("unchecked")
            Class<CpuLoadMetric> cpuLoadMetricClass = (Class<CpuLoadMetric>) Class.forName(classToLoad);
            try {
                Constructor<CpuLoadMetric> cpuLoadMetricConstructor = cpuLoadMetricClass.getConstructor();
                return cpuLoadMetricConstructor.newInstance();
            } catch (NoSuchMethodException e) {
                logger.warn("Unknown CpuLoadMetric : {}", classToLoad);
                return CpuLoadMetric.UNSUPPORTED_CPU_LOAD_METRIC;
            }
        } catch (ReflectiveOperationException e) {
            logger.warn("Error creating CpuLoadMetric [" + classToLoad + "]");
            return CpuLoadMetric.UNSUPPORTED_CPU_LOAD_METRIC;
        }
    }
}

View on GitHub (pinned to 744c3d3075)