-
Notifications
You must be signed in to change notification settings - Fork 360
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: PreserveExternalRequestID on ClientTrafficPolicy #3225
feat: PreserveExternalRequestID on ClientTrafficPolicy #3225
Conversation
5506342
to
20dbafd
Compare
what will happen it will enable this by default? |
@zirain Reference from Envoy, envoyproxy/envoy#7140. |
so in what user case, we should set it to |
@zirain when users intend to manage their own Please also check similar intentions on Istio, about preserving external request id on the Istio gateway, issue istio/istio#10875. |
I assume current behavior worked as excepted? What I missed? curl -v 172.18.255.201 -H "x-request-id: 7fb3693f-4061-4070-95d4-3889aa8a22a5"
* Trying 172.18.255.201:80...
* Connected to 172.18.255.201 (172.18.255.201) port 80
> GET / HTTP/1.1
> Host: 172.18.255.201
> User-Agent: curl/8.4.0
> Accept: */*
> x-request-id: 7fb3693f-4061-4070-95d4-3889aa8a22a5
>
< HTTP/1.1 200 OK
< content-type: application/json
< x-content-type-options: nosniff
< date: Sun, 21 Apr 2024 03:15:37 GMT
< content-length: 448
<
{
"path": "/",
"host": "172.18.255.201",
"method": "GET",
"proto": "HTTP/1.1",
"headers": {
"Accept": [
"*/*"
],
"User-Agent": [
"curl/8.4.0"
],
"X-Envoy-Internal": [
"true"
],
"X-Forwarded-For": [
"172.18.0.1"
],
"X-Forwarded-Proto": [
"http"
],
"X-Request-Id": [
"7fb3693f-4061-4070-95d4-3889aa8a22a5"
]
},
"namespace": "default",
"ingress": "",
"service": "",
"pod": "backend-96f75bbf-rzb79"
* Connection #0 to host 172.18.255.201 left intact
} |
@zirain i assume you were accessing directly to the envoy proxy, but that's not exactly how it looks, suppose you add an edge LB and then an arbitrary number of proxies in front of your envoy proxy, it might look like the diagram below:
Envoy proxy will overwrite x-request-id if any, check this also envoyproxy/envoy#6050. |
Oh, I got your point.
Oh, I got your point, seems |
I'm thinking about should EG make it default |
I voted yes, although I have no idea yet about the implication if it is enabled by default. |
cc @envoyproxy/gateway-maintainers PTAL |
6e5976b
to
0279811
Compare
I'm not familiar with an accepted standard for this header. However, some projects make the following distinctions:
Currently, X-Request-Id can always be used for correlating envoy and backend logs for a specific request/response sequence. If this header is preserved by default and clients generate bad x-request-id (e.g., always have the same value for all requests), this header will not be as useful for troubleshooting envoy <> backend issues. So, I think that preservation should be an opt-in option for applications that trust their clients to generate meaningful and well-formed x-request-id values that are reliable for troubleshooting issues that occur on envoy <> backend side of things. |
b83313b
to
e708e9d
Compare
/retest |
// It defaults to false. | ||
// | ||
// +optional | ||
PreserveExternalRequestID *bool `json:"preserveExternalRequestID,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thoughts on PreserveXRequestID
?
the comments highlight the fact that this is opt in and needed when client is external / envoy is edge
cc @envoyproxy/gateway-maintainers
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actually, my initial plan was to use that naming, but I'm trying to mimic Envoy's naming conventions. i have changed just now to PreserveXRequestID
Signed-off-by: Ardika Bagus <me@ardikabs.com>
Signed-off-by: Ardika Bagus <me@ardikabs.com>
e708e9d
to
984b20e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM thanks !
other reviewers, please weigh in on |
Prefer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM thanks!
+1 on |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
What type of PR is this?
Adds configuration to
ClientTrafficPolicy
forHeaders
to support preserving External Request ID (x-request-id
).What this PR does / why we need it:
When it is enabled on Envoy, it will improve the observability experience. This allows users to set their request ID from front-facing applications without being overwritten by Envoy, which is the default behavior.
More reference about the field and its behavior: https://www.envoyproxy.io/docs/envoy/latest/api-v3/extensions/filters/network/http_connection_manager/v3/http_connection_manager.proto, keyword
preserve_external_request_id
.