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

feat: Add RequestID to ClientTrafficPolicy for controlling X-Request-ID header behavior #5283

Merged
merged 22 commits into from
Feb 22, 2025

Conversation

jukie
Copy link
Contributor

@jukie jukie commented Feb 14, 2025

What type of PR is this?

feat: allow disabling generate_request_id

What this PR does / why we need it:

This allows for disabling Envoy's default behavior of generating an X-request-id header for every request. Generating a random UUID4 is expensive so in high throughput scenarios it's desirable to disable this.

Which issue(s) this PR fixes:

Fixes #5281

Release Notes: Yes

@jukie jukie requested a review from a team as a code owner February 14, 2025 23:31
@jukie jukie marked this pull request as draft February 14, 2025 23:36
@jukie
Copy link
Contributor Author

jukie commented Feb 14, 2025

Need to adjust the true|false logic

Copy link

codecov bot commented Feb 15, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 64.97%. Comparing base (1f9a1bd) to head (ce8a33c).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5283      +/-   ##
==========================================
+ Coverage   64.89%   64.97%   +0.08%     
==========================================
  Files         213      213              
  Lines       33458    33474      +16     
==========================================
+ Hits        21711    21750      +39     
+ Misses      10413    10397      -16     
+ Partials     1334     1327       -7     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jukie jukie marked this pull request as ready for review February 15, 2025 04:03
@jukie
Copy link
Contributor Author

jukie commented Feb 15, 2025

/retest

1 similar comment
@jukie
Copy link
Contributor Author

jukie commented Feb 15, 2025

/retest

Copy link
Contributor

@guydc guydc left a comment

Choose a reason for hiding this comment

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

overall LGTM, not sure if we can improve the naming here.

@jukie jukie requested review from zirain and guydc February 18, 2025 00:33
@jukie
Copy link
Contributor Author

jukie commented Feb 18, 2025

/retest

@jukie jukie force-pushed the api/disable-generate-request-id branch from 141240c to ea676fc Compare February 19, 2025 05:35
Signed-off-by: jukie <[email protected]>
Signed-off-by: jukie <[email protected]>
@jukie jukie requested a review from arkodg February 19, 2025 05:47
Signed-off-by: jukie <[email protected]>
@jukie jukie requested review from guydc and arkodg February 19, 2025 15:12
Signed-off-by: jukie <[email protected]>
@jukie jukie changed the title feat: Allow disabling generate_request_id feat: Add RequestID to ClientTrafficPolicy for controlling X-Request-ID header behavior Feb 19, 2025
Signed-off-by: jukie <[email protected]>
arkodg
arkodg previously approved these changes Feb 19, 2025
Copy link
Contributor

@arkodg arkodg left a comment

Choose a reason for hiding this comment

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

LGTM thanks !

@arkodg arkodg requested review from a team February 19, 2025 15:57
Signed-off-by: jukie <[email protected]>
@arkodg arkodg self-requested a review February 19, 2025 15:59
Signed-off-by: jukie <[email protected]>
Signed-off-by: jukie <[email protected]>
arkodg
arkodg previously approved these changes Feb 19, 2025
Copy link
Contributor

@arkodg arkodg left a comment

Choose a reason for hiding this comment

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

LGTM thanks !

@arkodg arkodg requested review from a team February 19, 2025 20:14
@@ -132,10 +132,18 @@ type HeaderSettings struct {
// PreserveXRequestID configures Envoy to keep the X-Request-ID header if passed for a request that is edge
// (Edge request is the request from external clients to front Envoy) and not reset it, which is the current Envoy behaviour.
// It defaults to false.
// Deprecated: use RequestID instead
Copy link
Collaborator

Choose a reason for hiding this comment

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

need to mention what happens when both are set. Or, we should validate only either of them is set at CEL validation.

Copy link
Collaborator

Choose a reason for hiding this comment

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

also it'd be more user friendly how they can use RequestID to configure the same. (i.e. set Preserve)

@@ -638,8 +647,14 @@ type HeaderSettings struct {
// PreserveXRequestID configures whether Envoy will keep the x-request-id header if passed for a request that is edge
// (Edge request is the request from external clients to front Envoy) and not reset it, which is the current Envoy behaviour.
// It defaults to false.
// Deprecated: use RequestID instead
PreserveXRequestID bool `json:"preserveXRequestID,omitempty" yaml:"preserveXRequestID,omitempty"`
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we just delete this field and use only RequestID internally? Do we usually avoid breaking changes at IR level 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.

Yah +1 to cleaning this up, can also be done in a follow up

zirain
zirain previously approved these changes Feb 22, 2025
Copy link
Member

@zirain zirain left a comment

Choose a reason for hiding this comment

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

LGTM, we can handle the deprecated things seperated.

@arkodg arkodg dismissed stale reviews from zirain and themself via ce8a33c February 22, 2025 04:52
@arkodg arkodg merged commit f8c0b32 into envoyproxy:main Feb 22, 2025
28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow disabling generate_request_id
5 participants