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

Adding ResourceScope to ResourceExhaustedFailure #156

Merged
merged 4 commits into from
Mar 28, 2024

Conversation

prathyushpv
Copy link
Contributor

@prathyushpv prathyushpv commented Mar 26, 2024

What changed?
Adding a new field ResourceScope in ResourceExhaustedFailure.

This PR depends on temporalio/api#382.

Why?
We need to differentiate whether a request has been rate limited because of namespace limit or system limit.
This will help us better understand why requests are rate limited and which limits to adjust.

How did you test it?

Potential risks
None

Message string
st *status.Status
}
)

// NewResourceExhausted returns new ResourceExhausted error.
func NewResourceExhausted(cause enumspb.ResourceExhaustedCause, message string) error {
func NewResourceExhausted(cause enumspb.ResourceExhaustedCause, scope enumspb.ResourceScope, message string) error {
Copy link
Member

Choose a reason for hiding this comment

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

While we may think this is only used by us, this is public API at https://pkg.go.dev/go.temporal.io/api/serviceerror and we shouldn't break compatibility IMO. Can we either have a NewResourceExhaustedWithOptions or request that those building this with a scope create the struct directly?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay! I thought only server and go-sdk use this function. Let me make that change.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have removed this argument from this function. It is simpler to create this struct directly.

Copy link
Member

Choose a reason for hiding this comment

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

Thanks! Will approve when api repo PR merged and regen occurs and is merged into this branch

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks @cretz! I have merge api changes..

@prathyushpv prathyushpv merged commit 4a60070 into master Mar 28, 2024
3 checks passed
@prathyushpv prathyushpv deleted the ppv/resource-scope branch March 28, 2024 15:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants