Skip to content

Conversation

@tonybaroneee
Copy link

@tonybaroneee tonybaroneee commented Nov 11, 2025

Discussion

  • This PR add support for a new DynamicLogAttributeProvider (similar to DynamicHeaderProvider which allows us to resolve async attributes (i.e. installation id) during the background otel export. This lets us keep our captureError API synchronous. It's extensible enough to easily support more async attributes in the future.
  • I also added the first usage of this provider: InstallationIdProvider, which attaches the client's firebase installation id to each error log entry.

Testing

  • Added unit tests for InstallationIdProvider
  • Manually verified that the user.id attribute is set correctly 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: 305d3ea

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
@google-oss-bot
Copy link
Contributor

google-oss-bot commented Nov 11, 2025

Size Report 1

Affected Products

  • @firebase/telemetry

    TypeBase (836a427)Merge (35f425a)Diff
    browser6.84 kB8.11 kB+1.27 kB (+18.6%)
    main6.94 kB7.53 kB+588 B (+8.5%)
    module6.84 kB8.11 kB+1.27 kB (+18.6%)
  • firebase

    TypeBase (836a427)Merge (35f425a)Diff
    firebase-telemetry.js73.8 kB88.0 kB+14.1 kB (+19.1%)

Test Logs

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

@google-oss-bot
Copy link
Contributor

google-oss-bot commented Nov 11, 2025

Size Analysis Report 1

Affected Products

  • @firebase/telemetry

    • captureError

      Size

      TypeBase (836a427)Merge (35f425a)Diff
      size4.11 kB4.89 kB+780 B (+19.0%)
      size-with-ext-deps55.0 kB64.3 kB+9.29 kB (+16.9%)

      Dependency

      TypeBase (836a427)Merge (35f425a)Diff
      classes

      AppCheckProvider
      FetchTransport
      OTLPLogExporter
      TelemetryService

      AppCheckProvider
      AsyncAttributeLogExporter
      FetchTransport
      InstallationIdProvider
      OTLPLogExporter
      TelemetryService

      + AsyncAttributeLogExporter
      + InstallationIdProvider

    • flush

      Size

      TypeBase (836a427)Merge (35f425a)Diff
      size3.45 kB4.23 kB+780 B (+22.6%)
      size-with-ext-deps53.7 kB63.0 kB+9.29 kB (+17.3%)

      Dependency

      TypeBase (836a427)Merge (35f425a)Diff
      classes

      AppCheckProvider
      FetchTransport
      OTLPLogExporter
      TelemetryService

      AppCheckProvider
      AsyncAttributeLogExporter
      FetchTransport
      InstallationIdProvider
      OTLPLogExporter
      TelemetryService

      + AsyncAttributeLogExporter
      + InstallationIdProvider

    • getTelemetry

      Size

      TypeBase (836a427)Merge (35f425a)Diff
      size3.49 kB4.27 kB+780 B (+22.4%)
      size-with-ext-deps60.8 kB69.9 kB+9.14 kB (+15.0%)

      Dependency

      TypeBase (836a427)Merge (35f425a)Diff
      classes

      AppCheckProvider
      FetchTransport
      OTLPLogExporter
      TelemetryService

      AppCheckProvider
      AsyncAttributeLogExporter
      FetchTransport
      InstallationIdProvider
      OTLPLogExporter
      TelemetryService

      + AsyncAttributeLogExporter
      + InstallationIdProvider

    • nextOnRequestError

      Size

      TypeBase (836a427)Merge (35f425a)Diff
      size4.48 kB5.26 kB+780 B (+17.4%)
      size-with-ext-deps62.4 kB71.6 kB+9.14 kB (+14.6%)

      Dependency

      TypeBase (836a427)Merge (35f425a)Diff
      classes

      AppCheckProvider
      FetchTransport
      OTLPLogExporter
      TelemetryService

      AppCheckProvider
      AsyncAttributeLogExporter
      FetchTransport
      InstallationIdProvider
      OTLPLogExporter
      TelemetryService

      + AsyncAttributeLogExporter
      + InstallationIdProvider

Test Logs

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

@tonybaroneee tonybaroneee force-pushed the telemetry-capture-fid branch 2 times, most recently from a9e1ad8 to 6cbb429 Compare November 17, 2025 15:46
@tonybaroneee tonybaroneee force-pushed the telemetry-capture-fid branch 3 times, most recently from 1b2654c to e66c193 Compare November 17, 2025 20:06
@tonybaroneee tonybaroneee changed the title Attach fid to captureError in telemetry Add support for async attributes in temeletry otel logger Nov 17, 2025
@tonybaroneee tonybaroneee merged commit d24986a into telemetry Nov 17, 2025
21 checks passed
@tonybaroneee tonybaroneee deleted the telemetry-capture-fid branch November 17, 2025 21:50
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.

4 participants