aws-sdk-java-v2 icon indicating copy to clipboard operation
aws-sdk-java-v2 copied to clipboard

DynamoDbEnhancedClient allow to request to return capacity on all data plane operations

Open arjanschaaf opened this issue 2 years ago • 7 comments

Describe the feature

https://github.com/aws/aws-sdk-java-v2/issues/2095 added ReturnConsumedCapacity for putItem, updateItem and deleteItem operations, but other Data plane operations should allow you to request to return consumed capacity as offered by the DynamoDB API on their (paged) return.

This should include the following Data plane operations:

  • DynamoDbEnhancedClient.batchGetItem
  • DynamoDbEnhancedClient.batchWriteItem
  • DynamoDbEnhancedClient.transactGetItems
  • DynamoDbEnhancedClient.transactWriteItems
  • DynamoDbTable.getitem
  • DynamoDbTable.query
  • DynamoDbTable.scan

Use Case

Common scenario is to request to the DynamoDB API to return the consumed capacity to log or debug the read or write capacity used by the data plane operation.

Proposed Solution

Continue by adding functionality introduced in https://github.com/aws/aws-sdk-java-v2/issues/2095 by either adding *WithResponse methods to these classes or extend the existing response objects to include the consumed capacity.

Other Information

No response

Acknowledgements

  • [X] I may be able to implement this feature request
  • [ ] This feature might incur a breaking change

AWS Java SDK version used

2.20.88

JDK version used

OpenJDK Runtime Environment Corretto-20.0.1.9.1 (build 20.0.1+9-FR)

Operating System and version

macOS Ventura 13.4

arjanschaaf avatar Jun 21 '23 14:06 arjanschaaf

That's fair, feature request acknowledged.

Community note: please show your support by adding a 👍 to the original description above to help us prioritize this request.

debora-ito avatar Jul 24 '23 23:07 debora-ito

Quick update:

ReturnConsumedCapacity is now supported by :

  • GetItem (and TransactGetItems as a consequence), as part of version 2.20.146 (via #4375)
  • BatchGetItem, as part of 2.20.147 (via #4421)

debora-ito avatar Sep 18 '23 18:09 debora-ito

Query and Scan now support ConsumedCapacity too, since version 2.20.153 (via #4444).

debora-ito avatar Sep 27 '23 01:09 debora-ito

Query and Scan now support ConsumedCapacity too, since version 2.20.153 (via #4444).

Hi @debora-ito - Any plans on supporting BatchWriteItem and TransactWriteItem in the future?

prateek-vats avatar Aug 03 '24 14:08 prateek-vats

Query and Scan now support ConsumedCapacity too, since version 2.20.153 (via #4444).

Hi @debora-ito - Any plans on supporting BatchWriteItem and TransactWriteItem in the future?

I can take a stab at it, if this has not been implemented yet

prateek-vats avatar Aug 03 '24 16:08 prateek-vats

Here's a PR for supporting ConsumedCapacity in BatchWriteItems and TransactWriteItems https://github.com/aws/aws-sdk-java-v2/pull/5462

prateek-vats avatar Aug 03 '24 19:08 prateek-vats

Hi @debora-ito I reviewed the SDK code and relevant pull requests, and it appears that all operations have been progressively enhanced to support returning capacity when requested. These include:

  • DynamoDbEnhancedClient.batchGetItem
  • DynamoDbEnhancedClient.batchWriteItem
  • DynamoDbEnhancedClient.transactGetItems
  • DynamoDbEnhancedClient.transactWriteItems
  • DynamoDbTable.getItem
  • DynamoDbTable.query
  • DynamoDbTable.scan

Given that this functionality is now implemented across all relevant operations, I believe this task can be closed as there are no further changes required.

roamariei avatar Feb 12 '25 10:02 roamariei

Indeed, all operations now support ConsumedCapacity in the response. Closing.

debora-ito avatar Aug 11 '25 20:08 debora-ito

This issue is now closed. Comments on closed issues are hard for our team to see. If you need more assistance, please open a new issue that references this one.

github-actions[bot] avatar Aug 11 '25 20:08 github-actions[bot]