grpc / grpc/psm-interop

Set reasonable `GetTopChannelsRequest.max_results`

Open
#14 0 comments 0 reactions 1 assignee Claimed by @sergiitk View on GitHub
enhancement
Dominant language
Python
Stars
9
Forks
35
Avg merge
2d 16h
Merged PRs (30d)
3

Description

From [channelz.proto](https://github.com/grpc/grpc/blob/b63a21b419040506df091854c45654dadbf822f2/src/proto/grpc/channelz/channelz.proto#L449-L452C9)

```protobuf
// If non-zero, the server will return a page of results containing
// at most this many items. If zero, the server will choose a
// reasonable page size. Must never be negative.
int64 max_results = 2;
```

Looks like nodejs (unlike other langs) returns just a single channel by default:
```sh
❯ grpcurl -import-path ~dev/grpc/src/proto -proto grpc/channelz/channelz.proto -d '{"max_results": 100}' --plaintext 127.0.0.1:8079 grpc.channelz.v1.Channelz.GetTopChannels | jq '.channel | length'
2
❯ grpcurl -import-path ~dev/grpc/src/proto -proto grpc/channelz/channelz.proto -d '{"max_results": 0}' --plaintext 127.0.0.1:8079 grpc.channelz.v1.Channelz.GetTopChannels | jq '.channel | length'
1
```

Confirmed this behavior in grpc-nodejs v1.7.x and v1.9.x

We've never noticed it, because the framework automatically lists all pages. However, we can remove extra an RPC by setting default `max_results` to something like 10.

cc @murgatroid99

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.