8000 enhancement(aws_s3 sink): Add ability to configure request errors to retry by jchap-pnnl · Pull Request #23206 · vectordotdev/vector · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

enhancement(aws_s3 sink): Add ability to configure request errors to retry #23206

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

Open
wants to merge 22 commits into
base: master
Choose a base branch
from

Conversation

jchap-pnnl
Copy link
@jchap-pnnl jchap-pnnl commented Jun 13, 2025

Summary

Adds a new field, a retry_logic struct, to S3SinkConfig that allows user to specify types of response errors to retry. Users can specify specific status codes of error responses of failed requests they want to be automatically retried, or they can specify all failed requests to be automatically retried.

Change Type

  • Bug fix
  • New feature
  • Non-functional (chore, refactoring, docs)
  • Performance

Is this a breaking change?

  • Yes
  • No

How did you test this PR?

  1. Ran existing integration tests and verified they passed.
  2. Manually tested to verify the new functionality. Generated 403 errors by changing the access_key_id to an invalid one. Verified the failed authentication service was retried when the configuration required it to and didn't when the configuration didn't require it to. Ran tests with different values for retry_logic, retry_all_errors, and errors_to_retry:
    • retry_logic: omitted |
      • retry_all_errors: true | false | omitted
      • errors_to_retry: [] | [403] | omitted

Used this configuration:

# vector.yaml
sources:
  generate_syslog:
    type: "demo_logs"
    format: "syslog"
    count: 10

transforms:
  remap_syslog:
    inputs:
      - "generate_syslog"
    type: "remap"
    source: |
      structured = parse_syslog!(.message)
      . = merge(., structured)

sinks:
  s3:
    type: aws_s3
    encoding:
      codec: "json"
    region: <actual region>
    inputs:
      - remap_syslog
    bucket: <bucket name>
    auth:
      access_key_id: <key id value>
      secret_access_key: <key value>

    retry_logic:
      retry_all_errors: true
      errors_to_retry: [403]
  1. Considered adding a new test to src/sinks/aws_s3/integration_tests.rs, but didn't see a good option for detecting service retries. Considered a test using a timer that could measure how long a successful request takes and determine if retries are happening if the failed request takes longer. We rejected this option because the results could vary depending on the load of system resources or other factors. But please let us know if you recommend a testing approach that would work.

Does this PR include user facing changes?

  • Yes. Please add a changelog fragment based on our guidelines.
  • No. A maintainer will apply the "no-changelog" label to this PR.

Notes

  • Please read our Vector contributor resources.
  • Do not hesitate to use @vectordotdev/vector to reach out to us regarding this PR.
  • The CI checks run only after we manually approve them.
    • We recommend adding a pre-push hook, please see this template.
    • Alternatively, we recommend running the following locally before pushing to the remote branch:
      • cargo fmt --all
      • cargo clippy --workspace --all-targets -- -D warnings
      • cargo nextest run --workspace (alternatively, you can run cargo test --all)
      • ./scripts/check_changelog_fragments.sh
  • After a review is requested, please avoid force pushes to help us review incrementally.
    • Feel free to push as many commits as you want. They will be squashed into one before merging.
    • For example, you can run git merge origin master and git push.
  • If this PR introduces changes Vector dependencies (modifies Cargo.lock), please
    run cargo vdev build licenses to regenerate the license inventory and commit the changes (if any). More details here.

Chapman, Joe B added 18 commits May 15, 2025 15:13
…l errors. Added retry_all_errors to S3SinkConfig and S3RetryLogic structs. Setting retry_all_errors to the default value in the generate_config function. Added self.retry_all_errors to the condition in the is_retriable_error function. (vectordotdev#10870)
…. Changed retry_all_errors to Option<bool>.
… Added configured_to_retry and check_response functions to s3_common/config.rs. Added configured_to_retry call to is_retriable_error result in RetryLogic. (vectordotdev#10870)
@jchap-pnnl jchap-pnnl requested review from a team as code owners June 13, 2025 22:07
@bits-bot
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


Chapman, Joe B seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

@github-actions github-actions bot added domain: sinks Anything related to the Vector's sinks domain: external docs Anything related to Vector's external, public documentation labels Jun 13, 2025
Cargo.toml Outdated
@@ -1,6 +1,6 @@
[package]
name = "vector"
version = "0.48.0"
Copy link
Contributor

Choose a reason for hiding this comment

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

Please don't bump the vector version, we have our own release process

Copy link
Author

Choose a reason for hiding this comment

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

Hmm, I'm not sure what to do about this. I bumped up the version because without it, running cargo vdev check version gives me this error:
image
Is there another way to resolve that error without changing the vector version locally?

Copy link
Contributor

Choose a reason for hiding this comment

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

cargo vdev check version is not a required CI check AFAIK, you can ignore this and revert the changes to Cargo.* files

Copy link
Author

Choose a reason for hiding this comment

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

make check-version is recommended to be included in the pre-push hooks. I can skip that check if that's the best way to avoid the version requirement error.

Copy link
Author

Choose a reason for hiding this comment

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

I've reverted the change.

Comment on lines 352 to 353
/// A vector list of status codes matching specific error types that trigger failed
/// service retry attempts. The list is ignored if `retry_all_errors` is true.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
/// A vector list of status codes matching specific error types that trigger failed
/// service retry attempts. The list is ignored if `retry_all_errors` is true.
/// A list of HTTP status codes matching specific error types that trigger failed
/// service retry attempts. This list is ignored if `retry_all_errors` is true.

@thomasqueirozb thomasqueirozb added the meta: awaiting author Pull requests that are awaiting their author. label Jun 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
domain: external docs Anything related to Vector's external, public documentation domain: sinks Anything related to the Vector's sinks meta: awaiting author Pull requests that are awaiting their author.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Consider expanding the cases where Vector retries requests
4 participants
0