fix(metrics): MetricsFlushScheduler honour ingestion config flush interval
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 "<prefix>-<FQN>", 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) <noreply@anthropic.com>
This commit is contained in:
@@ -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<MetricsSnapshot> batch = metricsBuffer.drain(batchSize);
|
||||
|
||||
@@ -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 {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user