Skip to content

feat(datastore): add support for request tags - #13732

Open
rahulmane-goog wants to merge 10 commits into
googleapis:mainfrom
rahulmane-goog:feat-datastore-request-tags
Open

feat(datastore): add support for request tags#13732
rahulmane-goog wants to merge 10 commits into
googleapis:mainfrom
rahulmane-goog:feat-datastore-request-tags

Conversation

@rahulmane-goog

@rahulmane-goog rahulmane-goog commented Jul 13, 2026

Copy link
Copy Markdown

This PR introduced sending request tags for different datastore requests. The tags can be passed using 2 mechanisms:

  1. Instance Level tags.
  2. Request Level tags.
  • RequestOptions is the proto that holds all the instance and request level tags and is a part of all request protos.
  • DatastoreOptions allows the ability to set the instance level tags using setRequestTags. Any operation executed via this Datastore client automatically includes these global request tags in the outbound RPC request payload.
  • RequestOptionsHelper an internal utility that combines instance-level tags from DatastoreOptions with any request-level RequestOptions protobuf message before building the wire request.
  • DatastoreExecutionOptions is a holder object for all different options like ExplainOptions, RequestOptions and ReadOption.
  • Overloaded versions for taking in the DatastoreExecutionOptions for each of the following operations:
    • put
    • get
    • fetch
    • delete
    • newTransaction
    • commit
    • rollback
    • allocateId
    • reserveIds
    • runQuery
    • runAggregationQuery
  • Each of these overloaded versions copy the request tags into the request protos.

@rahulmane-goog
rahulmane-goog requested review from a team as code owners July 13, 2026 13:26

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

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 support for passing and merging RequestOptions (such as request tags) in Datastore queries and aggregation queries, allowing both instance-level and request-level tags to be propagated. The feedback highlights a critical issue where instance-level tags are ignored when query-level RequestOptions are not explicitly provided in QueryResultsImpl and AggregationQueryRequestProtoPreparer. Additionally, the reviewer suggests simplifying the varargs withRequestTags overload in Datastore by delegating to the List version, and adding a test case to verify that instance-level tags are correctly populated and sent with queries.

@rahulmane-goog
rahulmane-goog force-pushed the feat-datastore-request-tags branch from f124116 to aab1fd3 Compare July 13, 2026 13:43

@rahulmane-goog rahulmane-goog left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Please review

@lqiu96 lqiu96 added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jul 13, 2026
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jul 13, 2026
@jinseopkim0

Copy link
Copy Markdown
Contributor

ci / lint is failing. Could you please take a look?

@rahulmane-goog

Copy link
Copy Markdown
Author

ci / lint is failing. Could you please take a look?

Fixed

@rahulmane-goog
rahulmane-goog force-pushed the feat-datastore-request-tags branch 3 times, most recently from d61b477 to 75e872b Compare July 16, 2026 10:12
@rahulmane-goog
rahulmane-goog force-pushed the feat-datastore-request-tags branch from 9efbab9 to c0b0c8d Compare July 29, 2026 08:24
@rahulmane-goog
rahulmane-goog force-pushed the feat-datastore-request-tags branch 3 times, most recently from acd9d7e to 57f258d Compare July 31, 2026 06:46

@lqiu96 lqiu96 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, thanks for the changes and working with us on this!

@rahulmane-goog
rahulmane-goog force-pushed the feat-datastore-request-tags branch from 23340cc to 6fa4151 Compare August 1, 2026 06:23
@rahulmane-goog
rahulmane-goog force-pushed the feat-datastore-request-tags branch from 1a30ae5 to 99f6374 Compare August 3, 2026 06:56
@lqiu96 lqiu96 added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Aug 3, 2026
@lqiu96

lqiu96 commented Aug 3, 2026

Copy link
Copy Markdown
Member

Last lint issue:

[ERROR] To fix formatting errors, run "mvn com.spotify.fmt:fmt-maven-plugin:format"
[ERROR] Non complying file: /home/runner/work/google-cloud-java/google-cloud-java/java-datastore/google-cloud-datastore/src/main/java/com/google/cloud/datastore/TransactionImpl.java
[ERROR] Non complying file: /home/runner/work/google-cloud-java/google-cloud-java/java-datastore/google-cloud-datastore/src/main/java/com/google/cloud/datastore/ReadOption.java
[ERROR] Non complying file: /home/runner/work/google-cloud-java/google-cloud-java/java-datastore/google-cloud-datastore/src/main/java/com/google/cloud/datastore/DatastoreImpl.java
[ERROR] Non complying file: /home/runner/work/google-cloud-java/google-cloud-java/java-datastore/google-cloud-datastore/src/main/java/com/google/cloud/datastore/execution/AggregationQueryExecutor.java
[ERROR] Non complying file: /home/runner/work/google-cloud-java/google-cloud-java/java-datastore/google-cloud-datastore/src/main/java/com/google/cloud/datastore/RequestOptionsHelper.java
[ERROR] Non complying file: /home/runner/work/google-cloud-java/google-cloud-java/java-datastore/google-cloud-datastore/src/main/java/com/google/cloud/datastore/QueryResultsImpl.java
[ERROR] Non complying file: /home/runner/work/google-cloud-java/google-cloud-java/java-datastore/google-cloud-datastore/src/main/java/com/google/cloud/datastore/Datastore.java
[ERROR] Non complying file: /home/runner/work/google-cloud-java/google-cloud-java/java-datastore/google-cloud-datastore/src/main/java/com/google/cloud/datastore/DatastoreOptions.java
[ERROR] Non complying file: /home/runner/work/google-cloud-java/google-cloud-java/java-datastore/google-cloud-datastore/src/test/java/com/google/cloud/datastore/AbstractDatastoreTest.java
[ERROR] Non complying file: /home/runner/work/google-cloud-java/google-cloud-java/java-datastore/google-cloud-datastore/src/test/java/com/google/cloud/datastore/models/RequestOptionsTest.java
[ERROR] Non complying file: /home/runner/work/google-cloud-java/google-cloud-java/java-datastore/google-cloud-datastore/src/test/java/com/google/cloud/datastore/it/AbstractITDatastoreTest.java

@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Aug 3, 2026
@rahulmane-goog
rahulmane-goog force-pushed the feat-datastore-request-tags branch from 3c1f78c to 52496fc Compare August 4, 2026 07:41
@jinseopkim0 jinseopkim0 added kokoro:force-run Add this label to force Kokoro to re-run the tests. kokoro:run Add this label to force Kokoro to re-run the tests. labels Aug 4, 2026
@yoshi-kokoro yoshi-kokoro removed kokoro:run Add this label to force Kokoro to re-run the tests. kokoro:force-run Add this label to force Kokoro to re-run the tests. labels Aug 4, 2026
@lqiu96

lqiu96 commented Aug 4, 2026

Copy link
Copy Markdown
Member

/gcbrun

@lqiu96 lqiu96 added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Aug 4, 2026
@lqiu96

lqiu96 commented Aug 4, 2026

Copy link
Copy Markdown
Member

/gcbrun

@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Aug 4, 2026
@rahulmane-goog
rahulmane-goog force-pushed the feat-datastore-request-tags branch from 23f547e to 8a810e8 Compare August 5, 2026 06:57
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