Skip to content

[Telemetry] Add support to collect the Blueprint name#5547

Merged
kadupoornima merged 11 commits into
GoogleCloudPlatform:developfrom
kadupoornima:telemetry-14
May 5, 2026
Merged

[Telemetry] Add support to collect the Blueprint name#5547
kadupoornima merged 11 commits into
GoogleCloudPlatform:developfrom
kadupoornima:telemetry-14

Conversation

@kadupoornima

@kadupoornima kadupoornima commented Apr 23, 2026

Copy link
Copy Markdown
Contributor

This pull request enhances the toolkit's telemetry collection by collecting the name of the blueprint used for a deployment. To ensure user privacy, the telemetry collector validates blueprint names against a known list of official blueprints, anonymizing any proprietary or custom blueprint names.

Changes:

  • Collecting blueprint name: Introduced the getBlueprintName function which collects the blueprint name for a user blueprint to be able to track usage and popularity.
  • Privacy and Anonymization: We check the deployment's blueprint against standard names. If the name is recognized, it is reported as is; if it is unrecognized, the system masks the value as "Custom".
  • Fail-Safe Reporting: In the event that the standard blueprint list cannot be fetched from the metadata cache, the collector reports "UNVERIFIED" to ensure it does not falsely imply a blueprint name was missing.

KINDLY NOTE THAT TELEMETRY DATA IS NOT BEING COLLECTED 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 enhances the telemetry collection capabilities of the Cluster Toolkit by adding support for tracking blueprint names and deployment files. It introduces new helper functions to fetch and validate these details against the official repository, while also optimizing performance by caching GitHub API responses to minimize network overhead.

Highlights

  • Telemetry Enhancement: Added support to collect 'blueprint_name' and 'deployment_file' information for telemetry reporting.
  • GitHub API Caching: Implemented caching for GitHub API responses in 'pkg/config/config.go' to reduce redundant network calls when fetching predefined modules, example files, and blueprint names.
  • Test Improvements: Updated and added new unit tests to verify the telemetry collection logic and the new caching mechanism.
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 changed the title [Telemetry] Add support to collect Blueprint name [Telemetry] Add support to collect the Blueprint name Apr 23, 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 enhances telemetry collection by adding tracking for specific blueprint names and deployment files, categorizing them as either standard or 'Custom'. It introduces a caching mechanism for GitHub API responses to optimize network usage and refactors the telemetry collector to use lazy loading for standard module and file lists. Feedback focuses on addressing a potential nil pointer dereference in the new blueprint name fetching logic, implementing concurrency safety for global cache variables, and further optimizing HTTP requests through additional caching and partial JSON decoding.

Comment thread pkg/config/config.go Outdated
Comment thread pkg/config/config.go Outdated
kadupoornima and others added 8 commits May 1, 2026 05:17
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@kadupoornima

Copy link
Copy Markdown
Contributor Author

/gemini summary

@kadupoornima

Copy link
Copy Markdown
Contributor Author

/gemini review

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

This pull request refactors the telemetry collection process to improve performance and reliability. By implementing a local file-based caching mechanism and a concurrent worker pool for fetching metadata from GitHub, the toolkit now avoids redundant network calls and potential blocking issues. Additionally, it enhances telemetry by including the blueprint name, ensuring better visibility into cluster deployments while maintaining privacy through sanitization of custom module and blueprint paths.

Highlights

  • Telemetry Expansion: Added support to collect and report the 'blueprint_name' in telemetry data.
  • Caching Mechanism: Implemented a robust, file-based caching system for standard modules, example files, and blueprint names to reduce network latency and API usage.
  • Performance Optimization: Introduced a concurrent worker pool with strict timeouts for fetching blueprint metadata, replacing inefficient sequential network calls.
  • Code Cleanup: Removed the deprecated 'tools/cache_metadata/main.go' utility and associated Firestore dependencies in favor of the new local caching implementation.
Ignored Files
  • Ignored by pattern: .github/workflows/** (1)
    • .github/workflows/cache-metadata.yml
Activity
  • Initial pull request created by kadupoornima.
  • Gemini Code Assist provided initial review feedback highlighting potential panics, performance issues, and concurrency concerns.
  • Author addressed feedback by implementing a thread-safe caching helper, adding a concurrent worker pool with timeouts, and removing legacy Firestore-based metadata caching.
  • Comprehensive unit tests were added to verify the new caching logic, error handling, and telemetry sanitization.

@kadupoornima kadupoornima added the release-improvements Added to release notes under the "Improvements" heading. label May 1, 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 migrates metadata fetching from Firestore to the GitHub API, introducing local file-based caching for standard modules, examples, and blueprint names. Telemetry is updated to report the blueprint name, which is masked as "Custom" if unrecognized or "UNVERIFIED" if the fetch fails. Review feedback suggests improving the robustness of the implementation by handling errors during cache file operations, sorting fetched blueprint names to ensure deterministic results, and using isolated test servers instead of global HTTP transport mocks to prevent flaky tests.

Comment thread pkg/config/config.go
Comment thread pkg/config/config.go
Comment thread pkg/telemetry/collector_test.go
@kadupoornima kadupoornima marked this pull request as ready for review May 1, 2026 08:57
@kadupoornima kadupoornima requested a review from a team as a code owner May 1, 2026 08:57
@kadupoornima kadupoornima enabled auto-merge (squash) May 1, 2026 09:01
@kadupoornima kadupoornima disabled auto-merge May 1, 2026 09:01
@kadupoornima kadupoornima enabled auto-merge (squash) May 1, 2026 09:01
@kadupoornima kadupoornima disabled auto-merge May 4, 2026 08:52
agrawalkhushi18
agrawalkhushi18 previously approved these changes May 5, 2026
@kadupoornima kadupoornima enabled auto-merge (squash) May 5, 2026 10:29
@kadupoornima kadupoornima merged commit 98cbdf4 into GoogleCloudPlatform:develop May 5, 2026
14 of 80 checks passed
@kadupoornima kadupoornima deleted the telemetry-14 branch May 5, 2026 10:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release-improvements Added to release notes under the "Improvements" heading.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants