Skip to content

Allow interceptors to implement their own CallOptions #1223

@mwitkow

Description

@mwitkow

grpc-ecosystem/go-grpc-middleware implements retry logic and other client-side interceptors.
See an example here:
https://github.com/grpc-ecosystem/go-grpc-middleware/blob/master/retry/options.go#L94

Now, it implements it by relying on an anonymous instantiation of grpc.CallOptions without providing an implementation. The client-side Unary and Stream interceptors then strip them before passing them to grpc.invoke.

However, this causes panics when users use the CallOptions without the interceptors, see:
grpc-ecosystem/go-grpc-middleware#37

I propose adding a grpc.NoOpCallOption that CallOptions implemented in middleware. This would implement both the private before and after methods without doing anything, keeping the callInfo private.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions