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 com.zaxxer.hikari.HikariDataSource;
|
||||||
import org.springframework.beans.factory.annotation.Qualifier;
|
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.autoconfigure.jdbc.DataSourceProperties;
|
||||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
@@ -14,7 +13,6 @@ import javax.sql.DataSource;
|
|||||||
|
|
||||||
@Configuration
|
@Configuration
|
||||||
@EnableConfigurationProperties(ClickHouseProperties.class)
|
@EnableConfigurationProperties(ClickHouseProperties.class)
|
||||||
@ConditionalOnProperty(name = "cameleer.server.clickhouse.enabled", havingValue = "true")
|
|
||||||
public class ClickHouseConfig {
|
public class ClickHouseConfig {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ package com.cameleer3.server.app.config;
|
|||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Qualifier;
|
import org.springframework.beans.factory.annotation.Qualifier;
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
|
||||||
import org.springframework.boot.context.event.ApplicationReadyEvent;
|
import org.springframework.boot.context.event.ApplicationReadyEvent;
|
||||||
import org.springframework.context.event.EventListener;
|
import org.springframework.context.event.EventListener;
|
||||||
import org.springframework.core.io.Resource;
|
import org.springframework.core.io.Resource;
|
||||||
@@ -14,7 +13,6 @@ import org.springframework.stereotype.Component;
|
|||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@ConditionalOnProperty(name = "cameleer.server.clickhouse.enabled", havingValue = "true")
|
|
||||||
public class ClickHouseSchemaInitializer {
|
public class ClickHouseSchemaInitializer {
|
||||||
|
|
||||||
private static final Logger log = LoggerFactory.getLogger(ClickHouseSchemaInitializer.class);
|
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.MergedExecution;
|
||||||
import com.cameleer3.server.core.ingestion.WriteBuffer;
|
import com.cameleer3.server.core.ingestion.WriteBuffer;
|
||||||
import com.cameleer3.server.core.storage.model.MetricsSnapshot;
|
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.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates the write buffer bean for metrics.
|
* Creates write buffer beans for the ingestion pipeline.
|
||||||
* <p>
|
* <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)
|
* {@link com.cameleer3.server.core.ingestion.IngestionService} (producer side)
|
||||||
* and the flush scheduler (consumer side).
|
* and the flush scheduler (consumer side).
|
||||||
*/
|
*/
|
||||||
@@ -25,19 +24,16 @@ public class IngestionBeanConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
@ConditionalOnProperty(name = "cameleer.server.clickhouse.enabled", havingValue = "true")
|
|
||||||
public WriteBuffer<MergedExecution> executionBuffer(IngestionConfig config) {
|
public WriteBuffer<MergedExecution> executionBuffer(IngestionConfig config) {
|
||||||
return new WriteBuffer<>(config.getBufferCapacity());
|
return new WriteBuffer<>(config.getBufferCapacity());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
@ConditionalOnProperty(name = "cameleer.server.clickhouse.enabled", havingValue = "true")
|
|
||||||
public WriteBuffer<ChunkAccumulator.ProcessorBatch> processorBatchBuffer(IngestionConfig config) {
|
public WriteBuffer<ChunkAccumulator.ProcessorBatch> processorBatchBuffer(IngestionConfig config) {
|
||||||
return new WriteBuffer<>(config.getBufferCapacity());
|
return new WriteBuffer<>(config.getBufferCapacity());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
@ConditionalOnProperty(name = "cameleer.server.clickhouse.enabled", havingValue = "true")
|
|
||||||
public WriteBuffer<BufferedLogEntry> logBuffer(IngestionConfig config) {
|
public WriteBuffer<BufferedLogEntry> logBuffer(IngestionConfig config) {
|
||||||
return new WriteBuffer<>(config.getBufferCapacity());
|
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 com.cameleer3.server.core.storage.model.MetricsSnapshot;
|
||||||
import org.springframework.beans.factory.annotation.Qualifier;
|
import org.springframework.beans.factory.annotation.Qualifier;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
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.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.jdbc.core.JdbcTemplate;
|
import org.springframework.jdbc.core.JdbcTemplate;
|
||||||
@@ -165,7 +164,6 @@ public class StorageBeanConfig {
|
|||||||
// ── Usage Analytics ──────────────────────────────────────────────
|
// ── Usage Analytics ──────────────────────────────────────────────
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
@ConditionalOnProperty(name = "cameleer.server.clickhouse.enabled", havingValue = "true")
|
|
||||||
public ClickHouseUsageTracker clickHouseUsageTracker(
|
public ClickHouseUsageTracker clickHouseUsageTracker(
|
||||||
TenantProperties tenantProperties,
|
TenantProperties tenantProperties,
|
||||||
@Qualifier("clickHouseJdbcTemplate") JdbcTemplate clickHouseJdbc) {
|
@Qualifier("clickHouseJdbcTemplate") JdbcTemplate clickHouseJdbc) {
|
||||||
@@ -174,14 +172,12 @@ public class StorageBeanConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
@ConditionalOnProperty(name = "cameleer.server.clickhouse.enabled", havingValue = "true")
|
|
||||||
public com.cameleer3.server.app.analytics.UsageTrackingInterceptor usageTrackingInterceptor(
|
public com.cameleer3.server.app.analytics.UsageTrackingInterceptor usageTrackingInterceptor(
|
||||||
ClickHouseUsageTracker usageTracker) {
|
ClickHouseUsageTracker usageTracker) {
|
||||||
return new com.cameleer3.server.app.analytics.UsageTrackingInterceptor(usageTracker);
|
return new com.cameleer3.server.app.analytics.UsageTrackingInterceptor(usageTracker);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
@ConditionalOnProperty(name = "cameleer.server.clickhouse.enabled", havingValue = "true")
|
|
||||||
public com.cameleer3.server.app.analytics.UsageFlushScheduler usageFlushScheduler(
|
public com.cameleer3.server.app.analytics.UsageFlushScheduler usageFlushScheduler(
|
||||||
ClickHouseUsageTracker usageTracker) {
|
ClickHouseUsageTracker usageTracker) {
|
||||||
return new com.cameleer3.server.app.analytics.UsageFlushScheduler(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).
|
* Ingestion endpoint for execution chunk data (ClickHouse pipeline).
|
||||||
* <p>
|
* <p>
|
||||||
* Accepts single or array {@link ExecutionChunk} payloads and feeds them
|
* Accepts single or array {@link ExecutionChunk} payloads and feeds them
|
||||||
* into the {@link ChunkAccumulator}. Only active when
|
* into the {@link ChunkAccumulator}.
|
||||||
* {@code clickhouse.enabled=true} (conditional on the accumulator bean).
|
|
||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/api/v1/data")
|
@RequestMapping("/api/v1/data")
|
||||||
|
|||||||
@@ -75,7 +75,6 @@ cameleer:
|
|||||||
oidctlsskipverify: ${CAMELEER_SERVER_SECURITY_OIDCTLSSKIPVERIFY:false}
|
oidctlsskipverify: ${CAMELEER_SERVER_SECURITY_OIDCTLSSKIPVERIFY:false}
|
||||||
corsallowedorigins: ${CAMELEER_SERVER_SECURITY_CORSALLOWEDORIGINS:}
|
corsallowedorigins: ${CAMELEER_SERVER_SECURITY_CORSALLOWEDORIGINS:}
|
||||||
clickhouse:
|
clickhouse:
|
||||||
enabled: ${CAMELEER_SERVER_CLICKHOUSE_ENABLED:true}
|
|
||||||
url: ${CAMELEER_SERVER_CLICKHOUSE_URL:jdbc:clickhouse://localhost:8123/cameleer}
|
url: ${CAMELEER_SERVER_CLICKHOUSE_URL:jdbc:clickhouse://localhost:8123/cameleer}
|
||||||
username: ${CAMELEER_SERVER_CLICKHOUSE_USERNAME:default}
|
username: ${CAMELEER_SERVER_CLICKHOUSE_USERNAME:default}
|
||||||
password: ${CAMELEER_SERVER_CLICKHOUSE_PASSWORD:}
|
password: ${CAMELEER_SERVER_CLICKHOUSE_PASSWORD:}
|
||||||
|
|||||||
@@ -41,9 +41,8 @@ public abstract class AbstractPostgresIT {
|
|||||||
registry.add("spring.flyway.url", postgres::getJdbcUrl);
|
registry.add("spring.flyway.url", postgres::getJdbcUrl);
|
||||||
registry.add("spring.flyway.user", postgres::getUsername);
|
registry.add("spring.flyway.user", postgres::getUsername);
|
||||||
registry.add("spring.flyway.password", postgres::getPassword);
|
registry.add("spring.flyway.password", postgres::getPassword);
|
||||||
registry.add("clickhouse.enabled", () -> "true");
|
registry.add("cameleer.server.clickhouse.url", clickhouse::getJdbcUrl);
|
||||||
registry.add("clickhouse.url", clickhouse::getJdbcUrl);
|
registry.add("cameleer.server.clickhouse.username", clickhouse::getUsername);
|
||||||
registry.add("clickhouse.username", clickhouse::getUsername);
|
registry.add("cameleer.server.clickhouse.password", clickhouse::getPassword);
|
||||||
registry.add("clickhouse.password", clickhouse::getPassword);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -70,8 +70,6 @@ spec:
|
|||||||
name: cameleer-auth
|
name: cameleer-auth
|
||||||
key: CAMELEER_SERVER_SECURITY_JWTSECRET
|
key: CAMELEER_SERVER_SECURITY_JWTSECRET
|
||||||
optional: true
|
optional: true
|
||||||
- name: CAMELEER_SERVER_CLICKHOUSE_ENABLED
|
|
||||||
value: "true"
|
|
||||||
- name: CAMELEER_SERVER_CLICKHOUSE_URL
|
- name: CAMELEER_SERVER_CLICKHOUSE_URL
|
||||||
value: "jdbc:clickhouse://clickhouse.cameleer.svc.cluster.local:8123/cameleer"
|
value: "jdbc:clickhouse://clickhouse.cameleer.svc.cluster.local:8123/cameleer"
|
||||||
- name: CAMELEER_SERVER_CLICKHOUSE_USERNAME
|
- name: CAMELEER_SERVER_CLICKHOUSE_USERNAME
|
||||||
|
|||||||
Reference in New Issue
Block a user