Skip to content
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

Merged
merged 2 commits into from
Oct 17, 2023

Conversation

jeschkies
Copy link
Contributor

@jeschkies jeschkies commented Oct 16, 2023

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

  • Tests updated
  • CHANGELOG.md updated - the order of entries should be [CHANGE], [FEATURE], [ENHANCEMENT], [BUGFIX]

Comment on lines 41 to 42
GRPCMiddleware []grpc.UnaryClientInterceptor `yaml:"-"`
GRPCStreamMiddleware []grpc.StreamClientInterceptor `yaml:"-"`
Copy link
Contributor Author

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.

Copy link
Contributor

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.

@@ -100,6 +103,9 @@ func (cfg *Config) DialOption(unaryClientInterceptors []grpc.UnaryClientIntercep
}
opts = append(opts, tlsOpts...)

unaryClientInterceptors = append(unaryClientInterceptors, cfg.GRPCMiddleware...)
Copy link
Contributor

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?

Comment on lines 41 to 42
GRPCMiddleware []grpc.UnaryClientInterceptor `yaml:"-"`
GRPCStreamMiddleware []grpc.StreamClientInterceptor `yaml:"-"`
Copy link
Contributor

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.

@jeschkies jeschkies force-pushed the karsten/configure-grpc-client-middleware branch from ec732c0 to 68caf56 Compare October 17, 2023 08:17
@jeschkies jeschkies merged commit 7b512eb into main Oct 17, 2023
3 checks passed
@jeschkies jeschkies deleted the karsten/configure-grpc-client-middleware branch October 17, 2023 08:39
@jeschkies jeschkies restored the karsten/configure-grpc-client-middleware branch October 17, 2023 08:39
@jeschkies jeschkies deleted the karsten/configure-grpc-client-middleware branch October 17, 2023 08:39
jeschkies added a commit to grafana/loki that referenced this pull request Oct 18, 2023
**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>
ying-jeanne pushed a commit that referenced this pull request Nov 2, 2023
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.
rhnasc pushed a commit to inloco/loki that referenced this pull request Apr 12, 2024
**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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants