Skip to content

Commit af53cc6

Browse files
committed
refactor: deprecate clickhouse.json feature gate in favor of per-exporter json config
Replace the deprecated --feature-gates=clickhouse.json CLI flag with the per-exporter json: true config option, as recommended by the upstream OpenTelemetry ClickHouse exporter (v0.149.0). Changes: - Add HYPERDX_CLICKHOUSE_JSON_ENABLED env var to replace OTEL_AGENT_FEATURE_GATE_ARG - Add json field to ClickHouse exporter configs in opampController.ts - Add json field to standalone config (config.standalone.yaml) - Update entrypoint.sh to detect JSON mode via the new env var - Remove feature gate pass-through from supervisor template and entrypoint - Update docker-compose.dev.yml comments and env vars Ref: HDX-3994
1 parent 6e9a553 commit af53cc6

5 files changed

Lines changed: 11 additions & 14 deletions

File tree

docker-compose.dev.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,9 @@ services:
8080
CUSTOM_OTELCOL_CONFIG_FILE: '/etc/otelcol-contrib/custom.config.yaml'
8181
# Uncomment to enable stdout logging for the OTel collector
8282
OTEL_SUPERVISOR_LOGS: 'true'
83-
# Uncomment to enable JSON schema in ClickHouse
83+
# Enable JSON schema in the ClickHouse exporter (per-exporter config)
8484
# Be sure to also set BETA_CH_OTEL_JSON_SCHEMA_ENABLED to 'true' in ch-server
85-
OTEL_AGENT_FEATURE_GATE_ARG: '--feature-gates=clickhouse.json'
85+
HYPERDX_CLICKHOUSE_JSON_ENABLED: 'true'
8686
volumes:
8787
- ./docker/otel-collector/config.yaml:/etc/otelcol-contrib/config.yaml
8888
- ./docker/otel-collector/supervisor_docker.yaml.tmpl:/etc/otel/supervisor.yaml.tmpl
@@ -109,7 +109,7 @@ services:
109109
CLICKHOUSE_DEFAULT_ACCESS_MANAGEMENT: 1
110110
HYPERDX_OTEL_EXPORTER_CLICKHOUSE_DATABASE: ${HYPERDX_OTEL_EXPORTER_CLICKHOUSE_DATABASE}
111111
# Set to 'true' to allow for proper OTel JSON Schema creation
112-
# Be sure to also set the OTEL_AGENT_FEATURE_GATE_ARG env in otel-collector
112+
# Be sure to also set HYPERDX_CLICKHOUSE_JSON_ENABLED in otel-collector
113113
# BETA_CH_OTEL_JSON_SCHEMA_ENABLED: 'true'
114114
volumes:
115115
- ./docker/clickhouse/local/config.xml:/etc/clickhouse-server/config.xml

docker/otel-collector/config.standalone.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ exporters:
3333
logs_table_name: hyperdx_sessions
3434
timeout: 5s
3535
create_schema: ${env:HYPERDX_OTEL_EXPORTER_CREATE_LEGACY_SCHEMA:-false}
36+
json: ${env:HYPERDX_CLICKHOUSE_JSON_ENABLED:-false}
3637
retry_on_failure:
3738
enabled: true
3839
initial_interval: 5s
@@ -46,6 +47,7 @@ exporters:
4647
ttl: 720h
4748
timeout: 5s
4849
create_schema: ${env:HYPERDX_OTEL_EXPORTER_CREATE_LEGACY_SCHEMA:-false}
50+
json: ${env:HYPERDX_CLICKHOUSE_JSON_ENABLED:-false}
4951
retry_on_failure:
5052
enabled: true
5153
initial_interval: 5s

docker/otel-collector/entrypoint.sh

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#!/bin/sh
22
set -e
33

4-
# Fall back to legacy schema when the ClickHouse JSON feature gate is enabled
5-
if echo "$OTEL_AGENT_FEATURE_GATE_ARG" | grep -q "clickhouse.json"; then
4+
# Fall back to legacy schema when ClickHouse JSON exporter mode is enabled
5+
if [ "$HYPERDX_CLICKHOUSE_JSON_ENABLED" = "true" ]; then
66
export HYPERDX_OTEL_EXPORTER_CREATE_LEGACY_SCHEMA=true
77
fi
88

@@ -39,11 +39,6 @@ if [ -z "$OPAMP_SERVER_URL" ]; then
3939
COLLECTOR_ARGS="$COLLECTOR_ARGS --config $CUSTOM_OTELCOL_CONFIG_FILE"
4040
fi
4141

42-
# Pass feature gates to the collector in standalone mode
43-
if [ -n "$OTEL_AGENT_FEATURE_GATE_ARG" ]; then
44-
COLLECTOR_ARGS="$COLLECTOR_ARGS $OTEL_AGENT_FEATURE_GATE_ARG"
45-
fi
46-
4742
# Execute collector directly
4843
exec /otelcontribcol $COLLECTOR_ARGS
4944
else

docker/otel-collector/supervisor_docker.yaml.tmpl

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,6 @@ agent:
2323
{{- if getenv "CUSTOM_OTELCOL_CONFIG_FILE" }}
2424
- {{ getenv "CUSTOM_OTELCOL_CONFIG_FILE" }}
2525
{{- end }}
26-
args:
27-
{{- if getenv "OTEL_AGENT_FEATURE_GATE_ARG" }}
28-
- {{ getenv "OTEL_AGENT_FEATURE_GATE_ARG" }}
29-
{{- end }}
3026

3127
storage:
3228
directory: /etc/otel/supervisor-data/

packages/api/src/opamp/controllers/opampController.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ type CollectorConfig = {
8282
logs_table_name: string;
8383
timeout: string;
8484
create_schema: string;
85+
json: string;
8586
retry_on_failure: {
8687
enabled: boolean;
8788
initial_interval: string;
@@ -97,6 +98,7 @@ type CollectorConfig = {
9798
ttl: string;
9899
timeout: string;
99100
create_schema: string;
101+
json: string;
100102
retry_on_failure: {
101103
enabled: boolean;
102104
initial_interval: string;
@@ -205,6 +207,7 @@ export const buildOtelCollectorConfig = (
205207
timeout: '5s',
206208
create_schema:
207209
'${env:HYPERDX_OTEL_EXPORTER_CREATE_LEGACY_SCHEMA:-false}',
210+
json: '${env:HYPERDX_CLICKHOUSE_JSON_ENABLED:-false}',
208211
retry_on_failure: {
209212
enabled: true,
210213
initial_interval: '5s',
@@ -221,6 +224,7 @@ export const buildOtelCollectorConfig = (
221224
timeout: '5s',
222225
create_schema:
223226
'${env:HYPERDX_OTEL_EXPORTER_CREATE_LEGACY_SCHEMA:-false}',
227+
json: '${env:HYPERDX_CLICKHOUSE_JSON_ENABLED:-false}',
224228
retry_on_failure: {
225229
enabled: true,
226230
initial_interval: '5s',

0 commit comments

Comments
 (0)