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

stream info: add interface name of the local side of the upstream connection #19336

Merged
merged 23 commits into from
Dec 27, 2021

Conversation

junr03
Copy link
Member

@junr03 junr03 commented Dec 21, 2021

Commit Message: This PR wires the interface name of the local side of the upstream connection to stream info.
Additional Description: The underlying logic uses syscalls, but only once per connection, so the addition to stream info on every stream is not expensive. Note that UDS has no meaningful source address information.
Risk Level: low - the socket functionality is already existing.
Testing: added tests

Jose Nino added 5 commits December 21, 2021 11:27
wip
Signed-off-by: Jose Nino <jnino@lyft.com>
Signed-off-by: Jose Nino <jnino@lyft.com>
Signed-off-by: Jose Nino <jnino@lyft.com>
Signed-off-by: Jose Nino <jnino@lyft.com>
Signed-off-by: Jose Nino <jnino@lyft.com>
@repokitteh-read-only
Copy link

As a reminder, PRs marked as draft will not be automatically assigned reviewers,
or be handled by maintainer-oncall triage.

Please mark your PR as ready when you want it to be reviewed!

🐱

Caused by: #19336 was opened by junr03.

see: more, trace.

Jose Nino added 13 commits December 21, 2021 14:10
Signed-off-by: Jose Nino <jnino@lyft.com>
Signed-off-by: Jose Nino <jnino@lyft.com>
…voy into interface-name-stream-info

Signed-off-by: Jose Nino <jnino@lyft.com>
Signed-off-by: Jose Nino <jnino@lyft.com>
Signed-off-by: Jose Nino <jnino@lyft.com>
Signed-off-by: Jose Nino <jnino@lyft.com>
Signed-off-by: Jose Nino <jnino@lyft.com>
This reverts commit 8c2da05.

Signed-off-by: Jose Nino <jnino@lyft.com>
fmt
Signed-off-by: Jose Nino <jnino@lyft.com>
Signed-off-by: Jose Nino <jnino@lyft.com>
fix
Signed-off-by: Jose Nino <jnino@lyft.com>
@repokitteh-read-only repokitteh-read-only bot added the deps Approval required for changes to Envoy's external dependencies label Dec 23, 2021
@repokitteh-read-only
Copy link

CC @envoyproxy/dependency-shepherds: Your approval is needed for changes made to (bazel/.*repos.*\.bzl)|(bazel/dependency_imports\.bzl)|(api/bazel/.*\.bzl)|(.*/requirements\.txt)|(.*\.patch).
envoyproxy/dependency-shepherds assignee is @wrowe

🐱

Caused by: #19336 was synchronize by junr03.

see: more, trace.

Jose Nino added 2 commits December 22, 2021 17:56
fmt
Signed-off-by: Jose Nino <jnino@lyft.com>
This reverts commit 01c7e66.

Signed-off-by: Jose Nino <jnino@lyft.com>
@junr03 junr03 changed the title Interface name stream info stream info: add interface name of the local side of the upstream connection Dec 23, 2021
@junr03 junr03 marked this pull request as ready for review December 23, 2021 02:06
@junr03 junr03 removed the deps Approval required for changes to Envoy's external dependencies label Dec 23, 2021
Copy link
Member

@wbpcode wbpcode left a comment

Choose a reason for hiding this comment

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

Thanks and there are some minor comments about the new API.

envoy/network/socket.h Outdated Show resolved Hide resolved
envoy/network/socket.h Outdated Show resolved Hide resolved
envoy/network/socket.h Outdated Show resolved Hide resolved
envoy/network/socket.h Outdated Show resolved Hide resolved
envoy/stream_info/stream_info.h Outdated Show resolved Hide resolved
envoy/stream_info/stream_info.h Outdated Show resolved Hide resolved
Copy link
Contributor

@snowp snowp left a comment

Choose a reason for hiding this comment

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

Thanks this looks reasonable to me, just a couple things on top of @wbpcode's review

@@ -923,6 +924,11 @@ void ClientConnectionImpl::connect() {

void ClientConnectionImpl::onConnected() {
stream_info_.upstreamInfo()->upstreamTiming().onUpstreamConnectComplete(dispatcher_.timeSource());
// There are no meaningful socket source address semantics for non-IP sockets, so skip.
Copy link
Contributor

Choose a reason for hiding this comment

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

Would interfaceName() just be empty in that case? I wonder if it would be simpler semantically to gate on just that

Copy link
Member

Choose a reason for hiding this comment

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

Or we can make the set* API take a optional arg absl::optional<absl::string_view>. Then we only need do simple check in the set* API implementation. 🤔

Copy link
Member Author

Choose a reason for hiding this comment

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

Would interfaceName() just be empty in that case? I wonder if it would be simpler semantically to gate on just that

No, unfortunately this goes all the way to what unix provides us in getsockname: a successful syscall but an non-zero bytes "empty" string. So, as it stands calling localAddress() on a UDS throws. I can fix that. But it seemed independent of this change.

envoy/network/socket.h Outdated Show resolved Hide resolved
Jose Nino added 2 commits December 23, 2021 10:52
Signed-off-by: Jose Nino <jnino@lyft.com>
fmt
Signed-off-by: Jose Nino <jnino@lyft.com>
@junr03
Copy link
Member Author

junr03 commented Dec 23, 2021

@wbpcode @snowp updated! Thanks for the comments

Signed-off-by: Jose Nino <jnino@lyft.com>
@junr03
Copy link
Member Author

junr03 commented Dec 24, 2021

/retest

@repokitteh-read-only
Copy link

Retrying Azure Pipelines:
Check envoy-presubmit isn't fully completed, but will still attempt retrying.
Retried failed jobs in: envoy-presubmit

🐱

Caused by: a #19336 (comment) was created by @junr03.

see: more, trace.

@junr03
Copy link
Member Author

junr03 commented Dec 24, 2021

/retest

@repokitteh-read-only
Copy link

Retrying Azure Pipelines:
Retried failed jobs in: envoy-presubmit

🐱

Caused by: a #19336 (comment) was created by @junr03.

see: more, trace.

Copy link
Member

@wbpcode wbpcode left a comment

Choose a reason for hiding this comment

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

Thanks. LGTM and cc @snowp

Copy link
Contributor

@snowp snowp 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!

@junr03 junr03 merged commit 475c6ac into main Dec 27, 2021
@junr03 junr03 deleted the interface-name-stream-info branch December 27, 2021 18:04
joshperry pushed a commit to joshperry/envoy that referenced this pull request Feb 13, 2022
…nection (envoyproxy#19336)

Commit Message: This PR wires the interface name of the local side of the upstream connection to stream info.
Additional Description: The underlying logic uses syscalls, but only once per connection, so the addition to stream info on every stream is not expensive. Note that UDS has no meaningful source address information.
Risk Level: low - the socket functionality is already existing.
Testing: added tests

Signed-off-by: Jose Nino <jnino@lyft.com>
Signed-off-by: Josh Perry <josh.perry@mx.com>
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.

4 participants