Repository navigation
Firestore (Desktop): send current user agent with every request - #1987
Open
AustinBenoit wants to merge 2 commits into
Open
AustinBenoit wants to merge 2 commits into
AustinBenoit wants to merge 2 commits into
Conversation
The desktop metadata provider sent the user agent stored with the day's heartbeat, once a day, and nothing on other requests. That heartbeat is logged when the App is created, before Firestore registers fire-fst, so desktop Firestore usage was mostly unattributed. Match the Android and iOS providers: flag one request per day as the heartbeat, and send the current App::GetUserAgent() on every request.
Contributor
There was a problem hiding this comment.
Code Review
This pull request updates the desktop Firestore metadata provider to always send the current Firebase user agent with each request, aligning its behavior with the Android and iOS SDKs, and updates the release notes. The review feedback correctly identifies a potential null pointer dereference risk if App::GetUserAgent() returns nullptr, recommending a defensive check before adding the user agent to the metadata.
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
On desktop,
FirebaseMetadataProviderCpppreviously sent the user agent stored inside today's heartbeat once per day and omittedx-firebase-clienton subsequent requests. Because that heartbeat is logged duringApp::Create()before Firestore registersfire-fst, desktop Firestore usage was largely unattributed.Match the Android and iOS metadata providers:
App::GetUserAgent()inx-firebase-clienton every gRPC request.x-firebase-client-log-type: 2at most once per day usingGetAndResetTodaysStoredHeartbeats().Testing
firebase_metadata_provider_desktop.cc.olocally on Linux (clang-19).scripts/gha/check_copyright.sh -gandscripts/format_code.py -git_diff -noformat_file.Type of Change
Place an
xthe applicable box: