pinpoint-apm/pinpoint · error · IllegalStateException

Micrometer is not enabled

Error message

Micrometer is not enabled

What it means

DefaultMicrometerMonitor's constructor requires that Micrometer support is explicitly enabled in the profiler configuration. When profiler.micrometer.enable is false (the default), constructing the monitor throws IllegalStateException. This fails fast so the caller falls back to the non-micrometer monitor implementation instead of silently collecting nothing.

Source

Thrown at agent-module/profiler-micrometer/src/main/java/com/navercorp/pinpoint/profiler/micrometer/DefaultMicrometerMonitor.java:47

 * MicrometerMonitor
 *
 */
public class DefaultMicrometerMonitor implements MicrometerMonitor {

    private final Logger logger = LogManager.getLogger(this.getClass());

    private final AgentOtlpMeterRegistry registry;

    @Inject
    public DefaultMicrometerMonitor(@Named("pinpoint.applicationName") String applicationName,
                                    @Named("pinpoint.agentId") String agentId,
                                    MicrometerConfig config) {
        Objects.requireNonNull(applicationName, "applicationName");
        Objects.requireNonNull(agentId, "agentId");
        Objects.requireNonNull(config, "config");

        if (!config.isEnable()) {
            throw new IllegalStateException("Micrometer is not enabled");
        }

        OtlpConfig otlpConfig = AgentOtlpConfig.getOtlpConfig(
                config.getUrl(),
                config.getStep(),
                config.getBatchSize(),
                "default",
                applicationName,
                agentId);
        this.registry = new AgentOtlpMeterRegistry(otlpConfig);
    }


    @Override
    public void start() {
        logger.info("MicrometerMonitor started");
    }

View on GitHub (pinned to 744c3d3075)

Solutions

  1. Set profiler.micrometer.enable=true in the agent configuration before using DefaultMicrometerMonitor
  2. Use the profiler's monitor selection/factory logic instead of instantiating DefaultMicrometerMonitor directly
  3. Verify the loaded config file actually contains the micrometer enable property and it is not overridden elsewhere
  4. If micrometer is not needed, switch to the default monitor implementation

Example fix

// before
Monitor monitor = new DefaultMicrometerMonitor(appName, agentId, config);
// after
if (micrometerConfig.isEnable()) {
    monitor = new DefaultMicrometerMonitor(appName, agentId, config);
} else {
    monitor = new EmptyMonitor();
}
// plus in pinpoint.config: profiler.micrometer.enable=true
Defensive patterns

Strategy: validation

Validate before calling

if (!profilerConfig.readBoolean("profiler.micrometer.enable", false)) {
    // use the default monitor instead of DefaultMicrometerMonitor
}

Try / catch

try {
    monitor = new DefaultMicrometerMonitor(appName, agentId, micrometerConfig);
} catch (IllegalStateException e) {
    logger.warn("micrometer disabled, falling back to default monitor");
    monitor = new EmptyMonitor();
}

Prevention

When it happens

Trigger: Constructing DefaultMicrometerMonitor while profiler.micrometer.enable=false in pinpont.config / pinpoint.properties; wiring the micrometer monitor unconditionally in custom profiler setup.

Common situations: Enabling micrometer-related metrics code paths without flipping the config flag; copying sample code that instantiates DefaultMicrometerMonitor directly; upgrade where monitor selection logic changed.

Related errors


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