Skip to content

feat(logging): new telemetry design MONGOSH-3408, MONGOSH-3376, MONGOSH-3406#2751

Merged
alenakhineika merged 43 commits into
mainfrom
MONGOSH-3408-telemetry-aggregation
Jul 22, 2026
Merged

feat(logging): new telemetry design MONGOSH-3408, MONGOSH-3376, MONGOSH-3406#2751
alenakhineika merged 43 commits into
mainfrom
MONGOSH-3408-telemetry-aggregation

Conversation

@alenakhineika

@alenakhineika alenakhineika commented Jun 30, 2026

Copy link
Copy Markdown
Collaborator
  • Replace the Segment analytics integration with a self-hosted fire-and-forget HTTP transport (an intermediate step before integrating with CloudFront). Only TelemetryClient knows about the endpoint URL and HTTP format.
  • The previous design sent one analytics event per user action (14 event types); this PR reduces that to three events per session: Identify (device and OS traits), New Connection (connection metadata including topology type, SRV, CSFLE), and Session Ended (aggregated session summary emitted once at close).
  • Session data is accumulated incrementally in SessionTelemetryState as the user works, command counts split by REPL vs rc/eval context, error count, snippet count, startup timings, sequence of commands capped at 100, and flushed into a single end-of-session event. The event is only emitted for interactive sessions or identified agentic sessions. Containerized non-interactive non-agentic runs are excluded.
  • The internal get-os-info.ts implementation is replaced with the shared @mongodb-js/get-os-info package.
  • Use device_id as the sole telemetry user identifier. Remove userId and telemetryAnonymousId (config fields, validators, payload, and the mongosh:new-user/mongosh:update-user bus events).
  • Key ThrottledAnalytics cross-session throttle state on device_id instead of anonymousId.
  • Add telemetryEndpoint as a CliUserConfig option (with URL validator) carrying the production default. Allow resolving the endpoint as override via MONGOSH_TELEMETRY_ENDPOINT env variable.
  • When no endpoint is configured, the telemetry is not sent over the network, but still can be enabled and events are still written to the local log.
  • Remove the IS_MONGOSH_EVERGREEN_CI guard and the analyticsOptions/alwaysEnable constructor option (endpoint overrides now via env or config, consistent with updateURL).
  • Read user/global config before setting up analytics/telemetry, so the configured telemetry endpoint is honored (safe now that the new-user flow is gone). Defer setup errors until logging is in place.
  • Extract analytics wiring into packages/cli-repl/src/setup-analytics.ts (setupTelemetryAnalytics() + AnalyticsOptions), leaving setupAnalytics() a thin wrapper.
  • Split the telemetry/logging tests out of cli-repl.spec.ts into new cli-repl-telemetry.spec.ts (fake-server integration), cli-repl-logging.spec.ts (logging config), and setup-analytics.spec.ts (pure-function unit tests); kept log-based unit tests in cli-repl.spec.ts.
  • Close each CliRepl instance in a top-level afterEach so per-test resources (driver connections, log writers, process listeners) don't accumulate - the full cli-repl suite now runs within the default heap instead of OOMing.
  • Update logging, cli-repl, types, and e2e specs and the cli-repl README for the new telemetry model.

Comment thread packages/logging/src/telemetry-client.ts Outdated
@alenakhineika
alenakhineika marked this pull request as ready for review July 1, 2026 13:35
@alenakhineika
alenakhineika requested a review from a team as a code owner July 1, 2026 13:35
@alenakhineika
alenakhineika requested a review from dudaschar July 1, 2026 13:35
@alenakhineika alenakhineika changed the title feat(logging): telemetry aggregation POC MONGOSH-3408 feat(logging): telemetry aggregation POC MONGOSH-3408, MONGOSH-3376 Jul 6, 2026
@nbbeeken
nbbeeken self-requested a review July 13, 2026 14:20

@nbbeeken nbbeeken left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

small things, looks really good!

Comment thread packages/cli-repl/src/cli-repl.ts Outdated
Comment thread packages/logging/src/helpers.spec.ts
Comment thread packages/cli-repl/src/cli-repl-telemetry.spec.ts Outdated
Comment thread packages/logging/src/telemetry-client.ts Outdated
Comment thread packages/logging/src/telemetry-client.ts Outdated
Comment thread packages/logging/src/telemetry-client.ts Outdated
@alenakhineika alenakhineika changed the title feat(logging): telemetry aggregation POC MONGOSH-3408, MONGOSH-3376 feat(logging): telemetry aggregation POC MONGOSH-3408, MONGOSH-3376, MONGOSH-3406 Jul 21, 2026
@alenakhineika alenakhineika changed the title feat(logging): telemetry aggregation POC MONGOSH-3408, MONGOSH-3376, MONGOSH-3406 feat(logging): new telemetry design MONGOSH-3408, MONGOSH-3376, MONGOSH-3406 Jul 21, 2026
Comment thread packages/logging/src/telemetry-client.ts Outdated
Comment thread packages/logging/src/telemetry-client.ts Outdated
Comment thread packages/logging/src/telemetry-client.ts Outdated
Comment thread packages/logging/src/telemetry-client.ts Outdated
Comment thread packages/logging/src/telemetry-client.ts Outdated
Comment thread packages/logging/src/telemetry-client.ts
@alenakhineika
alenakhineika merged commit 3e8387f into main Jul 22, 2026
143 of 150 checks passed
@alenakhineika
alenakhineika deleted the MONGOSH-3408-telemetry-aggregation branch July 22, 2026 17:43
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.

3 participants