Skip to content

feat(grpc connection management): add jitter controls to grpc max age#25924

Open
hiporox wants to merge 3 commits into
vectordotdev:masterfrom
chalk-ai:je/grpc-connection-age-jitter
Open

feat(grpc connection management): add jitter controls to grpc max age#25924
hiporox wants to merge 3 commits into
vectordotdev:masterfrom
chalk-ai:je/grpc-connection-age-jitter

Conversation

@hiporox

@hiporox hiporox commented Jul 22, 2026

Copy link
Copy Markdown

Summary

PR #19457 added max connection age. This adds the ability to add jitter to those connections to stagger the connection resets better. Jitter is provided as a percentage, modifying the max connection age +/- that percentage.

How did you test this PR?

Added tests to the parser and to make sure we process the bounds correctly. We also can see that existing max connection age tests still pass

Change Type

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

Is this a breaking change?

  • Yes
  • No

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.

References

#19457

Notes

  • Please read our Vector contributor resources.
  • Do not hesitate to use @vectordotdev/vector to reach out to us regarding this PR.
  • Some 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:
      • make fmt
      • make check-clippy (if there are failures it's possible some of them can be fixed with make clippy-fix)
      • make test
  • 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 make build-licenses to regenerate the license inventory and commit the changes (if any). More details on the dd-rust-license-tool.

@hiporox
hiporox requested a review from a team as a code owner July 22, 2026 17:40
@github-actions github-actions Bot added the domain: sources Anything related to the Vector's sources label Jul 22, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thank you for your contribution! Before we can merge this PR, please sign our Contributor License Agreement.

To sign, copy and post the phrase below as a new comment on this PR.

Note: If the bot says your username was not found, the email used in your git commit may not be linked to your GitHub account. Fix this at github.com/settings/emails, then comment recheck to retry.


I have read the CLA Document and I hereby sign the CLA


You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot.

@datadog-vectordotdev

datadog-vectordotdev Bot commented Jul 22, 2026

Copy link
Copy Markdown

Pipelines

⚠️ Warnings

🚦 1 Pipeline job failed

CLA Assistant | CLAAssistant   View in Datadog   GitHub Actions

Useful? React with 👍 / 👎

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 0dc8284 | Docs | Give us feedback!

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8444db8552

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

/// maximum. The default of zero preserves the configured age exactly.
#[serde(default)]
#[configurable(validation(range(min = 0.0, max = 1.0)))]
pub max_connection_age_jitter_factor: f64,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Regenerate generated docs for gRPC jitter option

This adds a user-facing #[configurable_component] option, but the generated source reference files were not updated: checked website/cue/reference/components/sources/generated/vector.cue and website/cue/reference/components/sources/generated/opentelemetry.cue, and both gRPC keepalive option maps still list only max_connection_age_secs and max_connection_age_grace_secs. As a result, the website/schema-based docs will omit max_connection_age_jitter_factor until the generated docs are committed.

AGENTS.md reference: AGENTS.md:L212-L212

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Resolved with added cue files

@hiporox
hiporox requested a review from a team as a code owner July 22, 2026 18:17
@github-actions github-actions Bot added docs review on hold The documentation team reviews PRs only after a PR is approved by the COSE team. domain: external docs Anything related to Vector's external, public documentation labels Jul 22, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 55a405a8c8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/sources/util/grpc/mod.rs Outdated
}

fn jittered_duration(duration: Duration, jitter_factor: f64, jitter: f64) -> Duration {
duration.mul_f64(1.0 + jitter_factor.clamp(0.0, 1.0) * jitter.clamp(-1.0, 1.0))

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Avoid panicking on oversized jittered max ages

When max_connection_age_secs is configured near u64::MAX and max_connection_age_jitter_factor allows a positive jitter, this multiplication can overflow Duration::mul_f64 and panic while accepting a connection, taking down the gRPC source instead of saturating like the grace addition does just above. Consider capping or using checked/saturating arithmetic before applying jitter.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Addressed this edge case and the under flow edge case resulting in a zero duration connection age

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

Labels

docs review on hold The documentation team reviews PRs only after a PR is approved by the COSE team. domain: external docs Anything related to Vector's external, public documentation domain: sources Anything related to the Vector's sources

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant