Set reasonable `GetTopChannelsRequest.max_results`
- 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
Assessment
This issue has not been assessed yet.