[Telemetry] Set up a base skeleton framework#5319
[Telemetry] Set up a base skeleton framework#5319kadupoornima wants to merge 10 commits intoGoogleCloudPlatform:developfrom
Conversation
Summary of ChangesHello, 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 foundational telemetry framework for the Cluster Toolkit. Its primary purpose is to collect usage data from each CLI command execution, including command details, execution time, and exit status. This data is then formatted into a structured payload and transmitted to an internal server for analysis, enabling insights into tool usage and performance without affecting production environments. 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 introduces a foundational framework for telemetry collection, aiming to gather usage insights. However, there are significant security concerns regarding the management of global state. Specifically, the use of global variables for storing telemetry data without proper synchronization or cleanup leads to memory leaks, incorrect data reporting, and potential runtime panics due to race conditions, especially if the package is used in concurrent contexts. Additionally, the review highlights the need for refactoring to avoid package-level global state for improved testability, fixing a bug in event metadata aggregation, improving error handling in data upload, and making configuration more flexible.
Cluster Toolkit Telemetry
The objective of this effort is to design a robust telemetry system for Cluster Toolkit that captures anonymized usage data. This is a proposed enhancement to help the team understand how modules and blueprints are being used across different environments. When enabled, the system will automatically collect non-sensitive metrics (no PII) and deployment outcomes, enabling better product decisions and roadmap planning based on real usage insights. Clients would be able to choose whether or not to opt-in.
This PR - Setting up a base skeleton framework
We will be collecting data from each CLI run and the data is then sent in the form of an HTTP POST request to Clearcut.
Introduced a new
pkg/telemetry:collector.go: The required metrics are collected here. Support forCOMMAND_NAME,IS_TEST_DATA,RUNTIME_MS,EXIT_CODEhas been added in this PR.telemetry.go: Contains methods to construct the payload and handle the complete telemetry flow.uploader.go: Includes aFlush()method to send the event payload to the internal server for future analysis.Added unit tests for the new code introduced and performed local testing.
This PR has no effect on production, DATA IS NOT BEING COLLECTED NOW.