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

Add upstream and downstream info in parent read callbacks in tcp too #9949

Merged
merged 5 commits into from
Feb 14, 2020

Conversation

gargnupur
Copy link
Contributor

Add upstream and downstream info in parent read callbacks in tcp too
Ref: istio/istio#20802
Signed-off-by: gargnupur gargnupur@google.com

For an explanation of how to fill out the fields, please see the relevant section
in PULL_REQUESTS.md

Description:Add upstream and downstream info in parent read callbacks in tcp too
Http is already doing this because of which in decoder and encoder callbacks can get information like upstream host which is not available in TCP
Risk Level: Low
Testing:
Docs Changes:
Release Notes:
[Optional Fixes #Issue]
[Optional Deprecated:]

@mandarjog
Copy link
Contributor

cc @lizan

@gargnupur
Copy link
Contributor Author

@lizan , @asraa, @mattklein123 : Can you please review this PR? This is a blocker for TCP telemetry v2 in Istio...

@gargnupur gargnupur requested a review from lizan February 10, 2020 18:15
kyessenov
kyessenov previously approved these changes Feb 10, 2020
Copy link
Contributor

@kyessenov kyessenov left a comment

Choose a reason for hiding this comment

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

Thanks!

Copy link
Member

@lizan lizan left a comment

Choose a reason for hiding this comment

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

What's the difference with read_callbacks_->connection().streamInfo() and getStreamInfo() (stream_info_)? From a quick glance getStreamInfo() is used for access logging purpose, this seems due to a historical reason: to support TCP access logging before we have StreamInfo in Connection interface. Now it seems we can consolidate them. cc @mattklein123

@gargnupur
Copy link
Contributor Author

@lizan , @mattklein123 : AFAIU, yeah looks like getStreamInfo is maintained just for access logging purposes and we can just maintain one stream info in connection call.. I can volunteer to refactor streaminfo to do that after this PR is in...

@mattklein123
Copy link
Member

Yes please consolidate. We can do it in this PR, it should not be difficult, thanks!

/wait

@gargnupur
Copy link
Contributor Author

@mattklein123 , @lizan : just want to make sure, that the connection callback(read_callback_) has a longer life span than the TCP filter object(https://sourcegraph.com/github.com/envoyproxy/envoy@master/-/blob/source/common/tcp_proxy/tcp_proxy.cc#L214:1&tab=def) . We access streamInfo on destruction of filter object and after changing to use connection's streaminfo, tcp_proxy access log tests are failing. It could be because I need to implement some stuff in mock streaminfo but just wanted to check before I do that...

@mattklein123
Copy link
Member

I'm sure of the specific issue you are facing but AFAIK the lifetime should be fine as we use this in other filters as well, so I'm guessing it's a test issue.

@gargnupur
Copy link
Contributor Author

gargnupur commented Feb 11, 2020 via email

Ref: istio/istio#20802
Signed-off-by: gargnupur <gargnupur@google.com>

Add test

Signed-off-by: gargnupur <gargnupur@google.com>

Use streaminfo from connection callback as compared to maintaining an extra one just for access logging

Signed-off-by: gargnupur <gargnupur@google.com>
@gargnupur
Copy link
Contributor Author

@mattklein123 , @lizan , @kyessenov : PTAL again.. running tests locally too to see if any more tests need to be changed...

Signed-off-by: gargnupur <gargnupur@google.com>
@mattklein123
Copy link
Member

Please check format.

/wait

Signed-off-by: gargnupur <gargnupur@google.com>
mattklein123
mattklein123 previously approved these changes Feb 12, 2020
Copy link
Member

@mattklein123 mattklein123 left a comment

Choose a reason for hiding this comment

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

LGTM at a high level, thanks! I will defer to @lizan for final review/merge.

@@ -292,6 +291,11 @@ void Filter::readDisableDownstream(bool disable) {
}
}

StreamInfo::StreamInfo& Filter::getStreamInfo() {
ASSERT(read_callbacks_ != nullptr);
Copy link
Member

Choose a reason for hiding this comment

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

nit: del as this will crash in an obvious way on the next line.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks.. Will remove

@mattklein123 mattklein123 assigned lizan and unassigned mattklein123 Feb 12, 2020
@@ -204,10 +204,9 @@ UpstreamDrainManager& Config::drainManager() {
return upstream_drain_manager_slot_->getTyped<UpstreamDrainManager>();
}

Filter::Filter(ConfigSharedPtr config, Upstream::ClusterManager& cluster_manager,
TimeSource& time_source)
Filter::Filter(ConfigSharedPtr config, Upstream::ClusterManager& cluster_manager, TimeSource&)
Copy link
Member

Choose a reason for hiding this comment

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

TimeSource& is no longer needed in the signature then?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed

@gargnupur
Copy link
Contributor Author

@mattklein123 : Thanks for the review!
@lizan: There are some more tests failing and will update the PR soon with the fixes for them.
Adding wait label till then.
/wait

Signed-off-by: gargnupur <gargnupur@google.com>
@gargnupur
Copy link
Contributor Author

gargnupur commented Feb 13, 2020

@kyessenov , @mattklein123 , @lizan : the only test that's failing now is the //test/common/upstream:health_checker_impl_test and it's failing at the verification of start time in HttpHealthCheckerImplTest.SuccessServiceCheckWithAdditionalHeaders test case.
I am not sure about implementation so much but test expects that whenever encodeHeaders is called, this value changes.. why is that the case..
With my changes, it's not changing now..

Signed-off-by: gargnupur <gargnupur@google.com>
@gargnupur
Copy link
Contributor Author

@kyessenov , @mattklein123 , @lizan : Fixed health check test too (for some reason, I was trying same thing before and it was not working :( ) Now, test is more close to what should happen in code too.. PTAL

@gargnupur
Copy link
Contributor Author

@lizan : can you please take a look at this? Hoping to get this in before Istio Community Testing on 18th...

@gargnupur
Copy link
Contributor Author

@mattklein123 , @lizan : Looks like it didn't get merged by itself, can you please help merge this?

@mattklein123 mattklein123 merged commit fade668 into envoyproxy:master Feb 14, 2020
gargnupur added a commit to gargnupur/envoy that referenced this pull request Feb 15, 2020
gargnupur added a commit to gargnupur/envoy that referenced this pull request Feb 15, 2020
gargnupur added a commit to gargnupur/envoy that referenced this pull request Feb 15, 2020
kyessenov added a commit to istio/envoy that referenced this pull request Feb 18, 2020
Add upstream and downstream info in parent read callbacks in tcp too(envoyproxy#9949)
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.

6 participants