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

[filebeat][gcs] - Added support for retry config #41862

Merged
merged 12 commits into from
Dec 4, 2024

Conversation

ShourieG
Copy link
Contributor

@ShourieG ShourieG commented Dec 3, 2024

Type of change

  • Enhancement

Proposed commit message

  • Added support for retry config

NOTE

Ignore the commit history as this resulted separating this PR from an earlier PR and the subsequent merges that occurred to keep the changes consistent across.

Checklist

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
    - [ ] I have made corresponding change to the default configuration files
  • I have added tests that prove my fix is effective or that my feature works
  • I have added an entry in CHANGELOG.next.asciidoc or CHANGELOG-developer.next.asciidoc.

Disruptive User Impact

Author's Checklist

  • [ ]

How to test this PR locally

Related issues

Use cases

Screenshots

Logs

@ShourieG ShourieG requested a review from a team as a code owner December 3, 2024 10:14
@botelastic botelastic bot added the needs_team Indicates that the issue/PR needs a Team:* label label Dec 3, 2024
Copy link
Contributor

mergify bot commented Dec 3, 2024

This pull request does not have a backport label.
If this is a bug or security fix, could you label this PR @ShourieG? 🙏.
For such, you'll need to label your PR with:

  • The upcoming major version of the Elastic Stack
  • The upcoming minor version of the Elastic Stack (if you're not pushing a breaking change)

To fixup this pull request, you need to add the backport labels for the needed
branches, such as:

  • backport-8./d is the label to automatically backport to the 8./d branch. /d is the digit

Copy link
Contributor

mergify bot commented Dec 3, 2024

backport-8.x has been added to help with the transition to the new branch 8.x.
If you don't need it please use backport-skip label and remove the backport-8.x label.

@mergify mergify bot added the backport-8.x Automated backport to the 8.x branch with mergify label Dec 3, 2024
@ShourieG ShourieG added the Team:Security-Service Integrations Security Service Integrations Team label Dec 3, 2024
@elasticmachine
Copy link
Collaborator

Pinging @elastic/security-service-integrations (Team:Security-Service Integrations)

@botelastic botelastic bot removed the needs_team Indicates that the issue/PR needs a Team:* label label Dec 3, 2024
@ShourieG ShourieG added Filebeat Filebeat needs_team Indicates that the issue/PR needs a Team:* label labels Dec 3, 2024
@botelastic botelastic bot removed the needs_team Indicates that the issue/PR needs a Team:* label label Dec 3, 2024
@ShourieG ShourieG added enhancement needs_team Indicates that the issue/PR needs a Team:* label labels Dec 3, 2024
@botelastic botelastic bot removed the needs_team Indicates that the issue/PR needs a Team:* label label Dec 3, 2024
@ShourieG ShourieG added needs_team Indicates that the issue/PR needs a Team:* label input:GCS labels Dec 3, 2024
@botelastic botelastic bot removed the needs_team Indicates that the issue/PR needs a Team:* label label Dec 3, 2024
@botelastic
Copy link

botelastic bot commented Dec 3, 2024

This pull request doesn't have a Team:<team> label.

@ShourieG ShourieG assigned ShourieG and unassigned ShourieG Dec 3, 2024
@ShourieG ShourieG requested a review from efd6 December 3, 2024 10:19
@ShourieG
Copy link
Contributor Author

ShourieG commented Dec 3, 2024

/test

Comment on lines 352 to 353
- Added support for retry config in GCS input. {issue}11580[11580] {pull}41862[41862]

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
- Added support for retry config in GCS input. {issue}11580[11580] {pull}41862[41862]
- Added support for retry configuration in GCS input. {issue}11580[11580] {pull}41862[41862]

[float]
==== `retry`

This attribute can be used to configure a list of sub attributes that directly control how the input should behave when a download for a file/object fails or gets interrupted. The list of sub attributes are as follows :-
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
This attribute can be used to configure a list of sub attributes that directly control how the input should behave when a download for a file/object fails or gets interrupted. The list of sub attributes are as follows :-
This attribute can be used to configure a list of sub attributes that directly control how the input should behave when a download for a file/object fails or gets interrupted.

Also suggest a <ul> rather than an <ol> since the ordering of the properties does not matter.

This attribute can be used to configure a list of sub attributes that directly control how the input should behave when a download for a file/object fails or gets interrupted. The list of sub attributes are as follows :-

1. `max_attempts`: This attribute defines the maximum number of retry attempts(including the initial api call) that should be attempted for a retryable error. The default value for this is `3`.
2. `initial_backoff_duration`: This attribute defines the initial backoff time in seconds. The default value for this is `1s`.
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
2. `initial_backoff_duration`: This attribute defines the initial backoff time in seconds. The default value for this is `1s`.
2. `initial_backoff_duration`: This attribute defines the initial backoff time. The default value for this is `1s`.

This is a time.Duration and has a unit awareness. Perhaps note this rather than saying that it's in seconds. Also below.

bucket_timeout: 10m
----

While configuring the `retry` attribute, the user should take into consideration the `bucket_timeout` value. The `retry` attribute should be configured in such a way that the retries are completed within the `bucket_timeout` window. If the `retry` attribute is configured in such a way that the retries are not completed successfully within the `bucket_timeout` window, then the input will suffer a `context timeout` for that specific object/file which it was retrying. This can cause gaps in ingested data to pile up over time.
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
While configuring the `retry` attribute, the user should take into consideration the `bucket_timeout` value. The `retry` attribute should be configured in such a way that the retries are completed within the `bucket_timeout` window. If the `retry` attribute is configured in such a way that the retries are not completed successfully within the `bucket_timeout` window, then the input will suffer a `context timeout` for that specific object/file which it was retrying. This can cause gaps in ingested data to pile up over time.
When configuring the `retry` attribute, the user should consider the `bucket_timeout` value. The `retry` attribute should be configured in such a way that the retries are completed within the `bucket_timeout` window. If the `retry` attribute is configured in such a way that the retries are not completed successfully within the `bucket_timeout` window, the input will suffer a `context timeout` for that specific object/file which it was retrying. This can cause gaps in ingested data to pile up over time.

@@ -126,5 +141,11 @@ func defaultConfig() config {
PollInterval: 5 * time.Minute,
BucketTimeOut: 120 * time.Second,
ParseJSON: false,
Retry: retryConfig{
MaxAttempts: 3,
InitialBackOffDuration: 1 * time.Second,
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
InitialBackOffDuration: 1 * time.Second,
InitialBackOffDuration: time.Second,

Copy link
Contributor

mergify bot commented Dec 3, 2024

This pull request is now in conflicts. Could you fix it? 🙏
To fixup this pull request, you can check out it locally. See documentation: https://help.github.com/articles/checking-out-pull-requests-locally/

git fetch upstream
git checkout -b gcs/add_retry_config upstream/gcs/add_retry_config
git merge upstream/main
git push upstream gcs/add_retry_config

@ShourieG
Copy link
Contributor Author

ShourieG commented Dec 4, 2024

@efd6, I've addressed the PR suggestions.

- `max_backoff_duration`: This attribute defines the maximum backoff time. The default value for this is `30s`.
- `backoff_multiplier`: This attribute defines the backoff multiplication factor. The default value for this is `2`.

NOTE: Attributes such as `initial_backoff_duration` and `max_backoff_duration` can be defined in the following formats: `{{x}}s`, `{{x}}m`, `{{x}}h`, here `s = seconds`, `m = minutes` and `h = hours`. The value `{{x}}` can be anything we wish.
Copy link
Contributor

Choose a reason for hiding this comment

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

I think something simpler like "NOTE: The initial_backoff_duration and max_backoff_duration attributes must have time units. Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h".

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated

- `max_backoff_duration`: This attribute defines the maximum backoff time. The default value for this is `30s`.
- `backoff_multiplier`: This attribute defines the backoff multiplication factor. The default value for this is `2`.

NOTE: The `initial_backoff_duration` and `max_backoff_duration` attributes must have time units. Valid time units are `ns`, `us (or µs)`, `ms`, `s`, `m`, `h`
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
NOTE: The `initial_backoff_duration` and `max_backoff_duration` attributes must have time units. Valid time units are `ns`, `us (or µs)`, `ms`, `s`, `m`, `h`
NOTE: The `initial_backoff_duration` and `max_backoff_duration` attributes must have time units. Valid time units are `ns`, `us` (or `µs`), `ms`, `s`, `m`, `h`.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Committed this

Co-authored-by: Dan Kortschak <[email protected]>
@ShourieG ShourieG merged commit 3f51793 into elastic:main Dec 4, 2024
20 of 22 checks passed
mergify bot pushed a commit that referenced this pull request Dec 4, 2024
* Added support for retry config along with necessary documentation and tests

(cherry picked from commit 3f51793)
@ShourieG ShourieG deleted the gcs/add_retry_config branch December 4, 2024 07:33
ShourieG added a commit that referenced this pull request Dec 4, 2024
* Added support for retry config along with necessary documentation and tests

(cherry picked from commit 3f51793)

Co-authored-by: ShourieG <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-8.x Automated backport to the 8.x branch with mergify enhancement Filebeat Filebeat input:GCS Team:Security-Service Integrations Security Service Integrations Team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add configurable retry policy for GCS integration connection failures
3 participants