-
-
Notifications
You must be signed in to change notification settings - Fork 452
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
Handle namespaces for metric_bucket
rate limits
#1728
Conversation
31263c6
to
637b69b
Compare
637b69b
to
e8fef31
Compare
/** | ||
* $parameters[0] - retry_after | ||
* $parameters[1] - categories | ||
* $parameters[2] - scope (not used) | ||
* $parameters[3] - reason_code (not used) | ||
* $parameters[4] - namespaces (only returned if categories contains "metric_bucket"). | ||
*/ | ||
$parameters = explode(':', $limit, 5); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you use something like list($retry_after, $categories, ...)
here to translate the comment into code? Note that the last few components are optional, though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will fail miserably, if not set 😬
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can append str_repeat(':', 5)
to the $limit
so the explode always returns at least 5 parts 😉 Missing entries will be empty strings then.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is a lot more complex yeah, but looks good from a distance!
#1726 seemed to simple to be true, and it wasn't 😬
This adds proper handling of metric namespaces. While the SDK does not support adding a namespace to a metric, Relay could reply with a
X-Sentry-Rate-Limits
header that could contain nonecustom
namespaces, in which case we're still good sending our, inferredcustom
namespaces metrics.Refs getsentry/team-sdks#77