Skip to content

[Telemetry] Set up a base skeleton framework#5455

Merged
kadupoornima merged 3 commits into
GoogleCloudPlatform:developfrom
kadupoornima:telemetry-final-1
Apr 7, 2026
Merged

[Telemetry] Set up a base skeleton framework#5455
kadupoornima merged 3 commits into
GoogleCloudPlatform:developfrom
kadupoornima:telemetry-final-1

Conversation

@kadupoornima

@kadupoornima kadupoornima commented Apr 6, 2026

Copy link
Copy Markdown
Contributor

Cluster Toolkit Telemetry

The objective of this effort is to implement a robust telemetry system for Cluster Toolkit that captures 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 and deployment outcomes, enabling better product decisions and roadmap planning based on real usage insights. Clients would be able to choose to opt-out.

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 an internal service for analytics.

Introduced a new pkg/telemetry:

  • collector.go: The required metrics are collected here. Support for command name, IS_TEST_DATA, latency, and EXIT_CODE has been added in this PR.
  • telemetry.go: Contains methods to construct the payload and handle the complete telemetry flow.
  • uploader.go: Includes a Flush() 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. The coverage > 80%.

This PR has no effect on production, DATA COLLECTION HAS NOT STARTED YET.

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, 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 establishes a foundational telemetry framework for the Cluster Toolkit. The goal is to enable the collection of non-sensitive usage metrics and deployment outcomes to inform future product decisions. The implementation includes a modular structure for collecting metrics, building event payloads, and uploading them via HTTP POST requests. Note that while the infrastructure is now in place, data collection is currently disabled in production.

Highlights

  • Telemetry Framework Implementation: Introduced a new pkg/telemetry package to handle usage data collection, payload construction, and transmission to the Clearcut server.
  • Metrics Collection: Implemented support for capturing command names, test data flags, execution latency, and exit codes.
  • Configuration Updates: Added a centralized GetToolkitVersion() helper in pkg/config and updated cmd/root.go to utilize this for version reporting.
  • Testing: Added comprehensive unit tests for all new telemetry components, achieving over 80% code coverage.
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
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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.

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.

@kadupoornima kadupoornima added the release-key-new-features Added to release notes under the "Key New Features" heading. label Apr 6, 2026

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

Copy link
Copy Markdown
Contributor

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 telemetry collection system for the HPC Toolkit, adding the pkg/telemetry package to capture and upload command execution metrics such as exit codes and latency. It also centralizes version management within pkg/config and includes comprehensive unit tests for the new components. Review feedback identifies a potential runtime panic in argument parsing, suggests using non-intrusive logging for telemetry errors to avoid user confusion, recommends making the upload process non-blocking to improve CLI performance, and points out redundant constants.

Comment thread pkg/telemetry/collector_util.go Outdated
Comment thread pkg/telemetry/uploader.go
Comment thread pkg/telemetry/telemetry.go
Comment thread pkg/telemetry/types.go Outdated

@SwarnaBharathiMantena SwarnaBharathiMantena left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I assume support for the --telemetry flag will be added in the followup PRs?

Comment thread pkg/telemetry/collector_util.go
@kadupoornima

Copy link
Copy Markdown
Contributor Author

I assume support for the --telemetry flag will be added in the followup PRs?

Yes. Once support for user config for new users is added.

@SwarnaBharathiMantena SwarnaBharathiMantena self-requested a review April 7, 2026 07:55

@SwarnaBharathiMantena SwarnaBharathiMantena left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM for a base skeleton.

@kadupoornima kadupoornima merged commit 97e0767 into GoogleCloudPlatform:develop Apr 7, 2026
16 of 78 checks passed
kadupoornima added a commit that referenced this pull request Apr 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release-key-new-features Added to release notes under the "Key New Features" heading.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants