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

Open
wants to merge 21 commits into
base: main
Choose a base branch
from

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.96%. Comparing base (d1730a8) to head (7ed2e68).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5283      +/-   ##
==========================================
- Coverage   64.97%   64.96%   -0.02%     
==========================================
  Files         214      214              
  Lines       33532    33548      +16     
==========================================
+ Hits        21789    21795       +6     
- Misses      10400    10409       +9     
- Partials     1343     1344       +1     

☔ 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.

internal/ir/xds.go Outdated Show resolved Hide resolved
internal/xds/translator/listener_test.go Outdated Show resolved Hide resolved
internal/ir/xds.go Outdated Show resolved Hide resolved
@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]>
release-notes/current.yaml Outdated Show resolved Hide resolved
@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]>
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

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