mirror of
https://github.com/hyperdxio/hyperdx
synced 2026-04-21 21:37:41 +00:00
## Summary
Deprecate the upstream-deprecated `--feature-gates=clickhouse.json` CLI flag in favor of the per-exporter `json: true` config option, as recommended by the OpenTelemetry ClickHouse exporter v0.149.0.
This introduces a new env var `HYPERDX_OTEL_EXPORTER_CLICKHOUSE_JSON_ENABLE` that controls JSON mode at the exporter config level. The old `OTEL_AGENT_FEATURE_GATE_ARG` env var remains backward-compatible — when it contains `clickhouse.json`, the entrypoint strips that gate, maps it to the new env var, and prints a deprecation warning. Other feature gates are preserved and passed through to the collector.
**Key changes:**
- **`docker/otel-collector/entrypoint.sh`** — Detects `clickhouse.json` in `OTEL_AGENT_FEATURE_GATE_ARG`, strips it, sets `HYPERDX_OTEL_EXPORTER_CLICKHOUSE_JSON_ENABLE=true`, and prints a deprecation warning. Remaining feature gates are still passed through to the collector in both standalone and supervisor modes.
- **`docker/otel-collector/config.standalone.yaml`** — Added `json: ${env:HYPERDX_OTEL_EXPORTER_CLICKHOUSE_JSON_ENABLE:-false}` to both ClickHouse exporter configs
- **`packages/api/src/opamp/controllers/opampController.ts`** — Added `json` field to the `CollectorConfig` type and both ClickHouse exporter configs for OpAMP-managed collectors
- **`docker/otel-collector/supervisor_docker.yaml.tmpl`** — Feature gate pass-through preserved for non-`clickhouse.json` gates (entrypoint strips the deprecated gate before supervisor template renders)
- **`smoke-tests/otel-collector/`** — Added a JSON-enabled otel-collector service and smoke tests verifying:
- `ResourceAttributes` and `LogAttributes` columns in `otel_logs` are `JSON` type (not `Map`)
- Log data with various attribute types (string, int, boolean) is inserted and queryable via JSON path access
### How to test locally or on Vercel
1. Run `yarn dev` to start the dev stack
2. Verify the `otel-collector-json` container starts without errors (the `clickhouse.json` feature gate is stripped, not passed to the collector)
3. Check container logs for the deprecation warning when `OTEL_AGENT_FEATURE_GATE_ARG` contains `clickhouse.json`
4. Verify the non-JSON `otel-collector` service continues to work normally (json defaults to false)
5. Run smoke tests: `cd smoke-tests/otel-collector && bats json-exporter.bats`
### References
- Linear Issue: https://linear.app/hyperdx/issue/HDX-3994
- Upstream deprecation: https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/exporter/clickhouseexporter#experimental-json-support
154 lines
5.8 KiB
YAML
154 lines
5.8 KiB
YAML
name: ${HDX_DEV_PROJECT:-hdx-oss-dev}
|
|
x-hdx-labels: &hdx-labels
|
|
hdx.dev.slot: '${HDX_DEV_SLOT:-0}'
|
|
hdx.dev.branch: '${HDX_DEV_BRANCH:-unknown}'
|
|
hdx.dev.worktree: '${HDX_DEV_WORKTREE:-unknown}'
|
|
services:
|
|
db:
|
|
labels:
|
|
<<: *hdx-labels
|
|
hdx.dev.service: mongodb
|
|
hdx.dev.port: '${HDX_DEV_MONGO_PORT:-27017}'
|
|
image: mongo:5.0.32-focal
|
|
volumes:
|
|
- .volumes/db_dev_${HDX_DEV_SLOT:-0}:/data/db
|
|
ports:
|
|
- '${HDX_DEV_MONGO_PORT:-27017}:27017'
|
|
networks:
|
|
- internal
|
|
otel-collector:
|
|
labels:
|
|
<<: *hdx-labels
|
|
hdx.dev.service: otel-collector
|
|
hdx.dev.port: '${HDX_DEV_OTEL_HTTP_PORT:-4318}'
|
|
hdx.dev.url: 'http://localhost:${HDX_DEV_OTEL_HTTP_PORT:-4318}'
|
|
build:
|
|
context: .
|
|
dockerfile: docker/otel-collector/Dockerfile
|
|
target: dev
|
|
args:
|
|
OTEL_COLLECTOR_VERSION: ${OTEL_COLLECTOR_VERSION}
|
|
OTEL_COLLECTOR_CORE_VERSION: ${OTEL_COLLECTOR_CORE_VERSION}
|
|
environment:
|
|
CLICKHOUSE_ENDPOINT: 'tcp://ch-server:9000?dial_timeout=10s'
|
|
CLICKHOUSE_PROMETHEUS_METRICS_ENDPOINT: 'ch-server:9363'
|
|
HYPERDX_OTEL_EXPORTER_CLICKHOUSE_DATABASE: ${HYPERDX_OTEL_EXPORTER_CLICKHOUSE_DATABASE}
|
|
HYPERDX_API_KEY: ${HYPERDX_API_KEY}
|
|
HYPERDX_LOG_LEVEL: ${HYPERDX_LOG_LEVEL}
|
|
OPAMP_SERVER_URL: 'http://host.docker.internal:${HYPERDX_OPAMP_PORT:-4320}'
|
|
CUSTOM_OTELCOL_CONFIG_FILE: '/etc/otelcol-contrib/custom.config.yaml'
|
|
# Uncomment to enable stdout logging for the OTel collector
|
|
OTEL_SUPERVISOR_LOGS: 'true'
|
|
HYPERDX_OTEL_EXPORTER_TABLES_TTL: '24h'
|
|
volumes:
|
|
- ./docker/otel-collector/config.yaml:/etc/otelcol-contrib/config.yaml
|
|
- ./docker/otel-collector/supervisor_docker.yaml.tmpl:/etc/otel/supervisor.yaml.tmpl
|
|
# Add a custom config file
|
|
- ./docker/otel-collector/custom.config.yaml:/etc/otelcol-contrib/custom.config.yaml
|
|
ports:
|
|
- '${HDX_DEV_OTEL_HEALTH_PORT:-13133}:13133' # health_check extension
|
|
- '${HDX_DEV_OTEL_GRPC_PORT:-4317}:4317' # OTLP gRPC receiver
|
|
- '${HDX_DEV_OTEL_HTTP_PORT:-4318}:4318' # OTLP http receiver
|
|
- '${HDX_DEV_OTEL_METRICS_PORT:-8888}:8888' # metrics extension
|
|
restart: always
|
|
networks:
|
|
- internal
|
|
depends_on:
|
|
ch-server:
|
|
condition: service_healthy
|
|
otel-collector-json:
|
|
labels:
|
|
<<: *hdx-labels
|
|
hdx.dev.service: otel-collector-json
|
|
hdx.dev.port: '${HDX_DEV_OTEL_JSON_HTTP_PORT:-14318}'
|
|
hdx.dev.url: 'http://localhost:${HDX_DEV_OTEL_JSON_HTTP_PORT:-14318}'
|
|
build:
|
|
context: .
|
|
dockerfile: docker/otel-collector/Dockerfile
|
|
target: dev
|
|
args:
|
|
OTEL_COLLECTOR_VERSION: ${OTEL_COLLECTOR_VERSION}
|
|
OTEL_COLLECTOR_CORE_VERSION: ${OTEL_COLLECTOR_CORE_VERSION}
|
|
environment:
|
|
CLICKHOUSE_ENDPOINT: 'tcp://ch-server:9000?dial_timeout=10s'
|
|
CLICKHOUSE_PROMETHEUS_METRICS_ENDPOINT: 'ch-server:9363'
|
|
HYPERDX_OTEL_EXPORTER_CLICKHOUSE_DATABASE: 'otel_json'
|
|
HYPERDX_OTEL_EXPORTER_CREATE_LEGACY_SCHEMA: 'true'
|
|
HYPERDX_API_KEY: ${HYPERDX_API_KEY}
|
|
HYPERDX_LOG_LEVEL: ${HYPERDX_LOG_LEVEL}
|
|
OPAMP_SERVER_URL: 'http://host.docker.internal:${HYPERDX_OPAMP_PORT:-4320}'
|
|
CUSTOM_OTELCOL_CONFIG_FILE: '/etc/otelcol-contrib/custom.config.yaml'
|
|
# Uncomment to enable stdout logging for the OTel collector
|
|
OTEL_SUPERVISOR_LOGS: 'true'
|
|
# Enable JSON schema in the ClickHouse exporter (per-exporter config)
|
|
# Be sure to also set BETA_CH_OTEL_JSON_SCHEMA_ENABLED to 'true' in ch-server
|
|
HYPERDX_OTEL_EXPORTER_CLICKHOUSE_JSON_ENABLE: 'true'
|
|
volumes:
|
|
- ./docker/otel-collector/config.yaml:/etc/otelcol-contrib/config.yaml
|
|
- ./docker/otel-collector/supervisor_docker.yaml.tmpl:/etc/otel/supervisor.yaml.tmpl
|
|
ports:
|
|
- '${HDX_DEV_OTEL_JSON_HTTP_PORT:-14318}:4318' # OTLP http receiver
|
|
restart: always
|
|
networks:
|
|
- internal
|
|
depends_on:
|
|
ch-server:
|
|
condition: service_healthy
|
|
ch-server:
|
|
labels:
|
|
<<: *hdx-labels
|
|
hdx.dev.service: clickhouse
|
|
hdx.dev.port: '${HDX_DEV_CH_HTTP_PORT:-8123}'
|
|
hdx.dev.url: 'http://localhost:${HDX_DEV_CH_HTTP_PORT:-8123}'
|
|
image: clickhouse/clickhouse-server:26.1-alpine
|
|
ports:
|
|
- '${HDX_DEV_CH_HTTP_PORT:-8123}:8123' # http api
|
|
- '${HDX_DEV_CH_NATIVE_PORT:-9000}:9000' # native
|
|
environment:
|
|
# default settings
|
|
CLICKHOUSE_DEFAULT_ACCESS_MANAGEMENT: 1
|
|
HYPERDX_OTEL_EXPORTER_CLICKHOUSE_DATABASE: ${HYPERDX_OTEL_EXPORTER_CLICKHOUSE_DATABASE}
|
|
# Set to 'true' to allow for proper OTel JSON Schema creation
|
|
# Be sure to also set HYPERDX_OTEL_EXPORTER_CLICKHOUSE_JSON_ENABLE in otel-collector
|
|
# BETA_CH_OTEL_JSON_SCHEMA_ENABLED: 'true'
|
|
volumes:
|
|
- ./docker/clickhouse/local/config.xml:/etc/clickhouse-server/config.xml
|
|
- ./docker/clickhouse/local/users.xml:/etc/clickhouse-server/users.xml
|
|
- .volumes/ch_data_dev_${HDX_DEV_SLOT:-0}:/var/lib/clickhouse
|
|
- .volumes/ch_logs_dev_${HDX_DEV_SLOT:-0}:/var/log/clickhouse-server
|
|
restart: on-failure
|
|
networks:
|
|
- internal
|
|
healthcheck:
|
|
test:
|
|
wget -O /dev/null --no-verbose --tries=1 http://127.0.0.1:8123/ping ||
|
|
exit 1
|
|
interval: 1s
|
|
timeout: 1s
|
|
retries: 60
|
|
|
|
# nginx:
|
|
# image: nginx:alpine
|
|
# ports:
|
|
# - '4040:4040'
|
|
# volumes:
|
|
# - ./proxy/nginx/nginx.conf.template:/etc/nginx/templates/default.conf.template:ro
|
|
# environment:
|
|
# HYPERDX_BASE_PATH: ${HYPERDX_BASE_PATH:-/}
|
|
# network_mode: host
|
|
# restart: always
|
|
|
|
# traefik:
|
|
# image: traefik:latest
|
|
# ports:
|
|
# - '4040:4040'
|
|
# volumes:
|
|
# - ./proxy/traefik/traefik.yml:/etc/traefik/traefik.yml:ro
|
|
# - ./proxy/traefik/config.yml:/etc/traefik/dynamic/config.yml:ro
|
|
# environment:
|
|
# HYPERDX_BASE_PATH: ${HYPERDX_BASE_PATH:-/}
|
|
# network_mode: host
|
|
# restart: always
|
|
|
|
networks:
|
|
internal:
|