Skip to content

fix(bigtable): always include app_profile_id in metadata params#16089

Draft
elinorli wants to merge 1 commit intogoogleapis:mainfrom
elinorli:rls
Draft

fix(bigtable): always include app_profile_id in metadata params#16089
elinorli wants to merge 1 commit intogoogleapis:mainfrom
elinorli:rls

Conversation

@elinorli
Copy link
Copy Markdown
Contributor

@elinorli elinorli commented May 5, 2026

Unconditionally include app_profile_id in x-goog-request-params routing headers across all 17 BigtableMetadata decorator methods, even when it is empty because an empty app profile is treated as the default app profile.

Also, add a new unit test file to verify the metadata formatting behavior for both empty and non-empty app_profile_id values.

…meters

Unconditionally include app_profile_id in x-goog-request-params
routing headers across all 17 BigtableMetadata decorator methods, even
when it is empty because an empty app profile is treated as the default app
profile.

Also, add a new unit test file to verify the metadata formatting behavior
for both empty and non-empty app_profile_id values.
@product-auto-label product-auto-label Bot added the api: bigtable Issues related to the Bigtable API. label May 5, 2026
Copy link
Copy Markdown

@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 modifies the BigtableMetadata decorator to ensure that app_profile_id is always included in the routing parameters, even when the ID is an empty string. This change is applied across 17 different RPC methods. Additionally, a new unit test file, bigtable_metadata_decorator_test.cc, has been introduced to verify this behavior. The review feedback correctly identifies that the logic for adding this parameter is duplicated many times and should be factored out into a helper function to comply with the repository's style guide regarding code duplication.

Comment on lines +79 to +80
params.push_back(absl::StrCat("app_profile_id=",
internal::UrlEncode(request.app_profile_id())));
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

The logic to add app_profile_id to the params vector is duplicated 17 times across this file. According to the repository style guide (lines 13-14), duplicated code appearing 3 or more times should be factored out into a helper function to improve maintainability and ensure consistency across all RPC methods.

References
  1. Prefers to factor out duplicated code if it appears 3 or more times in non-test files. (link)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: bigtable Issues related to the Bigtable API.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant