refactor(docker): make telemetry env uniform across compose services
Builds on #21839.
What
Makes the telemetry env (DATAHUB_SERVER_TYPE, DATAHUB_TELEMETRY_ENABLED, USAGE_AGGREGATION_ENABLED, USAGE_AGGREGATION_FLUSH_INTERVAL_SECONDS, USAGE_AGGREGATION_ALIGNMENT_PERIOD_SECONDS, USAGE_AGGREGATION_INCLUDE_AGENT_NAME) uniform across the Docker compose services.
Rule:
- GMS, MCE and MAE: every service carries the keys. Quickstart services get the quickstart values (
DATAHUB_SERVER_TYPE=quickstart), debug services the dev values (DATAHUB_SERVER_TYPE=dev). - system-update: debug services only, as
env/docker/variants/debug/system-update.envalready states. Quickstart system-update services keep none.
Changes:
env/docker/mae-consumer.env: adds the telemetry and usage-aggregation keys as${KEY:-default}opt-ins, the same values asenv/docker/mce-consumer.env.env/docker/variants/debug/mae-consumer.env: deleted (it held only these keys), and its slot removed from the two debug MAEenv_filelists.- MAE
DATAHUB_SERVER_TYPElives inenvironment:(quickstartin the base anchor,devin the dev anchor, explicit on the two postgres quickstart services), as for GMS and MCE: a later env file's${KEY:-default}resolves against the value an earlier file set, so a variant file cannot change this default. system-update-debug-postgres-cdcuses the postgres debugenv_filelist, like the other debug system-update services.- The unused
x-datahub-quickstart-telemetry-envanchor is removed.
Effect on rendered compose (container x key, old -> new)
Three containers change, six keys each; nothing else changes.
| Container | Scenario | DATAHUB_SERVER_TYPE | DATAHUB_TELEMETRY_ENABLED | USAGE_AGGREGATION_ENABLED | ..._FLUSH_INTERVAL_SECONDS | ..._ALIGNMENT_PERIOD_SECONDS | ..._INCLUDE_AGENT_NAME |
|---|---|---|---|---|---|---|---|
datahub-mae-consumer-quickstart-consumers | plain compose, profile quickstart-consumers | absent -> quickstart | absent -> true | absent -> true | absent -> 30 | absent -> 3600 | absent -> true |
| same | Gradle quickstart, allImages; AI smoke leg (both providers) | absent -> quickstart | absent -> false | absent -> true | absent -> 30 | absent -> 3600 | absent -> true |
| same | smoke-test/run-quickstart.sh | absent -> quickstart | absent -> false | absent -> true | absent -> 5 | absent -> 3600 | absent -> true |
| same | shell overrides | absent -> shell value (all six) | |||||
datahub-mae-consumer-quickstart-consumers-cdc | plain compose, profile quickstart-consumers-cdc | absent -> quickstart | absent -> true | absent -> true | absent -> 30 | absent -> 3600 | absent -> true |
| same | Gradle quickstartCDC | absent -> quickstart | absent -> false | absent -> true | absent -> 30 | absent -> 3600 | absent -> true |
| same | shell overrides | absent -> shell value (all six) | |||||
system-update-debug-postgres-cdc | plain compose, profile debug-postgres-cdc | absent -> dev | absent -> true | absent -> true | absent -> 30 | absent -> 3600 | absent -> true |
| same | Gradle quickstartPgCdcDebug | absent -> dev | absent -> false | absent -> true | absent -> 30 | absent -> 3600 | absent -> true |
| same | shell overrides | absent -> shell value (all six) |
Runtime effect
- Telemetry is never turned on. An absent
DATAHUB_TELEMETRY_ENABLEDmeans the application default (telemetry.enabledServer: true). Gradle, smoke and the AI leg now passfalseto these containers; thedocker/build.gradlevalue and therun-quickstart.shvalue still win. - Inert in MAE: the MAE consumer excludes
ScheduledAnalyticsFactoryand does not scan the telemetry or usage-aggregation factory packages, so none of the six keys changes its behaviour. - Inert telemetry in system-update: it excludes
ScheduledAnalyticsFactory(the daily report); it buildsTrackingService, but nothing indatahub-upgradecalls it. - One real change:
system-update-debug-postgres-cdcnow creates the usage-aggregation beans (USAGE_AGGREGATION_ENABLED=true) and reports server typedevinstead of the defaultprod, the same as every other debug system-update service. This is local Micrometer export only. - Precedence: MAE
DATAHUB_SERVER_TYPEon debug services moves from an env file toenvironment:, so under plain compose an ad-hoc or job env file can no longer override it there (Gradle still can, through interpolation). GMS and MCE already behave this way; no env file sets it today.
The runtime effect was checked by reading the code (component scans and callers), not on a running stack.
CLI quickstart
./gradlew :docker:generateQuickstartComposeConfig leaves docker/quickstart/ unchanged: released-CLI users see no change.
Still inline in smoke-test/run-quickstart.sh
DATAHUB_TELEMETRY_ENABLED=false: the shell value reaches every service that names the key. Asmoke:<config>label can pick a debug profile, where it reaches the debug system-update services. The smoke job folder could only match that by also giving every quickstart system-update service the key, which is a further value change. Only the comment is updated.KAFKA_LISTENER_CONCURRENCY=3: the two postgres quickstart MAE services and two MCE services still do not name the key.USAGE_AGGREGATION_FLUSH_INTERVAL_SECONDSexport: GMS reads30fromenv/common/gms.envbefore the job layer, so the job layer's default cannot take effect.
Verification
- Compose env snapshot (bare, shell, smoke, AI and Gradle scenarios) on the base and head branches: the diff is exactly the table above (78 entries). ZDU checked by hand: its job folder sets none of these keys, and its
debug-consumersservices show no change. ./gradlew :docker:generateQuickstartComposeConfig: no change.python3 smoke-test/check_env_parity.py: passes.shellcheck smoke-test/run-quickstart.sh: no warnings (one pre-existing info note).
Checklist
- The PR conforms to DataHub's Contributing Guideline (particularly PR Title Format)
- Links to related issues (if applicable)
- Tests for the changes have been added/updated (if applicable): not applicable, compose env only
- Docs related to the changes have been added/updated (if applicable): not applicable
- For any breaking change/potential downtime/deprecation/big changes an entry has been made in Breaking Changes: not a breaking change
🤖 Generated with Claude Code
Summary by cubic
Makes the telemetry and usage-aggregation environment variables uniform across the Docker compose GMS, MCE, and MAE services. Previously MAE consumers carried none of these keys and system-update-debug-postgres-cdc missed the debug telemetry, so they could report the wrong server type or skip usage exports. The affected containers now carry the same keys as GMS and MCE: quickstart values on quickstart services, dev values on debug services.
- MAE consumers now read the six telemetry and usage keys from
env/docker/mae-consumer.env; theirDATAHUB_SERVER_TYPEmoves to composeenvironment:because its quickstart/debug default differs. - The debug MAE variant file and the unused quickstart telemetry anchor are removed.
system-update-debug-postgres-cdcnow uses the debug env list, so it enables usage aggregation and reportsDATAHUB_SERVER_TYPE=dev.- Rendered compose changes cover three containers; the quickstart CLI output is unchanged.