pinpoint-apm/pinpoint · warning

Error creating CpuLoadMetric [{}]

Error message

Error creating CpuLoadMetric [{}]

What it means

CpuLoadMetricProvider logs this when reflective instantiation of the CPU load metric class fails with any ReflectiveOperationException (ClassNotFoundException, IllegalAccessException, InvocationTargetException, InstantiationException). The provider falls back to CpuLoadMetric.UNSUPPORTED_CPU_LOAD_METRIC, disabling CPU load collection while the agent keeps running.

Source

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

        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)

Solutions

  1. Read the chained exception to distinguish ClassNotFoundException from InvocationTargetException
  2. Confirm the expected metric class exists in the deployed pinpoint agent jar (jar tf / unzip -l)
  3. Fix the constructor if it throws (e.g. guard against missing com.sun.management.OperatingSystemMXBean)
  4. If the platform lacks the required MXBeans, accept the unsupported-metric fallback
Defensive patterns

Strategy: fallback

Validate before calling

jar tf pinpoint-agent.jar | grep -i CpuLoadMetric; // and confirm com.sun.management.OperatingSystemMXBean is reachable on the JVM

Try / catch

try { return ctor.newInstance(); } catch (ReflectiveOperationException e) { logger.warn("Error creating CpuLoadMetric [{}]", classToLoad, e); return CpuLoadMetric.UNSUPPORTED_CPU_LOAD_METRIC; }

Prevention

When it happens

Trigger: Class.forName cannot find the metric class on the agent classpath; the constructor is not accessible; the constructor throws during instantiation.

Common situations: Corrupt or trimmed agent deployment missing platform-specific metric classes; running on an OS/JVM combination whose metric class was never packaged; constructor throwing due to unavailable com.sun.management beans.

Related errors


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