gemini-cli - ✅(Solved) Fix Feature: Add configuration flag to decouple detailed telemetry traces (Sub-task of #25146) [1 pull requests, 1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
google-gemini/gemini-cli#25402Fetched 2026-04-15 06:44:57
View on GitHub
Comments
0
Participants
1
Timeline
5
Reactions
0
Participants
Timeline (top)
labeled ×2added_to_project_v2 ×1cross-referenced ×1parent_issue_added ×1

Fix Action

Fixed

PR fix notes

PR #25343: feat(telemetry): add flag for enabling traces specifically

Description (problem / solution / changelog)

Summary

Introduces a telemetry.traces configuration flag to explicitly decouple detailed attribute tracing from lightweight baseline telemetry. Heavy tracing spans (tool outputs, file reads, model responses) are now strictly opt-in, resolving friction between low-overhead monitoring and deep debugging.

Details

  • Heavy tracing spans are now strictly opt-in via telemetry.traces in settings.json or the GEMINI_TELEMETRY_TRACES_ENABLED environment variable.
  • Strictly enforces that an undefined flag disables traces (!tracesEnabled), guaranteeing a true opt-in architecture.
  • Includes documentation updates in docs/reference/configuration.md.

Related Issues

Fixes #25402

How to Validate

  1. Verify traces are disabled by default.
  2. Enable traces via GEMINI_TELEMETRY_TRACES_ENABLED=true and confirm detailed input and output payload attributes are correctly appended to the telemetry spans.
  3. Run the test suite: npm run test:ci -w @google/gemini-cli-core -- src/telemetry/trace.test.ts

Pre-Merge Checklist

  • Updated relevant documentation and README (if needed)
  • Added/updated tests (if needed)
  • Noted breaking changes (if any)
  • Validated on required platforms/methods:
    • MacOS
      • npm run
      • npx
      • Docker
      • Podman
      • Seatbelt
    • Windows
      • npm run
      • npx
      • Docker
    • Linux
      • npm run
      • npx
      • Docker

Changed files

  • docs/cli/telemetry.md (modified, +18/-11)
  • docs/reference/configuration.md (modified, +6/-0)
  • packages/a2a-server/src/utils/testing_utils.ts (modified, +1/-0)
  • packages/cli/src/config/settingsSchema.ts (modified, +5/-0)
  • packages/cli/src/test-utils/mockConfig.ts (modified, +1/-0)
  • packages/core/src/agents/agent-tool.ts (modified, +1/-0)
  • packages/core/src/config/config.ts (modified, +9/-0)
  • packages/core/src/core/geminiChat.test.ts (modified, +1/-0)
  • packages/core/src/core/geminiChat_network_retry.test.ts (modified, +1/-0)
  • packages/core/src/core/loggingContentGenerator.test.ts (modified, +1/-0)
  • packages/core/src/core/loggingContentGenerator.ts (modified, +3/-0)
  • packages/core/src/scheduler/policy.test.ts (modified, +1/-0)
  • packages/core/src/scheduler/scheduler.test.ts (modified, +2/-0)
  • packages/core/src/scheduler/scheduler.ts (modified, +1/-0)
  • packages/core/src/scheduler/scheduler_hooks.test.ts (modified, +1/-0)
  • packages/core/src/scheduler/scheduler_parallel.test.ts (modified, +1/-0)
  • packages/core/src/scheduler/tool-executor.ts (modified, +1/-0)
  • packages/core/src/telemetry/config.ts (modified, +5/-0)
  • packages/core/src/telemetry/conseca-logger.test.ts (modified, +1/-0)
  • packages/core/src/telemetry/loggers.test.ts (modified, +4/-1)
  • packages/core/src/telemetry/trace.test.ts (modified, +50/-10)
  • packages/core/src/telemetry/trace.ts (modified, +21/-1)
  • schemas/settings.schema.json (modified, +4/-0)

Code Example

> /about
# paste output here
RAW_BUFFERClick to expand / collapse

What happened?

Currently, getTelemetryEnabled() unconditionally activates both lightweight baseline telemetry and massive tracing overhead (recording full tool outputs, file reads, and model responses). This violates the principle that baseline telemetry should be cheap and lightweight. Decoupling the heavy OpenTelemetry "traces" from standard telemetry allows users and enterprise environments to capture basic usage metrics without bearing the massive cost and potential privacy implications of detailed traces. Tracing must be an explicit opt-in for deep debugging only.

What did you expect to happen?

As outlined in the parent issue #25146, we need a new boolean configuration option: telemetry.traces in settings.json (and its corresponding GEMINI_TELEMETRY_TRACES_ENABLED environment variable). This flag must default to false and strictly require explicit opt-in

Client information

<details> <summary>Client Information</summary>

Run gemini to enter the interactive CLI, then run the /about command.

> /about
# paste output here
</details>

Login information

No response

Anything else we need to know?

No response

extent analysis

TL;DR

To fix the issue, introduce a new boolean configuration option telemetry.traces in settings.json with a default value of false, requiring explicit opt-in for tracing.

Guidance

  • Introduce a new configuration option telemetry.traces in settings.json to control tracing separately from baseline telemetry.
  • Set the default value of telemetry.traces to false to ensure tracing is opt-in only.
  • Create a corresponding environment variable GEMINI_TELEMETRY_TRACES_ENABLED to allow configuration via environment variables.
  • Update the getTelemetryEnabled() function to respect the new telemetry.traces configuration option and only enable tracing when explicitly opted-in.

Example

// settings.json
{
  "telemetry": {
    "traces": false
  }
}

Notes

The introduction of the new configuration option and environment variable should be done in a way that does not break existing functionality, ensuring a smooth transition for users.

Recommendation

Apply workaround by introducing the new configuration option and updating the getTelemetryEnabled() function to respect the explicit opt-in for tracing, as this allows for a more controlled and lightweight telemetry setup.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING