-
Notifications
You must be signed in to change notification settings - Fork 60
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
Allow configuration of GRPC client middleware. #406
Conversation
1f0f6d1
to
ec732c0
Compare
grpcclient/grpcclient.go
Outdated
GRPCMiddleware []grpc.UnaryClientInterceptor `yaml:"-"` | ||
GRPCStreamMiddleware []grpc.StreamClientInterceptor `yaml:"-"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could also call it Middleware
to avoid repeating GRPCClientConfig.GRPCMiddleware
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think calling it Middleware
makes sense since this is already a grpc*
package but I don't feel strongly about it.
grpcclient/grpcclient.go
Outdated
@@ -100,6 +103,9 @@ func (cfg *Config) DialOption(unaryClientInterceptors []grpc.UnaryClientIntercep | |||
} | |||
opts = append(opts, tlsOpts...) | |||
|
|||
unaryClientInterceptors = append(unaryClientInterceptors, cfg.GRPCMiddleware...) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you document how the configured interceptors are ordered with respect to the ones passed to this method?
grpcclient/grpcclient.go
Outdated
GRPCMiddleware []grpc.UnaryClientInterceptor `yaml:"-"` | ||
GRPCStreamMiddleware []grpc.StreamClientInterceptor `yaml:"-"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think calling it Middleware
makes sense since this is already a grpc*
package but I don't feel strongly about it.
ec732c0
to
68caf56
Compare
…c-client-middleware
**What this PR does / why we need it**: This is a small update to dskit that includes grafana/dskit#406 which will allow us to intercept gRPC request in call clients. **Checklist** - [ ] Reviewed the [`CONTRIBUTING.md`](https://github.com/grafana/loki/blob/main/CONTRIBUTING.md) guide (**required**) - [ ] Documentation added - [ ] Tests updated - [ ] `CHANGELOG.md` updated - [ ] If the change is worth mentioning in the release notes, add `add-to-release-notes` label - [ ] Changes that require user attention or interaction to upgrade are documented in `docs/sources/setup/upgrade/_index.md` - [ ] For Helm chart changes bump the Helm chart version in `production/helm/loki/Chart.yaml` and update `production/helm/loki/CHANGELOG.md` and `production/helm/loki/README.md`. [Example PR](d10549e) --------- Co-authored-by: Michel Hollands <42814411+MichelHollands@users.noreply.github.com>
Similar to the server [config](https://github.com/grafana/dskit/blob/dcd7c1e06a38c25d44664a91cc8794b0d557b77d/server/server.go#L105-L106) one should be able to configure GRPC interceptors for the clients. Loki's ingester client [config](https://github.com/grafana/loki/blob/1ac7410b78416e25179b4fe589e9035793d67025/pkg/ingester/client/client.go#L45-L46) allows this but it should be available for any client.
**What this PR does / why we need it**: This is a small update to dskit that includes grafana/dskit#406 which will allow us to intercept gRPC request in call clients. **Checklist** - [ ] Reviewed the [`CONTRIBUTING.md`](https://github.com/grafana/loki/blob/main/CONTRIBUTING.md) guide (**required**) - [ ] Documentation added - [ ] Tests updated - [ ] `CHANGELOG.md` updated - [ ] If the change is worth mentioning in the release notes, add `add-to-release-notes` label - [ ] Changes that require user attention or interaction to upgrade are documented in `docs/sources/setup/upgrade/_index.md` - [ ] For Helm chart changes bump the Helm chart version in `production/helm/loki/Chart.yaml` and update `production/helm/loki/CHANGELOG.md` and `production/helm/loki/README.md`. [Example PR](grafana@d10549e) --------- Co-authored-by: Michel Hollands <42814411+MichelHollands@users.noreply.github.com>
What this PR does:
Similar to the server config one should be able to configure GRPC interceptors for the clients. Loki's ingester client config allows this but it should be available for any client.
Checklist
CHANGELOG.md
updated - the order of entries should be[CHANGE]
,[FEATURE]
,[ENHANCEMENT]
,[BUGFIX]