refactor: hide telemetry field api by default

This commit is contained in:
lingniu
2026-07-01 08:04:59 +08:00
parent 80d3afa80a
commit e745419f76
4 changed files with 10 additions and 6 deletions

View File

@@ -43,7 +43,8 @@ is explicitly deployed.
- Redis is not the long-term historical store.
- `event-file-store` Parquet/DuckDB is not the default history store.
- `telemetry_fields` parsing is not handled by this project when a separate
field parsing service owns that job.
field parsing service owns that job; the `telemetry_fields` query API is
also disabled by default unless `TDENGINE_TELEMETRY_FIELDS_ENABLED=true`.
## Runtime Responsibilities

View File

@@ -121,7 +121,7 @@ class VehicleHistoryAppCompositionTest {
assertThat(context).hasSingleBean(Gb32960DecodedFrameService.class);
assertThat(context).hasSingleBean(LocationHistoryController.class);
assertThat(context).hasSingleBean(RawFrameHistoryController.class);
assertThat(context).hasSingleBean(TelemetryFieldHistoryController.class);
assertThat(context).doesNotHaveBean(TelemetryFieldHistoryController.class);
assertThat(context).doesNotHaveBean(Gb32960FrameController.class);
assertThat(context).doesNotHaveBean(Jt808LocationHistoryController.class);
assertThat(context).doesNotHaveBean(Gb32960NettyServer.class);

View File

@@ -154,6 +154,7 @@ public class EventHistoryAutoConfiguration {
@Bean
@ConditionalOnBean(TdengineHistoryReader.class)
@ConditionalOnProperty(prefix = "lingniu.ingest.tdengine-history", name = "telemetry-fields-enabled", havingValue = "true")
@ConditionalOnMissingBean
public TelemetryFieldHistoryController telemetryFieldHistoryController(TdengineHistoryReader reader) {
return new TelemetryFieldHistoryController(reader);

View File

@@ -120,14 +120,14 @@ class EventHistoryAutoConfigurationTest {
}
@Test
void createsGenericLocationAndTelemetryControllersWhenTdengineReaderExists() {
void createsGenericLocationAndRawControllersWithoutTelemetryFieldsByDefault() {
contextRunner
.withPropertyValues("lingniu.ingest.event-history.enabled=true")
.withBean(TdengineHistoryReader.class, () -> mock(TdengineHistoryReader.class))
.run(context -> {
assertThat(context).hasSingleBean(LocationHistoryController.class);
assertThat(context).hasSingleBean(RawFrameHistoryController.class);
assertThat(context).hasSingleBean(TelemetryFieldHistoryController.class);
assertThat(context).doesNotHaveBean(TelemetryFieldHistoryController.class);
assertThat(context).doesNotHaveBean(Jt808LocationHistoryController.class);
assertThat(context).doesNotHaveBean(Jt808RawFrameHistoryController.class);
});
@@ -152,9 +152,11 @@ class EventHistoryAutoConfigurationTest {
}
@Test
void createsTelemetryFieldHistoryControllerWhenTdengineReaderExists() {
void createsTelemetryFieldHistoryControllerWhenTelemetryFieldsAreEnabled() {
contextRunner
.withPropertyValues("lingniu.ingest.event-history.enabled=true")
.withPropertyValues(
"lingniu.ingest.event-history.enabled=true",
"lingniu.ingest.tdengine-history.telemetry-fields-enabled=true")
.withBean(TdengineHistoryReader.class, () -> mock(TdengineHistoryReader.class))
.run(context -> assertThat(context).hasSingleBean(TelemetryFieldHistoryController.class));
}