-
Notifications
You must be signed in to change notification settings - Fork 488
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into switch-testing-build-image-to-gh-action
- Loading branch information
Showing
165 changed files
with
9,278 additions
and
1,015 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
package receiver | ||
|
||
import ( | ||
"time" | ||
|
||
"github.com/alecthomas/units" | ||
"github.com/grafana/agent/component/common/loki" | ||
"github.com/grafana/agent/component/otelcol" | ||
"github.com/grafana/river" | ||
"github.com/grafana/river/rivertypes" | ||
) | ||
|
||
// Defaults for various arguments. | ||
var ( | ||
DefaultArguments = Arguments{ | ||
Server: DefaultServerArguments, | ||
SourceMaps: DefaultSourceMapsArguments, | ||
} | ||
|
||
DefaultServerArguments = ServerArguments{ | ||
Host: "127.0.0.1", | ||
Port: 12347, | ||
RateLimiting: DefaultRateLimitingArguments, | ||
MaxAllowedPayloadSize: 5 * units.MiB, | ||
} | ||
|
||
DefaultRateLimitingArguments = RateLimitingArguments{ | ||
Enabled: true, | ||
Rate: 50, | ||
BurstSize: 100, | ||
} | ||
|
||
DefaultSourceMapsArguments = SourceMapsArguments{ | ||
Download: true, | ||
DownloadFromOrigins: []string{"*"}, | ||
DownloadTimeout: time.Second, | ||
} | ||
) | ||
|
||
// Arguments configures the app_agent_receiver component. | ||
type Arguments struct { | ||
LogLabels map[string]string `river:"extra_log_labels,attr,optional"` | ||
|
||
Server ServerArguments `river:"server,block,optional"` | ||
SourceMaps SourceMapsArguments `river:"sourcemaps,block,optional"` | ||
Output OutputArguments `river:"output,block"` | ||
} | ||
|
||
var _ river.Defaulter = (*Arguments)(nil) | ||
|
||
// SetToDefault applies default settings. | ||
func (args *Arguments) SetToDefault() { *args = DefaultArguments } | ||
|
||
// ServerArguments configures the HTTP server where telemetry information will | ||
// be sent from Faro clients. | ||
type ServerArguments struct { | ||
Host string `river:"listen_address,attr,optional"` | ||
Port int `river:"listen_port,attr,optional"` | ||
CORSAllowedOrigins []string `river:"cors_allowed_origins,attr,optional"` | ||
APIKey rivertypes.Secret `river:"api_key,attr,optional"` | ||
MaxAllowedPayloadSize units.Base2Bytes `river:"max_allowed_payload_size,attr,optional"` | ||
|
||
RateLimiting RateLimitingArguments `river:"rate_limiting,block,optional"` | ||
} | ||
|
||
// RateLimitingArguments configures rate limiting for the HTTP server. | ||
type RateLimitingArguments struct { | ||
Enabled bool `river:"enabled,attr,optional"` | ||
Rate float64 `river:"rate,attr,optional"` | ||
BurstSize float64 `river:"burst_size,attr,optional"` | ||
} | ||
|
||
// SourceMapsArguments configures how app_agent_receiver will retrieve source | ||
// maps for transforming stack traces. | ||
type SourceMapsArguments struct { | ||
Download bool `river:"download,attr,optional"` | ||
DownloadFromOrigins []string `river:"download_from_origins,attr,optional"` | ||
DownloadTimeout time.Duration `river:"download_timeout,attr,optional"` | ||
Locations []LocationArguments `river:"location,block,optional"` | ||
} | ||
|
||
// LocationArguments specifies an individual location where source maps will be loaded. | ||
type LocationArguments struct { | ||
Path string `river:"path,attr"` | ||
MinifiedPathPrefix string `river:"minified_path_prefix,attr"` | ||
} | ||
|
||
// OutputArguments configures where to send emitted logs and traces. Metrics | ||
// emitted by app_agent_receiver are exported as targets to be scraped. | ||
type OutputArguments struct { | ||
Logs []loki.LogsReceiver `river:"logs,attr,optional"` | ||
Traces []otelcol.Consumer `river:"traces,attr,optional"` | ||
} |
Oops, something went wrong.