Skip to content
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

Add flag to configure API & dashboard's write timeouts #4474

Merged
merged 7 commits into from
Nov 10, 2021

Conversation

jamesdphillips
Copy link
Contributor

Adds api-write-timeout & dashboard-write-timeout flags to allow users to configure the respective HTTP server's write timeout. Useful when some requests might reasonably take more than a few seconds to complete.


Signed-off-by: James Phillips jamesdphillips@gmail.com

Signed-off-by: James Phillips <jamesdphillips@gmail.com>
Signed-off-by: James Phillips <jamesdphillips@gmail.com>
Signed-off-by: James Phillips <jamesdphillips@gmail.com>
Signed-off-by: James Phillips <jamesdphillips@gmail.com>
@jamesdphillips jamesdphillips added the component:api Sensu API improvements label Nov 1, 2021
Signed-off-by: James Phillips <jamesdphillips@gmail.com>
Signed-off-by: James Phillips <jamesdphillips@gmail.com>
Copy link
Contributor

@ccressent ccressent left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought we were sort of standardizing on using time.Duration for these types of flags going forward? Then the flag can take values like 5ms, 15s, ...

@echlebek
Copy link
Contributor

echlebek commented Nov 2, 2021

Yes please @ccressent! I think using the string representation of time.Duration should be our standard, considering it has first class support in our argument parser.

@@ -512,12 +518,14 @@ func flagSet(server bool) *pflag.FlagSet {
flagSet.String(flagAPIListenAddress, viper.GetString(flagAPIListenAddress), "address to listen on for api traffic")
flagSet.Int64(flagAPIRequestLimit, viper.GetInt64(flagAPIRequestLimit), "maximum API request body size, in bytes")
flagSet.String(flagAPIURL, viper.GetString(flagAPIURL), "url of the api to connect to")
flagSet.Int64(flagAPIWriteTimeout, viper.GetInt64(flagAPIWriteTimeout), "maximum duration before timing out writes of responses")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As the others have mentioned, let's use viper.GetDuration() here instead and update the types surrounding this flag to time.Duration.

Signed-off-by: James Phillips <jamesdphillips@gmail.com>
@jamesdphillips
Copy link
Contributor Author

@ccressent good call! updated to use GetDuration.

@jamesdphillips
Copy link
Contributor Author

Bit of a bummer but I can't think of an easy way to migrate --agent-write-timeout to use a duration. If we care about compatibility of backend.Config that is.

@echlebek
Copy link
Contributor

echlebek commented Nov 2, 2021

@jamesdphillips yeah it's fine to leave it as is. We can add it to the list of things we want to break with 7.x...

@amdprophet amdprophet added this to the 6.5.5 milestone Nov 4, 2021
@jamesdphillips jamesdphillips merged commit f771c99 into release/6.5 Nov 10, 2021
@jamesdphillips jamesdphillips deleted the jdp/configurable-write-timeout branch November 10, 2021 20:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component:api Sensu API improvements
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants