Skip to content

Route AEM telemetry by domestic/intl site - #349

Merged
hopelynd merged 7 commits into
mainfrom
feat/telemetry-region-endpoint
Nov 27, 2026
Merged

hopelynd merged 7 commits into
mainfrom
feat/telemetry-region-endpoint

Conversation

@hopelynd

Copy link
Copy Markdown
Collaborator

Summary

  • Route AEM command events to domestic (gm.mmstat.com, pid bailian-cli-node) or Singapore (sg.mmstat.com/aes.1.1, pid bailian-cli-node-intl) by declared auth domain
  • Classify console via consoleSite, apiKey/openapi via model-domain host/region (including cn-hongkong as international), and auth: none as an OR of both
  • Keep cross-site uid/device_id shared and leave backend channel headers unchanged (best-effort site split only)

Description

Command telemetry previously always reported to the domestic Aplus endpoint. This change adds site resolution in telemetryStage after command execution, so the sink can open a keyed Tracker per site.

Model hosts and workspace regions are centralized in model-endpoints.ts (shared with API-key login candidates). Client.url() / upload default-base callbacks record lastResolvedOrigin for decision/prime-style overrides; most traffic still falls back to client.baseUrl. Events carry site and optional siteReason in both local JSONL and AEM ext. Unknown or custom hosts default to domestic.

After rebasing onto first-install ReportedEvent unions, site routing tests must use asCommand before buildRemoteAemOptions.
@hopelynd
hopelynd force-pushed the feat/telemetry-region-endpoint branch from eeffcc5 to 3dfe17b Compare November 26, 2026 02:50
Resolve the conflict in packages/core/src/telemetry/sink.ts between
PR #348 (await in-flight local JSONL writes) and PR #349 (per-site
Tracker map):

- Keep both state holders: inflightLocalWrites (from #348) and
  remoteBySite (from #349). Drop remoteClient / remoteInitialized,
  which initRemoteForSite() fully replaced and nothing references.
- flushTelemetry() drains _sendAll() on every site tracker, then waits
  on local writes and remote sends under the same budget; only remote
  work is abortable on timeout.
- Merge both doc-comment variants into one accurate description.

Verified: vp check (0 errors), 101 core telemetry tests, 65 runtime
flush/exit/telemetry-stage tests.
PR #349 replaced the single global remoteSendEvent with a per-site
Tracker map (entry.sendEvent), but two lines in the checklist and the
first-install call chain still named the removed symbol. They described
a symbol that no longer exists, so a reader following the "no await
before enqueue" rule could not locate it.
@hopelynd
hopelynd merged commit 0cdc4f4 into main Nov 27, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant