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

Update GrpcInflightMethodLimiter to support interceptors #643

Merged
merged 3 commits into from
Jan 31, 2025

Conversation

jhalterman
Copy link
Member

@jhalterman jhalterman commented Jan 31, 2025

What this PR does:

This PR adds server interceptor support to the GrpcInflightMethodLimiter via a RPCCallProcessing callback. This is in addition to the existing tap handle support via RPCCallStarting.

Interceptors are needed for inflight limiting where we want request blocking to be able to happen, since tap handles are not meant to have any blocking occur. In particular, adaptive limiters will use tap handles for most rejection, but interceptors for any blocking of requests that might be needed since they'll generally keep concurrency limits low.

This will require downstream users of GrpcInflightMethodLimiter to implement RPCCallProcessing, which can be a noop if it's not used:

func (m *methodLimiter) RPCCallProcessing(_ context.Context, _ string) (func(error), error) {
	return nil, nil
}

Which issue(s) this PR fixes:

Fixes #

Checklist

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

@jhalterman jhalterman marked this pull request as ready for review January 31, 2025 02:25
@jhalterman jhalterman added the enhancement New feature or request label Jan 31, 2025
Copy link
Contributor

@56quarters 56quarters left a comment

Choose a reason for hiding this comment

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

LGTM

@jhalterman jhalterman merged commit 72eb578 into grafana:main Jan 31, 2025
5 checks passed
@jhalterman jhalterman deleted the adaptivelimiter branch January 31, 2025 17:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants