Skip to content

Limiter extension configgrpc integration draft #12600

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

Closed
wants to merge 9 commits into from

Conversation

jmacd
Copy link
Contributor

@jmacd jmacd commented Mar 11, 2025

Description

Demonstrates how a Limiters []limter.Limiter will be threaded through the gRPC ServerConfig struct, allowing limiters to integrate with gRPC servers easily.

Link to tracking issue

Part of #9591.

Testing

TODO

Documentation

TODO

Comment on lines +192 to +195
// Limiters are a collection of limiter extensions. Each
// Limitation names an extension that is expected to implement
// limiter.Extension. They are called in order.
Limiters []configlimiter.Limitation `mapreduce:"limiters"`
Copy link
Member

@bogdandrutu bogdandrutu Mar 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure I can see a case with multiple limiters, but it is ok I believe. Maybe in the PR description add a case where you can see multiple limiters being used.

Copy link
Member

@bogdandrutu bogdandrutu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confused a bit about limiter vs limit (#12601) but otherwise config/ changes are ok, please update configlimiter to configlimit if we go with that.

@@ -478,6 +485,8 @@ func (gss *ServerConfig) getGrpcServerOptions(
var uInterceptors []grpc.UnaryServerInterceptor
var sInterceptors []grpc.StreamServerInterceptor

// Initialize the auth extension first.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add in the comment if there is any specific reason.

}
limitExts = append(limitExts, lim)
}
if limitExts != nil {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is a best practice to compare len with 0 than the slice with nil.

@jmacd
Copy link
Contributor Author

jmacd commented Mar 12, 2025

See #12603 (comment).

@jmacd jmacd closed this Mar 12, 2025
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.

2 participants