这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@jerop
Copy link
Collaborator

@jerop jerop commented Sep 22, 2025

This change introduces support for configuring telemetry settings using environment variables, as requested in issue #9084.

The following environment variables are now supported and will take precedence over their corresponding values in settings.json.

A regression test suite has been added to verify that the environment variables are correctly prioritized and that the system correctly falls back to using values from settings.json when the environment variables are not set.

The documentation in docs/telemetry.md and docs/cli/configuration.md has been updated to reflect these new environment variables and the configuration hierarchy.

Fixes #9084


Setting Environment Variable CLI Flag Description Values Default
enabled GEMINI_TELEMETRY_ENABLED --telemetry / --no-telemetry Enable or disable telemetry true/false false
target GEMINI_TELEMETRY_TARGET --telemetry-target <local|gcp> Where to send telemetry data "gcp"/"local" "local"
otlpEndpoint GEMINI_TELEMETRY_OTLP_ENDPOINT --telemetry-otlp-endpoint <URL> OTLP collector endpoint URL string http://localhost:4317
otlpProtocol GEMINI_TELEMETRY_OTLP_PROTOCOL --telemetry-otlp-protocol <grpc|http> OTLP transport protocol "grpc"/"http" "grpc"
outfile GEMINI_TELEMETRY_OUTFILE --telemetry-outfile <path> Save telemetry to file (requires otlpEndpoint: "") file path -
logPrompts GEMINI_TELEMETRY_LOG_PROMPTS --telemetry-log-prompts / --no-telemetry-log-prompts Include prompts in telemetry logs true/false true
useCollector GEMINI_TELEMETRY_USE_COLLECTOR - Use external OTLP collector (advanced) true/false false

@jerop jerop requested a review from a team as a code owner September 22, 2025 14:52
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @jerop, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces a significant enhancement to the telemetry configuration system, allowing users to define telemetry settings through environment variables. This provides greater flexibility and dynamic control, especially in containerized or automated environments. The new system ensures that environment variables override settings from settings.json and CLI flags, establishing a clear precedence. Additionally, a new useCollector option is available for advanced OpenTelemetry Protocol (OTLP) collector configurations.

Highlights

  • Environment Variable Support for Telemetry: Telemetry settings can now be configured using GEMINI_TELEMETRY_* environment variables, providing a flexible way to manage settings.
  • Configuration Precedence: Environment variables take precedence over values defined in settings.json, establishing a clear hierarchy for configuration.
  • New useCollector Setting: A new boolean setting useCollector has been added to telemetry configurations for advanced OpenTelemetry Protocol (OTLP) collector usage.
  • Updated Documentation: The documentation in docs/telemetry.md and docs/cli/configuration.md has been updated to reflect the new environment variables and the configuration hierarchy.
  • Comprehensive Testing: A new regression test suite has been added to verify the correct prioritization and fallback behavior of telemetry settings when environment variables are used.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@github-actions
Copy link

github-actions bot commented Sep 22, 2025

Size Change: +2.2 kB (+0.01%)

Total Size: 17.4 MB

Filename Size Change
./bundle/gemini.js 17.4 MB +2.2 kB (+0.01%)
ℹ️ View Unchanged
Filename Size
./bundle/sandbox-macos-permissive-closed.sb 1.03 kB
./bundle/sandbox-macos-permissive-open.sb 830 B
./bundle/sandbox-macos-permissive-proxied.sb 1.31 kB
./bundle/sandbox-macos-restrictive-closed.sb 3.29 kB
./bundle/sandbox-macos-restrictive-open.sb 3.36 kB
./bundle/sandbox-macos-restrictive-proxied.sb 3.56 kB

compressed-size-action

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a well-structured approach to configuring telemetry settings via environment variables, which is a great enhancement. The logic is cleanly refactored into a new resolveTelemetrySettings function in the core package, with a clear precedence order of CLI flags, environment variables, and then settings files. The changes are accompanied by thorough unit tests and documentation updates. I've found one issue in the test suite where a test case asserts incorrect behavior, which should be corrected to ensure the tests accurately reflect the implementation's fail-fast validation.

@jerop jerop force-pushed the fix/issue-9084-telemetry-env-vars branch 2 times, most recently from b4e7aac to fe4f940 Compare September 22, 2025 15:00
@jerop jerop enabled auto-merge September 22, 2025 16:03
@jerop
Copy link
Collaborator Author

jerop commented Sep 22, 2025

/gemini review

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request is a great improvement. It successfully introduces support for configuring telemetry via environment variables, which was a requested feature. The changes are well-structured, moving the configuration resolution logic into the core package, which improves modularity and maintainability. The addition of comprehensive unit and integration tests ensures the new functionality is reliable and that the configuration precedence is handled correctly. The documentation updates are clear and thorough, making it easy for users to understand the new environment variables and the overall configuration hierarchy. The code is clean, and the implementation is solid. I have no critical or high-severity issues to report.

@jerop jerop requested a review from NTaylorMullen September 22, 2025 16:08
@jerop jerop force-pushed the fix/issue-9084-telemetry-env-vars branch from fe4f940 to 4e7e104 Compare September 22, 2025 18:06
This change introduces support for configuring telemetry settings using
environment variables, as requested in issue #9084.

The following environment variables are now supported and will take
precedence over their corresponding values in `settings.json`:
- GEMINI_TELEMETRY_ENABLED
- GEMINI_TELEMETRY_TARGET
- GEMINI_TELEMETRY_OTLP_ENDPOINT
- GEMINI_TELEMETRY_OTLP_PROTOCOL
- GEMINI_TELEMETRY_LOG_PROMPTS
- GEMINI_TELEMETRY_OUTFILE
- GEMINI_TELEMETRY_USE_COLLECTOR

A regression test suite has been added to verify that the environment
variables are correctly prioritized and that the system correctly falls
back to using values from `settings.json` when the environment
variables are not set.

The documentation in `docs/telemetry.md` and
`docs/cli/configuration.md` has been updated to reflect these new
environment variables and the configuration hierarchy.

fixes #9084
@jerop jerop force-pushed the fix/issue-9084-telemetry-env-vars branch from 4e7e104 to 9302c8c Compare September 22, 2025 18:17
@jerop jerop added this pull request to the merge queue Sep 22, 2025
Merged via the queue into main with commit c0c7ad1 Sep 22, 2025
19 checks passed
@jerop jerop deleted the fix/issue-9084-telemetry-env-vars branch September 22, 2025 18:27
thacio added a commit to thacio/auditaria that referenced this pull request Oct 3, 2025
giraffe-tree pushed a commit to giraffe-tree/gemini-cli that referenced this pull request Oct 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feat: Support Telemetry Configuration via Environment Variables

4 participants