Skip to content

[tool] GA4 Analytics events are sent when running devicelab tests locally #151560

Open

Description

@andrewkolos

Discovered while working on #151518 (details).

Repro

  • Enable analytics/telemetry with flutter --enable-analytics
  • Clear/delete your local analytics log file, this is usually stored in <home directory>/.dart-tool/dart-flutter-telemetry.log. We'll use this file later to see what analytics events were sent.
  • Run a devicelab test locally. See dev/devicelab/README.md for full instructions, though I will provide steps here
    • In a terminal navigate to dev/devicelab.
    • Run a devicelab test that invokes flutter (probably all of them). On my macOS machine that's iOS-development ready, I ran ../../bin/cache/dart-sdk/bin/dart bin/test_runner.dart test -t native_assets_ios_simulator.

Expected behavior

Since this is a devicelab test, we should not send any analytics events regardless of whether analytics is enabled on the host machine.

Observed behavior

Open your dart-flutter-telemetry.log and search for "tool":{"value":"flutter-tool"}. This will be contained in flutter tool analytics events that will be sent off. Notice that there will be several events logged.

Activity

  1. added
    P2Important issues not at the top of the work list
    team-toolOwned by Flutter Tool team
    triaged-toolTriaged by Flutter Tool team
    on Jul 10, 2024
  2. self-assigned this
    on Jul 10, 2024
  3. removed their assignment
    on Aug 23, 2024
  4. self-assigned this
    on Jan 29, 2025
  5. andrewkolos commented on Feb 5, 2025

    @andrewkolos
    ContributorAuthor

    I've reprod this on current master.

    The tool code responsible for determining whether or not we are running on a bot can be found here:

    Future<bool> get isRunningOnBot async {

    @christopherfujino are you aware of any environment variables that are good candidates for the tool to inspect on current CI? Looking at a random postsubmit test OSinfo output, I see USER is set to chrome-bot. Perhaps we could use that. Alternatively, we could configure infra to always have BOT set to true.

  6. andrewkolos commented on Feb 5, 2025

    @andrewkolos
    ContributorAuthor

    Regardless of how we patch this issue, perhaps we should implement some sort of integration test on CI that will signal to us that bot detection doesn't work. This issue is probably resulting in a lot of noise to CLI usage analytics data.

  7. andrewkolos commented on Feb 5, 2025

    @andrewkolos
    ContributorAuthor

    The tool code responsible for determining whether or not we are running on a bot can be found here:

    flutter/packages/flutter_tools/lib/src/base/bot_detector.dart

    Line 27 in 5491c8c

    Future get isRunningOnBot async {
    [@christopherfujino](https://github.com/christopherfujino) are you aware of any environment variables that are good candidates for the tool to inspect on current CI? Looking at a random postsubmit test OSinfo output, I see USER is set to chrome-bot. Perhaps we could use that. Alternatively, we could configure infra to always have BOT set to true.

    Oops, I was conflating this issue (which is about running tests locally) with the potential issue of sending analytics events on CI. Regardless, I think this question still stands.

  8. added
    tool-still-validIssues that have been deemed still valid as part of the Flutter Tools issue cleanup initiative.
    on Jul 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work listteam-toolOwned by Flutter Tool teamtool-still-validIssues that have been deemed still valid as part of the Flutter Tools issue cleanup initiative.triaged-toolTriaged by Flutter Tool team

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions