Remove vestigial clickhouse.enabled flag
ClickHouse is the only storage backend — there is no alternative. The enabled flag created a false sense of optionality: setting it to false would crash on startup because most beans unconditionally depend on the ClickHouse JdbcTemplate. Remove all @ConditionalOnProperty annotations gating ClickHouse beans, the enabled property from application.yml, and the K8s manifest entry. Also fix old property names in AbstractPostgresIT test config. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -2,7 +2,6 @@ package com.cameleer3.server.app.config;
|
||||
|
||||
import com.zaxxer.hikari.HikariDataSource;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.boot.autoconfigure.jdbc.DataSourceProperties;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
@@ -14,7 +13,6 @@ import javax.sql.DataSource;
|
||||
|
||||
@Configuration
|
||||
@EnableConfigurationProperties(ClickHouseProperties.class)
|
||||
@ConditionalOnProperty(name = "cameleer.server.clickhouse.enabled", havingValue = "true")
|
||||
public class ClickHouseConfig {
|
||||
|
||||
/**
|
||||
|
||||
@@ -3,7 +3,6 @@ package com.cameleer3.server.app.config;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.boot.context.event.ApplicationReadyEvent;
|
||||
import org.springframework.context.event.EventListener;
|
||||
import org.springframework.core.io.Resource;
|
||||
@@ -14,7 +13,6 @@ import org.springframework.stereotype.Component;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
@Component
|
||||
@ConditionalOnProperty(name = "cameleer.server.clickhouse.enabled", havingValue = "true")
|
||||
public class ClickHouseSchemaInitializer {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(ClickHouseSchemaInitializer.class);
|
||||
|
||||
@@ -5,14 +5,13 @@ import com.cameleer3.server.core.ingestion.ChunkAccumulator;
|
||||
import com.cameleer3.server.core.ingestion.MergedExecution;
|
||||
import com.cameleer3.server.core.ingestion.WriteBuffer;
|
||||
import com.cameleer3.server.core.storage.model.MetricsSnapshot;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* Creates the write buffer bean for metrics.
|
||||
* Creates write buffer beans for the ingestion pipeline.
|
||||
* <p>
|
||||
* The {@link WriteBuffer} instance is shared between the
|
||||
* Each {@link WriteBuffer} instance is shared between the
|
||||
* {@link com.cameleer3.server.core.ingestion.IngestionService} (producer side)
|
||||
* and the flush scheduler (consumer side).
|
||||
*/
|
||||
@@ -25,19 +24,16 @@ public class IngestionBeanConfig {
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnProperty(name = "cameleer.server.clickhouse.enabled", havingValue = "true")
|
||||
public WriteBuffer<MergedExecution> executionBuffer(IngestionConfig config) {
|
||||
return new WriteBuffer<>(config.getBufferCapacity());
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnProperty(name = "cameleer.server.clickhouse.enabled", havingValue = "true")
|
||||
public WriteBuffer<ChunkAccumulator.ProcessorBatch> processorBatchBuffer(IngestionConfig config) {
|
||||
return new WriteBuffer<>(config.getBufferCapacity());
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnProperty(name = "cameleer.server.clickhouse.enabled", havingValue = "true")
|
||||
public WriteBuffer<BufferedLogEntry> logBuffer(IngestionConfig config) {
|
||||
return new WriteBuffer<>(config.getBufferCapacity());
|
||||
}
|
||||
|
||||
@@ -28,7 +28,6 @@ import com.cameleer3.server.core.storage.StatsStore;
|
||||
import com.cameleer3.server.core.storage.model.MetricsSnapshot;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
@@ -165,7 +164,6 @@ public class StorageBeanConfig {
|
||||
// ── Usage Analytics ──────────────────────────────────────────────
|
||||
|
||||
@Bean
|
||||
@ConditionalOnProperty(name = "cameleer.server.clickhouse.enabled", havingValue = "true")
|
||||
public ClickHouseUsageTracker clickHouseUsageTracker(
|
||||
TenantProperties tenantProperties,
|
||||
@Qualifier("clickHouseJdbcTemplate") JdbcTemplate clickHouseJdbc) {
|
||||
@@ -174,14 +172,12 @@ public class StorageBeanConfig {
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnProperty(name = "cameleer.server.clickhouse.enabled", havingValue = "true")
|
||||
public com.cameleer3.server.app.analytics.UsageTrackingInterceptor usageTrackingInterceptor(
|
||||
ClickHouseUsageTracker usageTracker) {
|
||||
return new com.cameleer3.server.app.analytics.UsageTrackingInterceptor(usageTracker);
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnProperty(name = "cameleer.server.clickhouse.enabled", havingValue = "true")
|
||||
public com.cameleer3.server.app.analytics.UsageFlushScheduler usageFlushScheduler(
|
||||
ClickHouseUsageTracker usageTracker) {
|
||||
return new com.cameleer3.server.app.analytics.UsageFlushScheduler(usageTracker);
|
||||
|
||||
@@ -23,8 +23,7 @@ import java.util.List;
|
||||
* Ingestion endpoint for execution chunk data (ClickHouse pipeline).
|
||||
* <p>
|
||||
* Accepts single or array {@link ExecutionChunk} payloads and feeds them
|
||||
* into the {@link ChunkAccumulator}. Only active when
|
||||
* {@code clickhouse.enabled=true} (conditional on the accumulator bean).
|
||||
* into the {@link ChunkAccumulator}.
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/api/v1/data")
|
||||
|
||||
@@ -75,7 +75,6 @@ cameleer:
|
||||
oidctlsskipverify: ${CAMELEER_SERVER_SECURITY_OIDCTLSSKIPVERIFY:false}
|
||||
corsallowedorigins: ${CAMELEER_SERVER_SECURITY_CORSALLOWEDORIGINS:}
|
||||
clickhouse:
|
||||
enabled: ${CAMELEER_SERVER_CLICKHOUSE_ENABLED:true}
|
||||
url: ${CAMELEER_SERVER_CLICKHOUSE_URL:jdbc:clickhouse://localhost:8123/cameleer}
|
||||
username: ${CAMELEER_SERVER_CLICKHOUSE_USERNAME:default}
|
||||
password: ${CAMELEER_SERVER_CLICKHOUSE_PASSWORD:}
|
||||
|
||||
@@ -41,9 +41,8 @@ public abstract class AbstractPostgresIT {
|
||||
registry.add("spring.flyway.url", postgres::getJdbcUrl);
|
||||
registry.add("spring.flyway.user", postgres::getUsername);
|
||||
registry.add("spring.flyway.password", postgres::getPassword);
|
||||
registry.add("clickhouse.enabled", () -> "true");
|
||||
registry.add("clickhouse.url", clickhouse::getJdbcUrl);
|
||||
registry.add("clickhouse.username", clickhouse::getUsername);
|
||||
registry.add("clickhouse.password", clickhouse::getPassword);
|
||||
registry.add("cameleer.server.clickhouse.url", clickhouse::getJdbcUrl);
|
||||
registry.add("cameleer.server.clickhouse.username", clickhouse::getUsername);
|
||||
registry.add("cameleer.server.clickhouse.password", clickhouse::getPassword);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,8 +70,6 @@ spec:
|
||||
name: cameleer-auth
|
||||
key: CAMELEER_SERVER_SECURITY_JWTSECRET
|
||||
optional: true
|
||||
- name: CAMELEER_SERVER_CLICKHOUSE_ENABLED
|
||||
value: "true"
|
||||
- name: CAMELEER_SERVER_CLICKHOUSE_URL
|
||||
value: "jdbc:clickhouse://clickhouse.cameleer.svc.cluster.local:8123/cameleer"
|
||||
- name: CAMELEER_SERVER_CLICKHOUSE_USERNAME
|
||||
|
||||
Reference in New Issue
Block a user