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

fix: getting headers for OnLog #770

Merged
merged 4 commits into from
Oct 20, 2024
Merged

Conversation

WeixinX
Copy link
Contributor

@WeixinX WeixinX commented Oct 16, 2024

Related to #740

The sentinel plugin needs to get the response headers in the OnLog

@github-actions github-actions bot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Oct 16, 2024
Copy link

codecov bot commented Oct 16, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 87.89%. Comparing base (ec9ff43) to head (1600747).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #770      +/-   ##
==========================================
+ Coverage   87.70%   87.89%   +0.19%     
==========================================
  Files         136      136              
  Lines        8163     8163              
==========================================
+ Hits         7159     7175      +16     
+ Misses        783      766      -17     
- Partials      221      222       +1     

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

@github-actions github-actions bot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Oct 16, 2024
@@ -334,7 +334,7 @@ func (m *filterManager) localReply(v *api.LocalResponse, decoding bool) {
}

func (m *filterManager) DecodeHeaders(headers capi.RequestHeaderMap, endStream bool) capi.StatusType {
if !supportGettingHeadersOnLog && m.DebugModeEnabled() {
if supportGettingHeadersOnLog && m.DebugModeEnabled() {
Copy link
Member

Choose a reason for hiding this comment

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

Should be

Suggested change
if supportGettingHeadersOnLog && m.DebugModeEnabled() {
if !supportGettingHeadersOnLog {

@@ -696,7 +696,7 @@ func (m *filterManager) DecodeTrailers(trailers capi.RequestTrailerMap) capi.Sta
}

func (m *filterManager) EncodeHeaders(headers capi.ResponseHeaderMap, endStream bool) capi.StatusType {
if !supportGettingHeadersOnLog && m.DebugModeEnabled() {
if supportGettingHeadersOnLog {
Copy link
Member

Choose a reason for hiding this comment

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

Ditto

@@ -23,7 +23,7 @@ import (
)

const (
supportGettingHeadersOnLog = false
supportGettingHeadersOnLog = true
Copy link
Member

Choose a reason for hiding this comment

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

Only the unreleased Envoy version supports getting headers OnLog:

supportGettingHeadersOnLog = true

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I would like to ask why supportGettingHeadersOnLog = true in envoydev and false in !envoydev, do I need to leave it as is?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Well I guess I should have known, since !envoydev itself provides the ability to cache the headers on the go side without us needing to judge it by !supportGettingHeadersOnLog, I'll leave them as they are and just remove the && m.DebugModeEnabled().

Copy link
Member

Choose a reason for hiding this comment

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

envoydev => unreleased Envoy version, support getting headers in OnLog phase.

@github-actions github-actions bot added size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Oct 19, 2024
@WeixinX WeixinX requested a review from spacewander October 19, 2024 08:24
@spacewander spacewander merged commit 23ad00d into mosn:main Oct 20, 2024
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants