[analytics] propagate ENV to deeplink sub-tool calls#9836
Open
pq wants to merge 5 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request implements the propagation of IDE information and analytics opt-out status from the DevTools client through the server to spawned subprocesses. It introduces new getters for analytics status, updates server request URI construction to include these parameters, and enhances the DeeplinkManager to configure the process environment using package:unified_analytics. A concern was raised regarding a redundant environment variable override in DeeplinkManager.runProcess that might conflict with the canonical naming expected by the analytics package.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements environment variable propagation (
DASH__SUPPRESS_ANALYTICSandDASH__TOOL) when DevTools spawns ecosystem sub-tools (such as theflutterCLI during deep link analysis).This completes the DevTools-side changes for GitHub Issue #9702 and integrates with the new environment construction utilities in
package:unified_analytics(v8.0.13+).Fixes: #9702.
Why This Covers All Required Cases
A comprehensive audit of the repository was performed to identify all places where child processes are spawned:
Ecosystem Sub-Tools (Covered):
DeeplinkManager(packages/devtools_shared): This is the only production runtime component that spawns ecosystem sub-tools (flutter analyze). We have updated it to extract the parent IDE (DASH__TOOL) and client opt-out telemetry state (DASH__SUPPRESS_ANALYTICS), propagating them to the childflutterprocess usingpackage:unified_analytics'sgetEnvironment()builder.Exclusions & Why They Don't Require Special Handling:
BuildExtensionCommandindevtools_extensions): These run directly in the developer's terminal session, naturally inheriting the shell's active environment variables without needing dynamic, server-negotiated overrides.tar,git,which): These are not Dart/Flutter tools and do not integrate with thepackage:unified_analyticstelemetry system, meaning analytics environment variables have no effect.Detailed Changes
1. Client-Side Updates (
packages/devtools_app)server.dart: UpdatedbuildDevToolsServerRequestUrito declaratively append query parameterside(parent tool) andsuppress_analytics(opt-out status) to all server-bound HTTP API requests.analytics_controller.dart: Added synchronous public gettersisAnalyticsEnabledandisAnalyticsControllerInitializedto check client telemetry status safely and synchronously.pubspec.yaml: Upgradedunified_analyticsdependency to^8.0.13to align withdevtools_sharedand prevent monorepo version conflicts.2. Server-Side Updates (
packages/devtools_shared)pubspec.yaml: Addedpackage:unified_analytics: ^8.0.13dependency, sorted alphabetically._deeplink.dart:DeeplinkManager.deeplink_manager.dart:runProcessto acceptideandsuppressAnalyticsparameters._ideToDashToolMapto map IDE query strings toDashToolenums with case-insensitive lookups and alias overrides (such asvscodePluginsorintellijPlugins) in O(1) constant time, falling back to theO(N)enum values list loop only for new unmapped values.Process.run.3. Verification & Test Alignment
fakes.dart: UpdatedFakeDeeplinkManagermethod signatures to correctly match the base class overrides.deeplink_manager_test.dart: Added a dedicated unit test to verify that both the parent IDE and analytics opt-out status are correctly populated and propagated down to the child process.Pre-launch Checklist
General checklist
///).Issues checklist
contributions-welcomeorgood-first-issuelabel.contributions-welcomeorgood-first-issuelabel. I understand this means my PR might take longer to be reviewed.Tests checklist
AI-tooling checklist
Feature-change checklist
release-notes-not-requiredlabel or left a comment requesting the label be added.packages/devtools_app/release_notes/NEXT_RELEASE_NOTES.md.If you need help, consider asking for help on Discord.