Skip to content

[analytics] Update devtools to set analytics ENV variables when invoking sub-tools #9702

Closed

Description

@pq

package:analytics ENV support in flight here: dart-lang/tools#2344

Activity

  1. self-assigned this
    on Mar 12, 2026
  2. added
    P1high priority issues at the top of the work list, actively being worked on.
    on Mar 12, 2026
  3. added theissue type on Mar 12, 2026
  4. elliette commented on Apr 6, 2026

    @elliette
    Member

    Some quick notes on how DevTools currently handles analytics. From my understanding, DevTools is currently only a sub-tool (since it is spawned by other tools), and has no sub-tools itself (since it doesn't spawn any tools).

    How DevTools determines whether or not send analytics:

    isAnalyticsEnabled: Called once when DevTools first loads. Checks whether a user has opted into either unified or legacy analytics collection.

    • unified analytics: DTD checks whether analytics collection is enabled in the unified_analytics config on disk
    • legacy: DevTools checks whether analytics collection is enabled in the devtools config on disk

    How DevTools determines its parent tool:

    • If DevTools is embedded in an IDE, the IDE sets the ide query parameter, which then is included in the analytics (if ide is null, we assume DevTools was opened by the user from the URL provided by the Dart/Flutter CLI)
  5. kenzieschmoll commented on Apr 21, 2026

    @kenzieschmoll
    Member

    Is there any work that actually needs to be done here based on @elliette's comment?

  6. pq commented on May 18, 2026

    @pq
    ContributorAuthor

    Sorry for the slow reply. I think this is WAI so we're good to go. Thanks for the thoughtful context @elliette !

  7. reopened this on May 19, 2026
  8. pq commented on May 19, 2026

    @pq
    ContributorAuthor

    Thinking about this some more, I realize we only looked at half the issue and weren't accounting for the places where devtools itself calls out to sub-tools (and should in turn flow env variables down to them).

    Gemini did a round-up for me (included below). A bunch can be ignored (for example shell commands and test infrastructure) but we should look at the flutter tool calls ay least.


    Spawning in Production Code

    • DeeplinkManager
      • File: packages/devtools_shared/lib/src/deeplink/deeplink_manager.dart
      • Line reference: deeplink_manager.dart#L48
      • Details: Spawns flutter binary via Process.run to analyze deep links (e.g., --list-build-variants, --output-app-link-settings, --list-build-options).

    Spawning in DevTools Extension Building / Tooling

    • BuildExtensionCommand
      • File: packages/devtools_extensions/bin/_build_and_copy.dart
      • Line reference: _build_and_copy.dart#L125
      • Details: Spawns flutter build web and chmod via ProcessManager when preparing/packaging extensions.
    • Rollback Command
      • File: tool/lib/commands/rollback.dart
      • Details: Spawns tar via Process.run to handle rollbacks.
    • Release Helper Command
      • File: tool/lib/commands/release_helper.dart
      • Details: Spawns git commands.
    • Model and General Script Utilities
      • Files: tool/lib/model.dart & tool/lib/utils.dart
      • Details: Spawns commands like which flutter and other scripting subprocesses.

    Spawning in Test Infrastructure

    • Chrome & Chromedriver
      • Files:
        • packages/devtools_shared/lib/src/test/chrome.dart (Starts Chrome browser)
        • packages/devtools_shared/lib/src/test/chrome_driver.dart (Starts Chromedriver)
    • Integration & CLI Test Runners
      • Files:
        • packages/devtools_shared/lib/src/test/integration_test_runner.dart
        • packages/devtools_shared/lib/src/test/cli_test_driver.dart
    • Mock / Helper Spawners in tests
      • Files:
        • packages/devtools_shared/test/helpers/helpers.dart (Starts DTD test instances)
        • packages/devtools_shared/test/helpers/extension_test_manager.dart
        • packages/devtools_app/test/test_infra/flutter_test_driver.dart (Starts Flutter test driver processes)
        • packages/devtools_app/integration_test/test_infra/run/run_test.dart (Starts DevTools server for integration tests)
        • packages/devtools_app/integration_test/test_infra/run/_test_app_driver.dart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P1high priority issues at the top of the work list, actively being worked on.

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions