Skip to content

Limiter extension configgrpc integration draft#12600

Closed
jmacd wants to merge 9 commits into
open-telemetry:mainfrom
jmacd:jmacd/limit_otlp
Closed

Limiter extension configgrpc integration draft#12600
jmacd wants to merge 9 commits into
open-telemetry:mainfrom
jmacd:jmacd/limit_otlp

Conversation

@jmacd
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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.

var uInterceptors []grpc.UnaryServerInterceptor
var sInterceptors []grpc.StreamServerInterceptor

// Initialize the auth extension first.
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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