Skip to content

Comments

Configure range state management based on concurrency#1724

Merged
sky333999 merged 5 commits intomainfrom
max-persist-items
Jun 13, 2025
Merged

Configure range state management based on concurrency#1724
sky333999 merged 5 commits intomainfrom
max-persist-items

Conversation

@jefchien
Copy link
Contributor

@jefchien jefchien commented Jun 12, 2025

Description of the issue

In the previous PR (#1718), the capacity was hardcoded to 1 by default to maintain existing behavior.

Description of changes

Updates translator to set the max_persist_state on the plugins to be 2x the concurrency field. This gives enough head room for cases where the pushers are all sending chunks of the file that are all non-continuous. This should never happen, but the max_persist_state is an upper limit and not an allocation. The merging logic should make it so that they are within the limit of the number of pushers and in most cases, all of the pushers won't be sending for the same file (if configured to tail multiple files)

Tangential changes

  • Changed cloudwatchlogs output plugin to only enable multi-threading if concurrency field is > 1. Setting concurrency to 1 should not result in a shared publisher pool of 1.

License

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Tests

Added unit tests. Ran manually with concurrency configured prior to the changes in #1723 to reduce the number of ranges being sent and saw the tracker collapsing ranges which showed the capacity was being enforced.

2025-06-10T23:39:53Z D! Tracked ranges for /opt/aws/amazon-cloudwatch-agent/logs/amazon-cloudwatch-agent.log exceeds max. Collapsing 0-19105548 and 19105606-19110633
2025-06-10T23:39:53Z D! Tracked ranges for /opt/aws/amazon-cloudwatch-agent/logs/amazon-cloudwatch-agent.log exceeds max. Collapsing 0-19110633 and 19110658-19110950
2025-06-10T23:39:53Z D! Tracked ranges for /opt/aws/amazon-cloudwatch-agent/logs/amazon-cloudwatch-agent.log exceeds max. Collapsing 0-19110950 and 19111008-19112510
2025-06-10T23:40:08Z D! Tracked ranges for /opt/aws/amazon-cloudwatch-agent/logs/amazon-cloudwatch-agent.log exceeds max. Collapsing 0-19114914 and 19114939-19115231
2025-06-10T23:40:08Z D! Tracked ranges for /opt/aws/amazon-cloudwatch-agent/logs/amazon-cloudwatch-agent.log exceeds max. Collapsing 0-19115231 and 19115289-19117889
2025-06-10T23:40:23Z D! Tracked ranges for /opt/aws/amazon-cloudwatch-agent/logs/amazon-cloudwatch-agent.log exceeds max. Collapsing 0-19117889 and 19117914-19118237
2025-06-10T23:40:23Z D! Tracked ranges for /opt/aws/amazon-cloudwatch-agent/logs/amazon-cloudwatch-agent.log exceeds max. Collapsing 0-19118237 and 19118284-19118674

Requirements

Before commiting your code, please do the following steps.

  1. Run make fmt and make fmt-sh
  2. Run make lint

Integration Tests

To run integration tests against this PR, add the ready for testing label.

@jefchien jefchien requested a review from a team as a code owner June 12, 2025 16:24
@jefchien jefchien added the ready for testing Indicates this PR is ready for integration tests to run label Jun 12, 2025
}
c.once.Do(func() {
if c.Concurrency > 0 {
if c.Concurrency > 1 {
Copy link
Contributor

Choose a reason for hiding this comment

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

This makes sense to me, but looks unrelated to the PR description (?) Can you provide some rational in the description in case someone comes across this again?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep. Updated the description. I'm fine with removing it from this PR as well.

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 it's fine to have now that you added it to the description 👍

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 it's ok. It's such a small change for a PR

the-mann
the-mann previously approved these changes Jun 13, 2025
[outputs]

[[outputs.cloudwatchlogs]]
concurrency = 10
Copy link
Contributor

Choose a reason for hiding this comment

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

why are we removing this?

Copy link
Contributor Author

@jefchien jefchien Jun 13, 2025

Choose a reason for hiding this comment

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

Removed it during testing and forgot to put it back. Added it back.

]
}
},
"concurrency": 10,
Copy link
Contributor

Choose a reason for hiding this comment

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

same as above

Paramadon
Paramadon previously approved these changes Jun 13, 2025
Copy link
Contributor

@Paramadon Paramadon left a comment

Choose a reason for hiding this comment

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

LGTM!

@jefchien jefchien dismissed stale reviews from Paramadon and the-mann via 6c744df June 13, 2025 20:46
@jefchien jefchien mentioned this pull request Jun 13, 2025
@sky333999 sky333999 merged commit 28285f7 into main Jun 13, 2025
179 of 181 checks passed
@sky333999 sky333999 deleted the max-persist-items branch June 13, 2025 21:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready for testing Indicates this PR is ready for integration tests to run

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants