Skip to content

Commit 93d41f9

Browse files
fix(api): add ingest limits to connect push requests (#4586)
* fix(api): add ingest limits to connect push requests * Revert "fix(api): add ingest limits to connect push requests" This reverts commit ba4c2a6. * fix(api): add ingest limits to connect push requests * fmt
1 parent 39e0e7c commit 93d41f9

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

pkg/api/connect_options.go

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@ import (
44
"connectrpc.com/connect"
55

66
connectapi "github.com/grafana/pyroscope/pkg/api/connect"
7+
"github.com/grafana/pyroscope/pkg/tenant"
78
"github.com/grafana/pyroscope/pkg/util"
89
"github.com/grafana/pyroscope/pkg/util/delayhandler"
10+
"github.com/grafana/pyroscope/pkg/validation"
911
)
1012

1113
func connectInterceptorRecovery() connect.HandlerOption {
@@ -32,8 +34,15 @@ func (a *API) connectOptionsAuthRecovery() []connect.HandlerOption {
3234
return append(connectapi.DefaultHandlerOptions(), a.connectInterceptorAuth(), connectInterceptorRecovery())
3335
}
3436

35-
func (a *API) connectOptionsAuthDelayRecovery(limits delayhandler.Limits) []connect.HandlerOption {
36-
return append(connectapi.DefaultHandlerOptions(), a.connectInterceptorAuth(), a.connectInterceptorDelay(limits), connectInterceptorRecovery())
37+
func (a *API) connectOptionsAuthDelayRecovery(limits *validation.Overrides) []connect.HandlerOption {
38+
// no per tenant overrides implemented for connect requests
39+
messageLimit := int(limits.IngestionBodyLimitBytes(tenant.DefaultTenantID))
40+
return append(connectapi.DefaultHandlerOptions(),
41+
a.connectInterceptorAuth(),
42+
connect.WithReadMaxBytes(messageLimit),
43+
a.connectInterceptorDelay(limits),
44+
connectInterceptorRecovery(),
45+
)
3746
}
3847

3948
func (a *API) connectOptionsAuthLogRecovery() []connect.HandlerOption {

0 commit comments

Comments
 (0)