diff --git a/docs/sources/reference/components/pyroscope/pyroscope.receive_http.md b/docs/sources/reference/components/pyroscope/pyroscope.receive_http.md index 06267706b6..420065d406 100644 --- a/docs/sources/reference/components/pyroscope/pyroscope.receive_http.md +++ b/docs/sources/reference/components/pyroscope/pyroscope.receive_http.md @@ -6,7 +6,7 @@ title: pyroscope.receive_http # pyroscope.receive_http -`pyroscope.receive_http` listens for HTTP requests containing profiles and forwards them to other components capable of receiving profiles. +`pyroscope.receive_http` receives profiles over HTTP and forwards them to `pyroscope.*` components capable of receiving profiles. The HTTP API exposed is compatible with the Pyroscope [HTTP ingest API](https://grafana.com/docs/pyroscope/latest/configure-server/about-server-api/). This allows `pyroscope.receive_http` to act as a proxy for Pyroscope profiles, enabling flexible routing and distribution of profile data. diff --git a/internal/component/pyroscope/receive_http/receive_http.go b/internal/component/pyroscope/receive_http/receive_http.go index 5e28a5191a..5db58b137e 100644 --- a/internal/component/pyroscope/receive_http/receive_http.go +++ b/internal/component/pyroscope/receive_http/receive_http.go @@ -19,10 +19,15 @@ import ( "github.com/grafana/alloy/internal/runtime/logging/level" ) +const ( + // defaultMaxConnLimit defines the maximum number of simultaneous HTTP connections + defaultMaxConnLimit = 100 +) + func init() { component.Register(component.Registration{ Name: "pyroscope.receive_http", - Stability: featuregate.StabilityGenerallyAvailable, + Stability: featuregate.StabilityPublicPreview, Args: Arguments{}, Build: func(opts component.Options, args component.Arguments) (component.Component, error) { return New(opts, args.(Arguments)) @@ -37,8 +42,12 @@ type Arguments struct { // SetToDefault implements syntax.Defaulter. func (a *Arguments) SetToDefault() { + serverConfig := fnet.DefaultServerConfig() + if serverConfig.HTTP.ConnLimit > defaultMaxConnLimit { + serverConfig.HTTP.ConnLimit = defaultMaxConnLimit + } *a = Arguments{ - Server: fnet.DefaultServerConfig(), + Server: serverConfig, } } @@ -82,9 +91,11 @@ func (c *Component) Update(args component.Arguments) error { c.appendables = newArgs.ForwardTo + // if no server config provided, we'll use defaults if newArgs.Server == nil { - newArgs.Server = fnet.DefaultServerConfig() + newArgs.Server = &fnet.ServerConfig{} } + if newArgs.Server.HTTP == nil { newArgs.Server.HTTP = &fnet.HTTPConfig{ ListenPort: 0,