Skip to content

[CFX-5205][CFX-5207][CFX-5208] first pass at wiring up Amplitude telemetry#419

Open
ajalon1 wants to merge 12 commits intomainfrom
feat/telemetry
Open

[CFX-5205][CFX-5207][CFX-5208] first pass at wiring up Amplitude telemetry#419
ajalon1 wants to merge 12 commits intomainfrom
feat/telemetry

Conversation

@ajalon1
Copy link
Copy Markdown
Contributor

@ajalon1 ajalon1 commented Apr 6, 2026

RATIONALE

I just wanted to merge in the telemetry feature branch so that it doesn't last any longer than needed.

Until we define the Amplitude API Key in GitHub Actions, all that will happen is we output telemetry events to dr-tui-debug.log. That said, I've defined the events here but haven't actually wired them up anywhere, so really nothing will happen.

CHANGES

  1. Add a telemetry package, with event tracking, event definitions (all unused atm), property collection management, and then unit test coverage
  2. Updated the root CMD to wire telemetry and collect properties in PersistentPreRunE, and then flush in PersistentPostRunE
  3. added a disable-telemetry config so that we can disable sending to Amplitude entirely; instead, we will log to dr-tui-debug.log
  4. add two ldflags, AMPLITUDE_API_KEY (from GH secret) and then InstallMethod (unused)

TODO

  • Wire up events
  • set up Amplitude_API_Key

PR Automation

Comment-Commands: Trigger CI by commenting on the PR:

  • /trigger-smoke-test or /trigger-test-smoke - Run smoke tests
  • /trigger-install-test or /trigger-test-install - Run installation tests

Labels: Apply labels to trigger workflows:

  • run-smoke-tests or go - Run smoke tests on demand (only works for non-forked PRs)

Important

For Forked PRs: If you're an external contributor, the run-smoke-tests label won't work. A maintainer must manually trigger the "Fork PR Smoke Tests" workflow from the Actions tab, providing your PR number. Please comment requesting a maintainer review if you need smoke tests to run.


Note

Medium Risk
Introduces new telemetry collection and a third-party analytics dependency that can send network traffic in release builds, plus new build-time secrets/ldflags; failures are designed to be non-fatal but could still affect startup/exit hooks.

Overview
Adds an Amplitude-backed internal/telemetry package (client, common-property collection, and typed event constructors) with unit tests, designed to no-op/log when disabled or when no API key is present.

Wires telemetry initialization into cmd/root.go via PersistentPreRunE (creates client + collects common properties) and flushes on exit via PersistentPostRunE, and introduces a --disable-telemetry flag/config key.

Updates release tooling to actually embed and provide telemetry configuration: GitHub Actions now passes AMPLITUDE_API_KEY, and goreleaser.yaml injects AmplitudeAPIKey and InstallMethod via ldflags; also adds the analytics-go dependency (and related sums) plus a placeholder GetUserID API helper.

Reviewed by Cursor Bugbot for commit 9a1035b. Bugbot is set up for automated code reviews on this repo. Configure here.

…metry (#403)

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
@github-actions github-actions bot added the go Pull requests that update go code label Apr 6, 2026
ajalon1 and others added 3 commits April 6, 2026 14:45
Add 40 tests covering:
- NewClient initialization with different API key and disable flag states
- Track method behavior when telemetry is disabled
- Flush method behavior
- IsEnabled logic
- CommonProperties collection and serialization
- Environment detection from DataRobot URLs
- Session ID generation with UUID v4 format
- All 14 event constructors

Test coverage for internal/telemetry increased to 64%

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
ajalon1 and others added 2 commits April 6, 2026 15:07
Remove the Current Working Directory (CWD) property from telemetry common
properties as it can contain sensitive PII such as usernames and project
names (e.g., /home/john.smith/projects/secret-client-app).

The CWD property was not being actively used for any analytics purpose
and only introduced privacy risk. Users trusting the 'anonymous usage
telemetry' label may not opt out, unknowingly leaking identifying information.

This aligns telemetry with the promise of anonymity in the --disable-telemetry
flag description.

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
@ajalon1
Copy link
Copy Markdown
Contributor Author

ajalon1 commented Apr 6, 2026

/run-smoke-tests

conditionally add AMplitudeAPIKey
@ajalon1 ajalon1 requested a review from a team April 7, 2026 00:07
Copy link
Copy Markdown
Contributor

@victorborshak victorborshak left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 23624bc. Configure here.

@ajalon1
Copy link
Copy Markdown
Contributor Author

ajalon1 commented Apr 10, 2026

/run-smoke-tests

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

go Pull requests that update go code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants