-
Notifications
You must be signed in to change notification settings - Fork 715
feat: Implement artificial ingestion delay. #4251
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
Conversation
215388a to
6cb7d77
Compare
kolesnikovae
left a comment
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.
LGTM
Thanks for adding this!
pkg/util/delayhandler/http.go
Outdated
| func NewHTTP(limits Limits) func(h http.Handler) http.Handler { | ||
| return func(h http.Handler) http.Handler { | ||
| return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { | ||
| start := timeNow() | ||
| ctx := r.Context() | ||
|
|
||
| delay := getDelay(ctx, limits) | ||
| var delayRw *delayedResponseWriter | ||
| if delay > 0 { | ||
| w, delayRw = wrapResponseWriter(w, start.Add(delay)) | ||
| } | ||
|
|
||
| // now run the chain after me | ||
| h.ServeHTTP(w, r.WithContext(ctx)) |
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.
I'm not sure why we replace the request context. If we haven't modified it, it should not be needed
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.
Good spotted, I had a trace span created in some previous version
This implements the ability to add artificial delay to the ingestion handlers. This is useful during the v2 migration process in order to spot how client will behave Fixes grafana/pyroscope-squad#454
f11b7e4 to
bd040b5
Compare
* feat: Add artificial ingestion delay This implements the ability to add artificial delay to the ingestion handlers. This is useful during the v2 migration process in order to spot how client will behave Fixes grafana/pyroscope-squad#454 * Remove unnecessary ctx variable * Use unimplemented embedding
This implements the ability to add artificial delay to the ingestion handlers.
This is useful during the v2 migration process in order to spot how client will behave
Inspired by Mimir implementation:
artificialDelayonServerTimingheader for push requests mimir#11265This relies on #4249
Once this is enabled, we also need to update dashboards to show the metrics without artificial delay