-
Notifications
You must be signed in to change notification settings - Fork 607
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(grpc): Allow gRPC connections via Unix socket #1833
Merged
Merged
Commits on Jun 1, 2023
-
fix(grpc): Allow gRPC connections via Unix socket
This commit addresses issue open-telemetry#1832. The way `NET_PEER_IP` and `NET_PEER_PORT` are retrieved raises a `ValueError` when gRPC connections are handled via Unix sockets. ```py ip, port = ( context.peer().split(",")[0].split(":", 1)[1].rsplit(":", 1) ) ``` When using an address like `unix:///tmp/grpc.sock` the value of `context.peer()` is `"unix:"`. Substituting that in the function above... ```py ip, port = "unix:".split(",")[0].split(":", 1)[1].rsplit(":", 1) ip, port = ["unix:"][0].split(":", 1)[1].rsplit(":", 1) ip, port = "unix:".split(":", 1)[1].rsplit(":", 1) ip, port = ["unix", ""][1].rsplit(":", 1) ip, port = "".rsplit(":", 1) ip, port = [""] # ValueError ``` I "addressed" the issue by guarding the retrieval of `net.peer.*` values under an `if` statement that checks if we are using a Unix socket. I extended the `server_interceptor` tests to run against TCP and Unix socket configurations. --- **Open Questions** - [ ] The socket tests will fail on Windows. Is there a way to annotate that? - [ ] Are there other span values we should be setting for the unix socket?
Configuration menu - View commit details
-
Copy full SHA for f6eae8f - Browse repository at this point
Copy the full SHA f6eae8fView commit details -
Configuration menu - View commit details
-
Copy full SHA for ec25dd5 - Browse repository at this point
Copy the full SHA ec25dd5View commit details -
Configuration menu - View commit details
-
Copy full SHA for 80a518f - Browse repository at this point
Copy the full SHA 80a518fView commit details -
Configuration menu - View commit details
-
Copy full SHA for 67beb25 - Browse repository at this point
Copy the full SHA 67beb25View commit details
Commits on Jun 11, 2023
-
Configuration menu - View commit details
-
Copy full SHA for e498b91 - Browse repository at this point
Copy the full SHA e498b91View commit details
Commits on Jun 16, 2023
-
Configuration menu - View commit details
-
Copy full SHA for eb3779d - Browse repository at this point
Copy the full SHA eb3779dView commit details
Commits on Jun 20, 2023
-
Configuration menu - View commit details
-
Copy full SHA for cf329fe - Browse repository at this point
Copy the full SHA cf329feView commit details -
Configuration menu - View commit details
-
Copy full SHA for 5e622b6 - Browse repository at this point
Copy the full SHA 5e622b6View commit details
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.