feat(telemetry) Instrument traces with more attributes and make them available to OTEL users#20237
feat(telemetry) Instrument traces with more attributes and make them available to OTEL users#20237jerop merged 37 commits intogoogle-gemini:mainfrom
Conversation
This reverts commit e94ac27.
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Summary of ChangesHello @heaventourist, 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 significantly enhances the Gemini CLI's telemetry capabilities by integrating comprehensive OpenTelemetry tracing. The changes introduce a structured approach to capturing detailed information about key operations such as LLM interactions, tool executions, and agent activities. This instrumentation provides deeper insights into the CLI's internal workings, which will be leveraged by internal Google projects for improved monitoring and debugging. Highlights
Changelog
Activity
Using Gemini Code AssistThe 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
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 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
|
There was a problem hiding this comment.
Code Review
This pull request enhances OpenTelemetry tracing instrumentation by adding GenAI-specific semantic attributes to trace spans for LLM calls, tool executions, and agent interactions. However, a critical security vulnerability exists: the implementation captures and transmits full user prompts, conversation history, LLM responses, system instructions, and tool definitions as span attributes. This poses a significant risk of sensitive data exposure (PII, secrets, proprietary code) to the telemetry backend, as these traces are intended for broad organizational sharing. While guarded by an environment variable, the default behavior when enabled is to log full payloads without redaction. Additionally, consider further utilizing the new tracing capabilities within the sub-agent tooling.
|
Original PR: #18972 |
|
@heaventourist please rebase and resolve conflict also file an issue for this work, add add a link in description e.g. |
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request enhances OpenTelemetry tracing by adding more detailed attributes to spans, which is a great improvement for observability. The changes are consistently applied across the codebase. The identified issue in subagent-tool.ts regarding incorrect tracing utility usage has been retained as it is a valid concern not covered by the provided rules, and a suggestion to fix it is included.
Co-authored-by: Ben Knutson <benknutson@google.com>
This reverts commit fa4e97a.
docs/local-development.md
Outdated
| { | ||
| operation: GeminiCliOperation.ToolCall, | ||
| attributes: { | ||
| [GEN_AI_REQUEST_MODEL]: 'gemini-4.0-mega', |
There was a problem hiding this comment.
please remove this sensitive word
There was a problem hiding this comment.
Used another attribute to illustrate the use case.
b1befee
Summary
Added more attributes to OTel trace
Details
See packages/core/src/telemetry/constants.ts for added attributes.
These new attributes will be used by Google's internal project to surface the details of the traces to all Googlers.
Related Issues
Closes #20389
Closes #9217
How to Validate
Enable telemetry, specify the outfile and run make start, then check the log file as specified.
Pre-Merge Checklist