Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong delimiter in Query Metrics #338

Open
psdutkiewicz opened this issue May 26, 2020 · 2 comments
Open

Wrong delimiter in Query Metrics #338

psdutkiewicz opened this issue May 26, 2020 · 2 comments

Comments

@psdutkiewicz
Copy link

Describe the bug
Calling CosmosAsyncContainer.queryItems() with FeedOptions.isPopulateQueryMetrics() == true produces java.lang.NumberFormatException

To Reproduce
Call CosmosAsyncContainer.queryItems() with FeedOptions.isPopulateQueryMetrics() == true

Expected behavior
Should parse metrics.

Actual behavior
java.lang.NumberFormatException is thrown

Environment summary
SDK Version: 4.0.1
Java JDK version: 11
OS Version: Win10

Additional context
Adding Locale.US into String.format() should fix this issue.

queryMetricsDelimitedString += String.format(";%s=%.2f", QueryMetricsConstants.RequestCharge, pageResult.getRequestCharge());

@kushagraThapar
Copy link
Member

@psdutkiewicz - this repository represents azure-cosmosdb version 2.x.x
v4 cosmos SDK is located here : https://github.com/Azure/azure-sdk-for-java/tree/master/sdk/cosmos/azure-cosmos
which version of SDK are you using, since 4.0.1 is not released yet.

@psdutkiewicz
Copy link
Author

@kushagraThapar Of course I made a mistake and made an issue in wrong repo... Sorry for that.

Nevertheless, here is the same issue. Of course, default Locale can be set by user to properly parse double to string, but I think this code should not depend on user Locale settings.

queryMetricsDelimitedString += String.format(";%s=%.2f", QueryMetricsConstants.RequestCharge, pageResult.getRequestCharge());

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

No branches or pull requests

2 participants