Skip to content

Conversation

@Serendo
Copy link
Contributor

@Serendo Serendo commented Feb 13, 2025

Summary

  1. Add a RetryPartial variant to RetryAction. This variant takes a closure which has the information of the response and will be used to modify the request so only sending the failed part of it.
  2. Implemented the RetryPartialFunction for elasticsearch sink, now that request_retry_partial will only send those previously failed requests. those successful requests will not be sent again.

Change Type

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

Is this a breaking change?

  • Yes. This change will update tower to 0.5 which itself has breaking changes. but it should be transparent to users.
  • No

How did you test this PR?

I wrote a python server mocking the elasticsearch bulk api. which will give a response in which the first 5 documents are 201 created, and others are 429. I can see that one particular document will get only one 201.

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.

Checklist

  • Please read our Vector contributor resources.
    • make check-all is a good command to run locally. This check is
      defined here. Some of these
      checks might not be relevant to your PR. For Rust changes, at the very least you should run:
      • cargo fmt --all
      • cargo clippy --workspace --all-targets -- -D warnings
      • cargo nextest run --workspace (alternatively, you can run cargo test --all)
  • If this PR introduces changes Vector dependencies (modifies Cargo.lock), please
    run dd-rust-license-tool write to regenerate the license inventory and commit the changes (if any). More details here.

References

Closes: #140

#14891

- Adjustments of Buffer type definition in Tower 0.5
- As policy is directly modified in Tower 0.5. Removed the policy part in the RetryPolicyFuture.
- The change args to mutable for the retry function and clone_request function. It's changed in Tower 0.5.
- Changed the RetryPolicyFuture Output to (). This is also changed in Tower 0.5.
- Modified some tests as policy is now modified in advance function;
…ls a RetryPartialFunction trait to modify the old request.

In the elasticsearch sink. When there are errors in the response, the response's status_codes are keeped in a closure which is later used by the modify_request func in RetryPartialFunction trait.
@Serendo Serendo requested a review from a team as a code owner February 13, 2025 09:14
@bits-bot
Copy link

bits-bot commented Feb 13, 2025

CLA assistant check
All committers have signed the CLA.

@github-actions github-actions bot added the domain: sinks Anything related to the Vector's sinks label Feb 13, 2025
@pront pront changed the title Es retry tower0.5 feat(deps): update tower crate to 0.5 and fix partial retry logic Feb 13, 2025
@pront pront changed the title feat(deps): update tower crate to 0.5 and fix partial retry logic feat(deps): update tower crate to v0.5.2 and fix partial retry logic Feb 13, 2025
@pront
Copy link
Member

pront commented Feb 13, 2025

Hi @Serendo, thank you for this PR! I think this is not a breaking change (from the perspective of Vector users). And also we will need a changelog to explain the fix.

@Serendo
Copy link
Contributor Author

Serendo commented Feb 14, 2025

Hi @Serendo, thank you for this PR! I think this is not a breaking change (from the perspective of Vector users). And also we will need a changelog to explain the fix.

I have added a changlog fragment for this.

@tronboto
Copy link

Thank you for this @Serendo - excited to see it land in the next release!

@tronboto
Copy link

Hey @pront . What's still needed here to get this one across the line? Would be great to see it in the next release.

@pront
Copy link
Member

pront commented Mar 11, 2025

Hey @pront . What's still needed here to get this one across the line? Would be great to see it in the next release.

Hi @Serendo and @tronboto, I am taking a look.

@Serendo Serendo requested a review from pront April 5, 2025 03:51
@pront pront added the meta: awaiting author Pull requests that are awaiting their author. label Apr 11, 2025
@adamreeve
Copy link

Hi @Serendo, are you still working on this? I see you asked for a review last week but there are still outstanding review comments to be addressed. It would be great to see this feature land so if you need help getting this PR finished my team could help (I work on OSS @G-Research, @tronboto is a colleague of mine).

@Serendo
Copy link
Contributor Author

Serendo commented Apr 15, 2025

Hi @Serendo, are you still working on this? I see you asked for a review last week but there are still outstanding review comments to be addressed. It would be great to see this feature land so if you need help getting this PR finished my team could help (I work on OSS @G-Research, @tronboto is a colleague of mine).

Hi @adamreeve, I forgot to push the commits and I thought I had pushed them. I'll push them later.

And yes it will be great to get some help from you. Thank you! As you see when modifying the original request, there is a metadata part which is usually generated from the events. But when filtering the requests, I can't use that part of the code as the requests are not in the shape of events now.

@pront pront changed the title feat(deps): update tower crate to v0.5.2 and fix partial retry logic feat(elastic_search sink): fix partial retry logic Jul 29, 2025
Copy link
Member

@pront pront left a comment

Choose a reason for hiding this comment

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

Some more nits

Co-authored-by: Pavlos Rontidis <pavlos.rontidis@gmail.com>
@github-actions github-actions bot removed the meta: awaiting author Pull requests that are awaiting their author. label Jul 30, 2025
@pront
Copy link
Member

pront commented Jul 30, 2025

Please take a look at the merge conflicts. We will take a look after those are fixed.

@pront pront added the meta: awaiting author Pull requests that are awaiting their author. label Jul 30, 2025
@github-actions github-actions bot removed the meta: awaiting author Pull requests that are awaiting their author. label Jul 31, 2025
@Serendo Serendo changed the title feat(elastic_search sink): fix partial retry logic feat(elasticsearch sink): fix partial retry logic Jul 31, 2025
Copy link
Contributor

@thomasqueirozb thomasqueirozb left a comment

Choose a reason for hiding this comment

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

I think these 2 should be switched, not sure

@pront pront added this pull request to the merge queue Aug 7, 2025
Merged via the queue into vectordotdev:master with commit d9bef7e Aug 7, 2025
182 of 210 checks passed
@tronboto
Copy link

tronboto commented Aug 8, 2025

Thanks for all the work on this 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

domain: sinks Anything related to the Vector's sinks

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Elasticsearch partial bulk failures

7 participants