-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
[querier] s3: add getObject retry #4453
Conversation
doing |
@cyriltovena review pr pls |
@@ -115,6 +117,10 @@ func (cfg *S3Config) RegisterFlagsWithPrefix(prefix string, f *flag.FlagSet) { | |||
f.BoolVar(&cfg.HTTPConfig.InsecureSkipVerify, prefix+"s3.http.insecure-skip-verify", false, "Set to true to skip verifying the certificate chain and hostname.") | |||
f.StringVar(&cfg.HTTPConfig.CAFile, prefix+"s3.http.ca-file", "", "Path to the trusted CA file that signed the SSL certificate of the S3 endpoint.") | |||
f.StringVar(&cfg.SignatureVersion, prefix+"s3.signature-version", SignatureVersionV4, fmt.Sprintf("The signature version to use for authenticating against S3. Supported values are: %s.", strings.Join(supportedSignatureVersions, ", "))) | |||
f.DurationVar(&cfg.BackoffConfig.MinBackoff, "s3.min-backoff", 100*time.Millisecond, "Minimum backoff time") | |||
f.DurationVar(&cfg.BackoffConfig.MaxBackoff, "s3.max-backoff", 50*time.Second, "Maximum backoff time") | |||
f.IntVar(&cfg.BackoffConfig.MaxRetries, "s3.max-retries", 20, "Maximum number of times to retry an operation") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
f.IntVar(&cfg.BackoffConfig.MaxRetries, "s3.max-retries", 20, "Maximum number of times to retry an operation") | |
f.IntVar(&cfg.BackoffConfig.MaxRetries, "s3.max-retries", 5, "Maximum number of times to retry an operation") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -115,6 +117,10 @@ func (cfg *S3Config) RegisterFlagsWithPrefix(prefix string, f *flag.FlagSet) { | |||
f.BoolVar(&cfg.HTTPConfig.InsecureSkipVerify, prefix+"s3.http.insecure-skip-verify", false, "Set to true to skip verifying the certificate chain and hostname.") | |||
f.StringVar(&cfg.HTTPConfig.CAFile, prefix+"s3.http.ca-file", "", "Path to the trusted CA file that signed the SSL certificate of the S3 endpoint.") | |||
f.StringVar(&cfg.SignatureVersion, prefix+"s3.signature-version", SignatureVersionV4, fmt.Sprintf("The signature version to use for authenticating against S3. Supported values are: %s.", strings.Join(supportedSignatureVersions, ", "))) | |||
f.DurationVar(&cfg.BackoffConfig.MinBackoff, "s3.min-backoff", 100*time.Millisecond, "Minimum backoff time") | |||
f.DurationVar(&cfg.BackoffConfig.MaxBackoff, "s3.max-backoff", 50*time.Second, "Maximum backoff time") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
f.DurationVar(&cfg.BackoffConfig.MaxBackoff, "s3.max-backoff", 50*time.Second, "Maximum backoff time") | |
f.DurationVar(&cfg.BackoffConfig.MaxBackoff, "s3.max-backoff", 3*time.Second, "Maximum backoff time") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good can you add more meat to the flag documentation, e.g related to s3 get operation.
done |
@cyriltovena review pr pls |
Btw, you forgot to write the changes on the CHANGELOG and to document the new parameters in the docs located at Suggestion:
|
thanks,done |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Docs change to correct spelling.
docs/sources/configuration/_index.md
Outdated
# Configures backoff when s3 get Object. | ||
backoff_config: | ||
# Minimum delay when backing off. | ||
# CLI flag: -s3.backoff-min-period | ||
[min_period: <duration> | default = 100ms] | ||
|
||
# The maximum delay when backing off. | ||
# CLI flag: -s3.backoff-max-period | ||
[max_period: <duration> | default = 3s] | ||
|
||
# Number of times to backoff and retry before failing. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# Configures backoff when s3 get Object. | |
backoff_config: | |
# Minimum delay when backing off. | |
# CLI flag: -s3.backoff-min-period | |
[min_period: <duration> | default = 100ms] | |
# The maximum delay when backing off. | |
# CLI flag: -s3.backoff-max-period | |
[max_period: <duration> | default = 3s] | |
# Number of times to backoff and retry before failing. | |
# Configures back off when s3 get Object. | |
backoff_config: | |
# Minimum duration to back off. | |
# CLI flag: -s3.backoff-min-period | |
[min_period: <duration> | default = 100ms] | |
# The maximum duration to back off. | |
# CLI flag: -s3.backoff-max-period | |
[max_period: <duration> | default = 3s] | |
# Number of times to back off and retry before failing. |
done ,thanks |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Docs portion of this PR looks good to me now. Next time @liguozhong , you can just hit the 'commit suggestion' box to accept suggested changes. That would make it trivial for me to re-review.
👍 thanks |
@DylanGuedes review pr pls |
Do you mind having a look at this suggestion? I think that the check starting at line 344 is unnecessary after the latest changes. Besides that, this looks solid, good job. Not sure if the maintainers would like to see some tests (although I checked the test files and looks like that function wasn't being tested so maybe they won't block you for that). |
I'm not familiar with the'commit suggestion' box。 |
err := ctx.Err() | ||
for retries.Ongoing() { | ||
if ctx.Err() != nil { | ||
return nil, errors.Wrap(ctx.Err(), "ctx related error during s3 getObject") | ||
} | ||
err = instrument.CollectedRequest(ctx, "S3.GetObject", s3RequestDuration, instrument.ErrorCode, func(ctx context.Context) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
err := ctx.Err() | |
for retries.Ongoing() { | |
if ctx.Err() != nil { | |
return nil, errors.Wrap(ctx.Err(), "ctx related error during s3 getObject") | |
} | |
err = instrument.CollectedRequest(ctx, "S3.GetObject", s3RequestDuration, instrument.ErrorCode, func(ctx context.Context) error { | |
for retries.Ongoing() { | |
if err := ctx.Err(); err != nil { | |
return nil, errors.Wrap(err, "ctx related error during s3 getObject") | |
} | |
err := instrument.CollectedRequest(ctx, "S3.GetObject", s3RequestDuration, instrument.ErrorCode, func(ctx context.Context) error { |
My bad, I didn't notice the change. I added a final one where I suggest moving the Anyway, LGTM! |
sorry, I'm not familiar with the'commit suggestion' box。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks for your patience.
thanks |
fix #4452
this pr fix issues/4452