Skip to content

Set reasonable GetTopChannelsRequest.max_results #14

Description

@sergiitk

From channelz.proto

  // 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:

❯ 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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions