refactor(docker): make telemetry env uniform across compose services

DE
16h ago
+24-33

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.env already 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 as env/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 MAE env_file lists.
  • MAE DATAHUB_SERVER_TYPE lives in environment: (quickstart in the base anchor, dev in 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-cdc uses the postgres debug env_file list, like the other debug system-update services.
  • The unused x-datahub-quickstart-telemetry-env anchor is removed.

Effect on rendered compose (container x key, old -> new)

Three containers change, six keys each; nothing else changes.

ContainerScenarioDATAHUB_SERVER_TYPEDATAHUB_TELEMETRY_ENABLEDUSAGE_AGGREGATION_ENABLED..._FLUSH_INTERVAL_SECONDS..._ALIGNMENT_PERIOD_SECONDS..._INCLUDE_AGENT_NAME
datahub-mae-consumer-quickstart-consumersplain compose, profile quickstart-consumersabsent -> quickstartabsent -> trueabsent -> trueabsent -> 30absent -> 3600absent -> true
sameGradle quickstart, allImages; AI smoke leg (both providers)absent -> quickstartabsent -> falseabsent -> trueabsent -> 30absent -> 3600absent -> true
samesmoke-test/run-quickstart.shabsent -> quickstartabsent -> falseabsent -> trueabsent -> 5absent -> 3600absent -> true
sameshell overridesabsent -> shell value (all six)
datahub-mae-consumer-quickstart-consumers-cdcplain compose, profile quickstart-consumers-cdcabsent -> quickstartabsent -> trueabsent -> trueabsent -> 30absent -> 3600absent -> true
sameGradle quickstartCDCabsent -> quickstartabsent -> falseabsent -> trueabsent -> 30absent -> 3600absent -> true
sameshell overridesabsent -> shell value (all six)
system-update-debug-postgres-cdcplain compose, profile debug-postgres-cdcabsent -> devabsent -> trueabsent -> trueabsent -> 30absent -> 3600absent -> true
sameGradle quickstartPgCdcDebugabsent -> devabsent -> falseabsent -> trueabsent -> 30absent -> 3600absent -> true
sameshell overridesabsent -> shell value (all six)

Runtime effect

  • Telemetry is never turned on. An absent DATAHUB_TELEMETRY_ENABLED means the application default (telemetry.enabledServer: true). Gradle, smoke and the AI leg now pass false to these containers; the docker/build.gradle value and the run-quickstart.sh value still win.
  • Inert in MAE: the MAE consumer excludes ScheduledAnalyticsFactory and 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 builds TrackingService, but nothing in datahub-upgrade calls it.
  • One real change: system-update-debug-postgres-cdc now creates the usage-aggregation beans (USAGE_AGGREGATION_ENABLED=true) and reports server type dev instead of the default prod, the same as every other debug system-update service. This is local Micrometer export only.
  • Precedence: MAE DATAHUB_SERVER_TYPE on debug services moves from an env file to environment:, 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. A smoke:<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_SECONDS export: GMS reads 30 from env/common/gms.env before 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-consumers services 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; their DATAHUB_SERVER_TYPE moves to compose environment: because its quickstart/debug default differs.
  • The debug MAE variant file and the unused quickstart telemetry anchor are removed.
  • system-update-debug-postgres-cdc now uses the debug env list, so it enables usage aggregation and reports DATAHUB_SERVER_TYPE=dev.
  • Rendered compose changes cover three containers; the quickstart CLI output is unchanged.