-
Notifications
You must be signed in to change notification settings - Fork 2.1k
fix(server): Add read and write timeouts #2412
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
Changes from 2 commits
e97933b
b4f032e
28dbd26
ee39139
cd460fe
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,6 +21,7 @@ import ( | |
| "fmt" | ||
| "os" | ||
| "strings" | ||
| "time" | ||
|
|
||
| "github.com/prometheus/common/version" | ||
| "github.com/spf13/cobra" | ||
|
|
@@ -55,6 +56,10 @@ type Options struct { | |
| TelemetryPort int `yaml:"telemetry_port"` | ||
| TotalShards int `yaml:"total_shards"` | ||
| UseAPIServerCache bool `yaml:"use_api_server_cache"` | ||
| ServerReadTimeout time.Duration `yaml:"server_read_timeout"` | ||
| ServerWriteTimeout time.Duration `yaml:"server_write_timeout"` | ||
| ServerIdleTimeout time.Duration `yaml:"server_idle_timeout"` | ||
| ServerReadHeaderTimeout time.Duration `yaml:"server_read_header_timeout"` | ||
|
|
||
| Config string | ||
|
|
||
|
|
@@ -146,6 +151,11 @@ func (o *Options) AddFlags(cmd *cobra.Command) { | |
| o.cmd.Flags().Var(&o.Namespaces, "namespaces", fmt.Sprintf("Comma-separated list of namespaces to be enabled. Defaults to %q", &DefaultNamespaces)) | ||
| o.cmd.Flags().Var(&o.NamespacesDenylist, "namespaces-denylist", "Comma-separated list of namespaces not to be enabled. If namespaces and namespaces-denylist are both set, only namespaces that are excluded in namespaces-denylist will be used.") | ||
| o.cmd.Flags().Var(&o.Resources, "resources", fmt.Sprintf("Comma-separated list of Resources to be enabled. Defaults to %q", &DefaultResources)) | ||
|
|
||
| o.cmd.Flags().DurationVar(&o.ServerReadTimeout, "server-read-timeout", 30*time.Second, "The maximum duration for reading the entire request, including the body.") | ||
|
||
| o.cmd.Flags().DurationVar(&o.ServerWriteTimeout, "server-write-timeout", 60*time.Second, "The maximum duration before timing out writes of the response.") | ||
| o.cmd.Flags().DurationVar(&o.ServerIdleTimeout, "server-idle-timeout", 5*time.Minute, "The maximum amount of time to wait for the next request when keep-alives are enabled.") | ||
| o.cmd.Flags().DurationVar(&o.ServerReadHeaderTimeout, "server-read-header-timeout", 5*time.Second, "The maximum duration for reading the header of requests.") | ||
| } | ||
|
|
||
| // Parse parses the flag definitions from the argument list. | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.