Skip to content

Conversation

@fredzqm
Copy link
Contributor

@fredzqm fredzqm commented Oct 14, 2025

Adds a new Google Analytics metric, dataconnect_cloud_sql, to track the usage and duration of the setupCloudSql function.

This metric includes the following labels:

  • source: init, mcp_init, deploy
  • action
  • location
  • enable_google_ml_integration: true, false
  • free_trial: true, false
  • database_version: postgres_15

The implementation also tracks the duration of the setupCloudSql operation.

Description

Scenarios Tested

Sample Commands

Adds a new Google Analytics metric, `dataconnect_cloud_sql`, to track the usage and duration of the `setupCloudSql` function.

This metric includes the following labels:
- source: init, mcp_init, deploy
- action: created, created_failed, updated, updated_failed, get
- location
- enable_google_ml_integration: true, false
- result: error, success
- free_trial: true, false
- database_version: postgres_17

The implementation also tracks the duration of the `setupCloudSql` operation. To differentiate between `init` and `mcp_init` sources, an `isMcp` flag was added to the `Setup` object.
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @fredzqm, 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 Firebase CLI's Data Connect functionality by integrating a new Google Analytics metric for Cloud SQL setup operations. The primary goal is to gather detailed telemetry on how Cloud SQL instances are provisioned, updated, and retrieved, including success/failure rates and execution times. This data will be crucial for understanding user behavior, optimizing the setup process, and improving the overall reliability of Cloud SQL integration within Data Connect.

Highlights

  • New Google Analytics Metric: Introduced a new Google Analytics metric, dataconnect_cloud_sql, to track the usage and duration of the setupCloudSql function, providing better insights into Cloud SQL provisioning.
  • Detailed Tracking Labels: The new metric includes comprehensive labels such as source (init, mcp_init, deploy), action (created, created_failed, updated, updated_failed, get), location, enable_google_ml_integration, result, free_trial, and database_version.
  • Duration Tracking: The implementation now tracks the duration of each setupCloudSql operation, allowing for performance monitoring and identification of bottlenecks.
  • MCP Initialization Differentiation: An isMcp flag has been added to the Setup object to accurately differentiate between init and mcp_init sources for the new metric.
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.

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.

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 Google Analytics tracking for the setupCloudSql function, which is a great addition for monitoring usage. The implementation correctly passes the source of the call through various functions. My review focuses on improving the maintainability of the new tracking logic in src/dataconnect/provisionCloudSql.ts. I've pointed out an inconsistency in the tracked database version and suggested refactoring duplicated code into helper functions to make the code cleaner and less error-prone.

@fredzqm
Copy link
Contributor Author

fredzqm commented Oct 14, 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 successfully adds Google Analytics tracking for the setupCloudSql function, which is valuable for monitoring usage and performance. The implementation is clean, introducing a SetupStats type to gather metrics and consistently passing the source of the call across different workflows. The refactoring from a boolean freeTrial to a more descriptive freeTrialLabel is also a good improvement. I have one suggestion to refine the structure of the analytics event to better align with the PR description and improve the quality of the collected data for easier querying.

@fredzqm fredzqm requested review from joehan and yuchenshi October 14, 2025 17:59
@fredzqm fredzqm merged commit 34d9d4e into master Oct 14, 2025
48 checks passed
@fredzqm fredzqm deleted the dataconnect-cloud-sql-ga branch October 14, 2025 21:55
@github-project-automation github-project-automation bot moved this from Approved [PR] to Done in [Cloud] Extensions + Functions Oct 14, 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.

2 participants