Skip to content

Conversation

@tonybaroneee
Copy link

Discussion

  • We are going to leverage firebase installation IDs as a proxy for the user identifier to join errors at read-time. This PR retrieves a fid (or upserts if it doesn't yet exist) and attaches it to each error log entry that is captures by the telemetry captureError API.

Testing

  • Updated unit tests to look for fid in log entry custom attributes payload
  • Manually verified that the fid is provided in logs captured by a locally deployed test app

API Changes

  • (None)

@tonybaroneee tonybaroneee requested a review from a team as a code owner November 11, 2025 19:12
@changeset-bot
Copy link

changeset-bot bot commented Nov 11, 2025

⚠️ No Changeset found

Latest commit: 7ea2578

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@gemini-code-assist
Copy link

Summary of Changes

Hello @tonybaroneee, 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 significant enhancement to the telemetry system by integrating Firebase Installation IDs (FIDs) into error logging. By attaching a unique FID to each captured error, the system gains the ability to identify and correlate errors more effectively, providing a clearer picture of user-specific issues and improving error analysis capabilities.

Highlights

  • Firebase Installation ID (FID) Integration: The primary change is the integration of Firebase Installation IDs (FIDs) into the telemetry's captureError API.
  • User Identification for Errors: FIDs will be used as a proxy for user identifiers, enabling better correlation and analysis of errors at read-time.
  • Dependency Update: The @firebase/installations package has been added as a peer dependency to support FID retrieval.
  • Telemetry Service Enhancement: The TelemetryService now proactively fetches and stores the FID upon instantiation.
  • Comprehensive Testing: Unit tests have been updated to ensure the fid is correctly attached to error log entries, and manual verification was performed.
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

@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 the Firebase Installation ID (fid) to error logs, which will serve as a user identifier. The changes are well-structured and the tests are updated accordingly. My main feedback is on the implementation of fid fetching in TelemetryService, which uses a fire-and-forget approach. This can lead to a race condition where early errors are logged without an fid, and the error handling for the fetch operation could be improved for better debuggability. I've left a specific comment with a suggestion.

@tonybaroneee tonybaroneee marked this pull request as draft November 11, 2025 20:42
@tonybaroneee tonybaroneee force-pushed the telemetry-capture-fid branch 4 times, most recently from d4dcfba to 740a83f Compare November 11, 2025 22:11
@tonybaroneee tonybaroneee marked this pull request as ready for review November 11, 2025 22:11
fid?: string;

constructor(public app: FirebaseApp, public installationsProvider: _FirebaseInstallationsInternal, public loggerProvider: LoggerProvider) {
void this._getFid();
Copy link
Author

Choose a reason for hiding this comment

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

@hsubox76 Due to the nature of our API, the captureError method needs to stay synchronous, but retrieving the fid is async. This leads to the fid being set here on subsequent invocations of captureError, not the first. Any ideas on how to have the fid in place in time for the first captureError call while keeping that method sync? cc @andrewbrook

Copy link

@andrewbrook andrewbrook Nov 12, 2025

Choose a reason for hiding this comment

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

Ah, I missed this. We could use the same model we have for dynamic headers, and only retrieve fid when doing the background request?

@google-oss-bot
Copy link
Contributor

Size Report 1

Affected Products

  • @firebase/ai

    TypeBase (faee34d)Merge (09a0724)Diff
    browser?65.4 kB? (?)
    main?69.2 kB? (?)
    module?65.4 kB? (?)
  • @firebase/analytics

    TypeBase (faee34d)Merge (09a0724)Diff
    browser?21.6 kB? (?)
    main?22.8 kB? (?)
    module?21.6 kB? (?)
  • @firebase/analytics-compat

    TypeBase (faee34d)Merge (09a0724)Diff
    browser?2.57 kB? (?)
    main?3.01 kB? (?)
    module?2.57 kB? (?)
  • @firebase/api-documenter

    TypeBase (faee34d)Merge (09a0724)Diff
    main?3.95 kB? (?)
  • @firebase/app

    TypeBase (faee34d)Merge (09a0724)Diff
    browser?19.6 kB? (?)
    main?20.5 kB? (?)
    module?19.6 kB? (?)
    react-native?20.5 kB? (?)
  • @firebase/app-check

    TypeBase (faee34d)Merge (09a0724)Diff
    browser?26.4 kB? (?)
    main?27.3 kB? (?)
    module?26.4 kB? (?)
  • @firebase/app-check-compat

    TypeBase (faee34d)Merge (09a0724)Diff
    browser?2.27 kB? (?)
    main?2.74 kB? (?)
    module?2.27 kB? (?)
  • @firebase/app-compat

    TypeBase (faee34d)Merge (09a0724)Diff
    browser?5.25 kB? (?)
    lite?4.06 kB? (?)
    main?5.82 kB? (?)
    module?5.25 kB? (?)
  • @firebase/auth

    TypeBase (faee34d)Merge (09a0724)Diff
    browser?188 kB? (?)
    cordova?161 kB? (?)
    main?144 kB? (?)
    module?188 kB? (?)
    react-native?161 kB? (?)
  • @firebase/auth-compat

    TypeBase (faee34d)Merge (09a0724)Diff
    browser?20.0 kB? (?)
    main?22.1 kB? (?)
    module?20.0 kB? (?)
  • @firebase/auth-cordova

    TypeBase (faee34d)Merge (09a0724)Diff
    browser?161 kB? (?)
    module?161 kB? (?)
  • @firebase/auth-web-extension

    TypeBase (faee34d)Merge (09a0724)Diff
    browser?139 kB? (?)
    main?156 kB? (?)
    module?139 kB? (?)
  • @firebase/auth/internal

    TypeBase (faee34d)Merge (09a0724)Diff
    browser?198 kB? (?)
    main?169 kB? (?)
    module?198 kB? (?)
  • @firebase/component

    TypeBase (faee34d)Merge (09a0724)Diff
    browser?6.38 kB? (?)
    main?6.72 kB? (?)
    module?6.38 kB? (?)
  • @firebase/data-connect

    TypeBase (faee34d)Merge (09a0724)Diff
    browser?21.5 kB? (?)
    main?23.7 kB? (?)
    module?21.5 kB? (?)
  • @firebase/database

    TypeBase (faee34d)Merge (09a0724)Diff
    browser?249 kB? (?)
    main?254 kB? (?)
    module?249 kB? (?)
  • @firebase/database-compat

    TypeBase (faee34d)Merge (09a0724)Diff
    browser?18.2 kB? (?)
    main?18.9 kB? (?)
    module?18.2 kB? (?)
  • @firebase/database-compat/standalone

    TypeBase (faee34d)Merge (09a0724)Diff
    main?366 kB? (?)
  • @firebase/firestore

    TypeBase (faee34d)Merge (09a0724)Diff
    browser?391 kB? (?)
    main?611 kB? (?)
    module?391 kB? (?)
    react-native?392 kB? (?)
  • @firebase/firestore-compat

    TypeBase (faee34d)Merge (09a0724)Diff
    browser?20.3 kB? (?)
    main?20.7 kB? (?)
    module?20.3 kB? (?)
    react-native?20.3 kB? (?)
  • @firebase/firestore-lite

    TypeBase (faee34d)Merge (09a0724)Diff
    browser?115 kB? (?)
    main?158 kB? (?)
    module?115 kB? (?)
    react-native?116 kB? (?)
  • @firebase/functions

    TypeBase (faee34d)Merge (09a0724)Diff
    browser?14.2 kB? (?)
    main?14.7 kB? (?)
    module?14.2 kB? (?)
  • @firebase/functions-compat

    TypeBase (faee34d)Merge (09a0724)Diff
    browser?1.73 kB? (?)
    main?2.07 kB? (?)
    module?1.73 kB? (?)
  • @firebase/installations

    TypeBase (faee34d)Merge (09a0724)Diff
    browser?17.6 kB? (?)
    main?18.2 kB? (?)
    module?17.6 kB? (?)
  • @firebase/installations-compat

    TypeBase (faee34d)Merge (09a0724)Diff
    browser?945 B? (?)
    main?1.27 kB? (?)
    module?945 B? (?)
  • @firebase/logger

    TypeBase (faee34d)Merge (09a0724)Diff
    main?3.78 kB? (?)
    module?3.21 kB? (?)
  • @firebase/messaging

    TypeBase (faee34d)Merge (09a0724)Diff
    browser?21.5 kB? (?)
    main?22.0 kB? (?)
    module?21.5 kB? (?)
  • @firebase/messaging-compat

    TypeBase (faee34d)Merge (09a0724)Diff
    browser?2.08 kB? (?)
    main?2.43 kB? (?)
    module?2.08 kB? (?)
  • @firebase/messaging-sw

    TypeBase (faee34d)Merge (09a0724)Diff
    main?23.3 kB? (?)
    module?22.8 kB? (?)
  • @firebase/performance

    TypeBase (faee34d)Merge (09a0724)Diff
    browser?31.2 kB? (?)
    main?31.7 kB? (?)
    module?31.2 kB? (?)
  • @firebase/performance-compat

    TypeBase (faee34d)Merge (09a0724)Diff
    browser?1.10 kB? (?)
    main?1.42 kB? (?)
    module?1.10 kB? (?)
  • @firebase/remote-config

    TypeBase (faee34d)Merge (09a0724)Diff
    browser?41.5 kB? (?)
    main?42.7 kB? (?)
    module?41.5 kB? (?)
  • @firebase/remote-config-compat

    TypeBase (faee34d)Merge (09a0724)Diff
    browser?1.85 kB? (?)
    main?2.18 kB? (?)
    module?1.85 kB? (?)
  • @firebase/rules-unit-testing

    TypeBase (faee34d)Merge (09a0724)Diff
    main?11.7 kB? (?)
  • @firebase/storage

    TypeBase (faee34d)Merge (09a0724)Diff
    browser?58.3 kB? (?)
    main?59.8 kB? (?)
    module?58.3 kB? (?)
  • @firebase/storage-compat

    TypeBase (faee34d)Merge (09a0724)Diff
    browser?5.66 kB? (?)
    main?6.04 kB? (?)
    module?5.66 kB? (?)
  • @firebase/telemetry

    TypeBase (faee34d)Merge (09a0724)Diff
    browser?7.08 kB? (?)
    main?7.19 kB? (?)
    module?7.08 kB? (?)
  • @firebase/util

    TypeBase (faee34d)Merge (09a0724)Diff
    browser?29.1 kB? (?)
    main?35.5 kB? (?)
    module?29.1 kB? (?)
  • @firebase/webchannel-wrapper

    TypeBase (faee34d)Merge (09a0724)Diff
    main?38 B? (?)
  • @firebase/webchannel-wrapper/bloom-blob

    TypeBase (faee34d)Merge (09a0724)Diff
    browser?11.3 kB? (?)
    main?11.3 kB? (?)
    module?11.3 kB? (?)
  • @firebase/webchannel-wrapper/webchannel-blob

    TypeBase (faee34d)Merge (09a0724)Diff
    browser?40.9 kB? (?)
    main?40.9 kB? (?)
    module?40.9 kB? (?)
  • bundle

    46 size changes

    TypeBase (faee34d)Merge (09a0724)Diff
    analytics (logEvent)?44.1 kB? (?)
    app-check (CustomProvider)?37.3 kB? (?)
    app-check (ReCaptchaEnterpriseProvider)?39.6 kB? (?)
    app-check (ReCaptchaV3Provider)?39.6 kB? (?)
    auth (Anonymous)?74.8 kB? (?)
    auth (EmailAndPassword)?84.5 kB? (?)
    auth (GoogleFBTwitterGitHubPopup)?106 kB? (?)
    auth (GooglePopup)?98.2 kB? (?)
    auth (GoogleRedirect)?98.3 kB? (?)
    auth (Phone)?91.8 kB? (?)
    database (Append to a list of data)?154 kB? (?)
    database (Filtering data)?153 kB? (?)
    database (Listen for child events)?169 kB? (?)
    database (Listen for value events + Detach listeners)?169 kB? (?)
    database (Listen for value events)?169 kB? (?)
    database (Read data once)?168 kB? (?)
    database (Save data as transactions)?171 kB? (?)
    database (Sort data)?154 kB? (?)
    database (Write data)?153 kB? (?)
    firestore (CSI Auto Indexing Disable and Delete)?286 kB? (?)
    firestore (CSI Auto Indexing Enable)?286 kB? (?)
    firestore (Persistence)?318 kB? (?)
    firestore (Query Cursors)?257 kB? (?)
    firestore (Query)?255 kB? (?)
    firestore (Read data once)?245 kB? (?)
    firestore (Read Write w Persistence)?338 kB? (?)
    firestore (Realtime updates)?245 kB? (?)
    firestore (Transaction)?223 kB? (?)
    firestore (Write data)?225 kB? (?)
    firestore-lite (Query Cursors)?110 kB? (?)
    firestore-lite (Query)?106 kB? (?)
    firestore-lite (Read data once)?81.7 kB? (?)
    firestore-lite (Transaction)?107 kB? (?)
    firestore-lite (Write data)?91.2 kB? (?)
    functions (call)?38.8 kB? (?)
    messaging (send + receive)?46.4 kB? (?)
    performance (trace)?62.1 kB? (?)
    remote-config (getAndFetch)?61.1 kB? (?)
    storage (getBytes)?46.6 kB? (?)
    storage (getDownloadURL)?48.7 kB? (?)
    storage (getMetadata)?48.2 kB? (?)
    storage (list + listAll)?47.6 kB? (?)
    storage (updateMetadata)?48.4 kB? (?)
    storage (uploadBytes)?53.3 kB? (?)
    storage (uploadBytesResumable)?63.2 kB? (?)
    storage (uploadString)?53.5 kB? (?)

  • firebase

    33 size changes

    TypeBase (faee34d)Merge (09a0724)Diff
    firebase-ai.js?51.4 kB? (?)
    firebase-analytics-compat.js?25.4 kB? (?)
    firebase-analytics.js?29.4 kB? (?)
    firebase-app-check-compat.js?22.8 kB? (?)
    firebase-app-check.js?25.0 kB? (?)
    firebase-app-compat.js?31.6 kB? (?)
    firebase-app.js?103 kB? (?)
    firebase-auth-compat.js?142 kB? (?)
    firebase-auth-cordova.js?139 kB? (?)
    firebase-auth-web-extension.js?122 kB? (?)
    firebase-auth.js?159 kB? (?)
    firebase-compat.js?811 kB? (?)
    firebase-data-connect.js?22.6 kB? (?)
    firebase-database-compat.js?168 kB? (?)
    firebase-database.js?192 kB? (?)
    firebase-firestore-compat.js?348 kB? (?)
    firebase-firestore-lite.js?138 kB? (?)
    firebase-firestore.js?454 kB? (?)
    firebase-functions-compat.js?14.8 kB? (?)
    firebase-functions.js?19.5 kB? (?)
    firebase-installations-compat.js?12.7 kB? (?)
    firebase-installations.js?15.0 kB? (?)
    firebase-messaging-compat.js?36.3 kB? (?)
    firebase-messaging-sw.js?29.3 kB? (?)
    firebase-messaging.js?28.6 kB? (?)
    firebase-performance-compat.js?40.3 kB? (?)
    firebase-performance-standalone-compat.js?105 kB? (?)
    firebase-performance.js?45.6 kB? (?)
    firebase-remote-config-compat.js?40.2 kB? (?)
    firebase-remote-config.js?45.1 kB? (?)
    firebase-storage-compat.js?44.2 kB? (?)
    firebase-storage.js?51.1 kB? (?)
    firebase-telemetry.js?87.3 kB? (?)

  • functions

    TypeBase (faee34d)Merge (09a0724)Diff
    main?46 B? (?)

Test Logs

  1. https://storage.googleapis.com/firebase-sdk-metric-reports/qN3gQUlAeq.html

@google-oss-bot
Copy link
Contributor

Size Analysis Report 1

This report is too large (2,233,684 characters) to be displayed here in a GitHub comment. Please use the below link to see the full report on Google Cloud Storage.

Test Logs

  1. https://storage.googleapis.com/firebase-sdk-metric-reports/DLRng6UWnZ.html

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.

3 participants