Skip to content

interop-testing: aggregate accumulated stats by RPC methods in xDS test client #7603

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

Merged

Conversation

voidzcy
Copy link
Contributor

@voidzcy voidzcy commented Nov 9, 2020

Mirrored proto change as grpc/grpc#24703 and its corresponding change for the test client.

@voidzcy voidzcy requested a review from ericgribkoff November 10, 2020 20:39
@@ -281,6 +280,15 @@ private void makeRpc(final RpcType rpcType, final Metadata headersToSend) {
currentRequestId += 1;
requestId = currentRequestId;
savedWatchers.addAll(watchers);
if (!rpcsStartedByMethod.containsKey(rpcType.name())) {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit/optional: is this a standard way of working around Java 7's lack of getOrDefault? This seems slightly "tricky" to me in that it requires thinking to see that that value in the map later on will never be null when rpcsSucceededByMethod.put(rpcType.name(), succeededBase + 1);-type code is executing. Correctness here also requires knowing that no key is ever removed from these maps, which could be less obvious in the future.

I would prefer dropping this block here and just doing the null check when incrementing the value each time, as it seems a bit clearer for future readers:

int rpcsStarted = 0;
if (rpcsStartedBymethod.containsKey(rpcType.name()) {
    rpcsStarted = rpcsStartedByMethod.get(rpcType.name());
}
rpcsStartedByMethod.put(rpcType.name(), rpcsStarted + 1);

But then we have to use the ugly block above in several places as well, so will let you choose whether it's better as-is versus my proposal.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, Java 7 is cumbersome for updating map value. Updated to what you suggested.

@voidzcy voidzcy merged commit bf191cb into grpc:master Nov 11, 2020
sergiitk pushed a commit to sergiitk/grpc-java that referenced this pull request Nov 12, 2020
…st client (grpc#7603)

Update xDS interop test proto to aggregate accumulated stats based on RPC methods (mirroring 643e5bcd1e8db931cf76a3be19cd9bba223ee987 in C-core's change). Updated the xDS interop test client to support querying accumulated stats aggregated to RPC methods.
dfawley pushed a commit to dfawley/grpc-java that referenced this pull request Jan 15, 2021
…st client (grpc#7603)

Update xDS interop test proto to aggregate accumulated stats based on RPC methods (mirroring 643e5bcd1e8db931cf76a3be19cd9bba223ee987 in C-core's change). Updated the xDS interop test client to support querying accumulated stats aggregated to RPC methods.
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 4, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants