alibaba/Sentinel · error · IllegalArgumentException

Interval should be less than 5 min:

Error message

Interval should be less than 5 min: 

What it means

The final rule of StatLoggerBuilder.validateInterval: flush intervals above 5 minutes (300 seconds) are rejected. EagleEye stat loggers are designed for near-real-time monitoring output, and long intervals would also delay file rolling and daemon flushing disproportionately, so the builder throws IllegalArgumentException for any value over 300.

Solutions

  1. Keep the interval at or below 300 seconds — and given the other rules, effectively at most 60 seconds.
  2. If a milliseconds config feeds the builder, divide by 1000 and clamp to [1, 60].
  3. If coarse aggregation is truly needed, aggregate downstream from the stat files instead of stretching the flush interval.

Example fix

// before
builder.intervalSeconds(600); // > 300 -> throws

// after
builder.intervalSeconds(60);
Defensive patterns

Strategy: validation

Validate before calling

int sec = Math.toIntExact(Math.min(Math.max(1, intervalMillis / 1000), 60));
builder.intervalSeconds(sec);

Prevention

When it happens

Trigger: Calling intervalSeconds(n) with n > 300 — e.g. 360 (6 min), 600 (10 min), or a milliseconds-vs-seconds unit mistake (e.g. passing 6000 intending 6000ms = 6s, or 600 for '10 minutes').

Common situations: Unit confusion: a milliseconds value from config is passed where seconds are expected, producing large numbers. Aggressive batching strategies that want 10-15 minute flushes. Defaults migrated from log-rotation policies measured in minutes.

Related errors


AI-assisted analysis of alibaba/Sentinel@a3f40ba8e9 (2026-08-14). Data as JSON: /api/errors/4d59301f750ff362. Report an issue: GitHub.

Appendix: source

Thrown at sentinel-core/src/main/java/com/alibaba/csp/sentinel/eagleeye/StatLoggerBuilder.java:110

        return StatLogController.createLoggerIfNotExists(this);
    }

    static void validateInterval(final long intervalSeconds) throws IllegalArgumentException {
        if (intervalSeconds < 1) {
            throw new IllegalArgumentException("Interval cannot be less than 1" + intervalSeconds);
        } else if (intervalSeconds < 60) {
            if (60 % intervalSeconds != 0) {
                throw new IllegalArgumentException("Invalid second interval (cannot divide by 60): " + intervalSeconds);
            }
        } else if (intervalSeconds <= 5 * 60) {
            if (intervalSeconds % 60 != 0) {
                throw new IllegalArgumentException("Invalid second interval (cannot divide by 60): " + intervalSeconds);
            }
            if (60 % intervalSeconds != 0) {
                throw new IllegalArgumentException("Invalid second interval (cannot divide by 60): " + intervalSeconds);
            }
        } else if (intervalSeconds > 5 * 60) {
            throw new IllegalArgumentException("Interval should be less than 5 min: " + intervalSeconds);
        }
    }
}

View on GitHub (pinned to a3f40ba8e9)