Skip to content

Conversation

@fredzqm
Copy link
Contributor

@fredzqm fredzqm commented Oct 11, 2025

Adds a new analytics event, dataconnect_deploy, to track the outcomes of various steps within the firebase deploy command for Data Connect services.

This includes tracking for:

  • Billing errors
  • Build errors and warnings
  • Service creation and deletion
  • Schema migration events
  • Connector updates

Also includes tracking for the --dry-run and --force flags.

As part of this. When deploy fails, we still emit product_deploy with result of the failing phase. Previously, it only emit product_deploy when deploy succeeds.

Description

Scenarios Tested

Here are some example stats reported:

stats product_deploy {
  interactive: 'true',
  dryRun: 'false',
  result: 'success',
  hosting: 'false',
  database: 'false',
  firestore: 'false',
  functions: 'false',
  storage: 'false',
  remoteconfig: 'false',
  extensions: 'false',
  dataconnect: 'true',
  apphosting: 'false'
}
stats dataconnect_deploy {
  missing_billing: 'false',
  num_service_created: 0,
  num_service_deleted: 0,
  num_schema_migrated: 1,
  num_connector_updated_before_schema: 1,
  num_connector_updated_after_schema: 0,
  num_schema_skipped_due_to_pending_create: 0,
  num_schema_with_incompatible_schema: 0,
  num_schema_with_invalid_connector: 0,
  num_build_errors: 0,
  num_build_warnings_interactive_ack_existing_insecure: 2,
  interactive: 'true',
  dryRun: 'false',
  result: 'success'
}

stats command_execution {
  command_name: 'deploy',
  result: 'success',
  duration: 16738,
  interactive: 'true'
}
stats product_deploy {
  interactive: 'true',
  dryRun: 'false',
  result: 'prepares_error',
  hosting: 'false',
  database: 'false',
  firestore: 'false',
  functions: 'false',
  storage: 'false',
  remoteconfig: 'false',
  extensions: 'false',
  dataconnect: 'true',
  apphosting: 'false'
}
stats dataconnect_deploy {
  missing_billing: 'true',
  num_service_created: 0,
  num_service_deleted: 0,
  num_schema_migrated: 0,
  num_connector_updated_before_schema: 0,
  num_connector_updated_after_schema: 0,
  num_schema_skipped_due_to_pending_create: 0,
  num_schema_with_incompatible_schema: 0,
  num_schema_with_invalid_connector: 0,
  num_build_errors: 0,
  interactive: 'true',
  dryRun: 'false',
  result: 'prepares_error'
}
stats command_execution { command_name: 'deploy', result: 'error', interactive: 'true' }

Sample Commands

Adds a new analytics event, `dataconnect_deploy`, to track the outcomes of various steps within the `firebase deploy` command for Data Connect services.

This includes tracking for:
- Billing errors
- Build errors and warnings
- Service creation and deletion
- Schema migration events
- Connector updates
- User choices in interactive prompts

Also includes tracking for the --dry-run and --force flags.
@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 integrates a new analytics event, dataconnect_deploy, into the firebase deploy command for Data Connect services. The primary goal is to gather detailed telemetry on the various stages and outcomes of these deployments, including user interactions and potential issues like billing or build errors. This data will provide valuable insights into the deployment experience and help identify areas for improvement.

Highlights

  • New Analytics Event: Introduced dataconnect_deploy to track the deployment process for Data Connect services.
  • Comprehensive Tracking: Captures outcomes for billing errors, build errors/warnings, service creation/deletion, schema migrations, connector updates, and user choices in interactive prompts.
  • Flag Tracking: Records the use of --dry-run and --force flags during deployment.
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 adds analytics for the dataconnect deploy command. The changes introduce a DeployStats interface to collect metrics throughout the deployment process, which are then sent as a dataconnect_deploy event. The implementation looks good overall, but I've found a critical issue where the analytics data is lost before being sent, and a minor issue with how one of the metrics is calculated. I've also suggested a refactoring to improve type safety for the analytics flags.

@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 introduces analytics for dataconnect deploy by adding a new dataconnect_deploy event. The changes involve creating a DeployStats context to collect metrics throughout the deployment lifecycle (prepare, deploy, release) and sending them via a trackGA4 call. The implementation is solid, but I've identified a few areas for improvement: a critical debug console.log that needs to be removed, a potential regression in error handling, a fragile implementation detail in analytics key generation, and some dead code. Addressing these points will improve the robustness and cleanliness of the code.

@fredzqm fredzqm requested review from joehan and rosalyntan October 14, 2025 15:44
@fredzqm
Copy link
Contributor Author

fredzqm commented Oct 14, 2025

@rosalyntan @joehan To get a better understanding of what customers are running into during deploy, I am adding some detailed metrics.

Please take a look~

@fredzqm fredzqm merged commit 4672d62 into master Oct 14, 2025
48 checks passed
@fredzqm fredzqm deleted the dataconnect-deploy-analytics branch October 14, 2025 22:41
@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