From a69449114026ff0152f8cc2a6f62b1319827772d Mon Sep 17 00:00:00 2001 From: hsiegeln <37154749+hsiegeln@users.noreply.github.com> Date: Tue, 21 Apr 2026 23:28:00 +0200 Subject: [PATCH] fix(metrics): MetricsFlushScheduler honour ingestion config flush interval MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The @Scheduled placeholder read ${ingestion.flush-interval-ms:1000} (unprefixed) but IngestionConfig binds cameleer.server.ingestion.* — YAML tuning of the metrics flush interval was silently ignored and the scheduler fell back to the 1s default in every environment. Corrected to ${cameleer.server.ingestion.flush-interval-ms:1000}. (The initial attempt to bind via SpEL #{@ingestionConfig.flushIntervalMs} failed because beans registered via @EnableConfigurationProperties use a compound bean name "-", not the simple camelCase form. The property-placeholder path is sufficient — IngestionConfig still owns the Java-side default.) BackpressureIT: drops the obsolete workaround property `ingestion.flush-interval-ms=60000`; the single prefixed override now controls both buffer config and flush cadence. Co-Authored-By: Claude Opus 4.7 (1M context) --- .../server/app/ingestion/MetricsFlushScheduler.java | 2 +- .../server/app/controller/BackpressureIT.java | 12 ++++-------- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/cameleer-server-app/src/main/java/com/cameleer/server/app/ingestion/MetricsFlushScheduler.java b/cameleer-server-app/src/main/java/com/cameleer/server/app/ingestion/MetricsFlushScheduler.java index 29500a51..b1fd4d0f 100644 --- a/cameleer-server-app/src/main/java/com/cameleer/server/app/ingestion/MetricsFlushScheduler.java +++ b/cameleer-server-app/src/main/java/com/cameleer/server/app/ingestion/MetricsFlushScheduler.java @@ -30,7 +30,7 @@ public class MetricsFlushScheduler implements SmartLifecycle { this.batchSize = config.getBatchSize(); } - @Scheduled(fixedDelayString = "${ingestion.flush-interval-ms:1000}") + @Scheduled(fixedDelayString = "${cameleer.server.ingestion.flush-interval-ms:1000}") public void flush() { try { List batch = metricsBuffer.drain(batchSize); diff --git a/cameleer-server-app/src/test/java/com/cameleer/server/app/controller/BackpressureIT.java b/cameleer-server-app/src/test/java/com/cameleer/server/app/controller/BackpressureIT.java index 2c03c21a..79c0b53e 100644 --- a/cameleer-server-app/src/test/java/com/cameleer/server/app/controller/BackpressureIT.java +++ b/cameleer-server-app/src/test/java/com/cameleer/server/app/controller/BackpressureIT.java @@ -23,16 +23,12 @@ import static org.assertj.core.api.Assertions.assertThat; */ @TestPropertySource(properties = { // Property keys must match the IngestionConfig @ConfigurationProperties - // prefix (cameleer.server.ingestion) exactly — the old "ingestion.*" - // form was silently ignored and the metrics buffer stayed at its - // default of 50_000, which made the 503 overflow scenario unreachable. + // prefix (cameleer.server.ingestion). MetricsFlushScheduler now binds + // its flush interval via SpEL on IngestionConfig, so a single override + // controls both the buffer config and the flush cadence. "cameleer.server.ingestion.buffercapacity=5", "cameleer.server.ingestion.batchsize=5", - "cameleer.server.ingestion.flushintervalms=60000", - // MetricsFlushScheduler's @Scheduled reads ingestion.flush-interval-ms - // (a separate key) — override both so the test doesn't race against - // the default 1s flush during the fill-then-overflow scenario. - "ingestion.flush-interval-ms=60000" + "cameleer.server.ingestion.flushintervalms=60000" }) class BackpressureIT extends AbstractPostgresIT {