[Tracing] Add a CanTrackErrors method to posix EE interface to allow RPC tracing with supportive endpoints (#32994)

pull/33003/head
Vignesh Babu 2 years ago committed by GitHub
parent b684c57bb6
commit 3aae08d25e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      src/core/lib/event_engine/posix.h
  2. 9
      src/core/lib/event_engine/posix_engine/posix_endpoint.h
  3. 16
      src/core/lib/iomgr/event_engine_shims/endpoint.cc

@ -37,6 +37,10 @@ class PosixEndpointWithFdSupport : public EventEngine::Endpoint {
/// Returns the file descriptor associated with the posix endpoint.
virtual int GetWrappedFd() = 0;
/// Returns if the Endpoint supports tracking events from errmsg queues on
/// posix systems.
virtual bool CanTrackErrors() = 0;
/// Shutdown the endpoint. This function call should trigger execution of
/// any pending endpoint Read/Write callbacks with appropriate error
/// absl::Status. After this function call any subsequent endpoint

@ -493,6 +493,8 @@ class PosixEndpointImpl : public grpc_core::RefCounted<PosixEndpointImpl> {
int GetWrappedFd() { return fd_; }
bool CanTrackErrors() const { return poller_->CanTrackErrors(); }
void MaybeShutdown(
absl::Status why,
absl::AnyInvocable<void(absl::StatusOr<int> release_fd)> on_release_fd);
@ -635,6 +637,8 @@ class PosixEndpoint : public PosixEndpointWithFdSupport {
int GetWrappedFd() override { return impl_->GetWrappedFd(); }
bool CanTrackErrors() override { return impl_->CanTrackErrors(); }
void Shutdown(absl::AnyInvocable<void(absl::StatusOr<int> release_fd)>
on_release_fd) override {
if (!shutdown_.exchange(true, std::memory_order_acq_rel)) {
@ -691,6 +695,11 @@ class PosixEndpoint : public PosixEndpointWithFdSupport {
"PosixEndpoint::GetWrappedFd not supported on this platform");
}
bool CanTrackErrors() override {
grpc_core::Crash(
"PosixEndpoint::CanTrackErrors not supported on this platform");
}
void Shutdown(absl::AnyInvocable<void(absl::StatusOr<int> release_fd)>
on_release_fd) override {
grpc_core::Crash("PosixEndpoint::Shutdown not supported on this platform");

@ -256,6 +256,15 @@ class EventEngineEndpointWrapper {
}
}
bool CanTrackErrors() {
if (EventEngineSupportsFd()) {
return reinterpret_cast<PosixEndpointWithFdSupport*>(endpoint_.get())
->CanTrackErrors();
} else {
return false;
}
}
private:
void OnShutdownInternal() {
{
@ -378,7 +387,12 @@ int EndpointGetFd(grpc_endpoint* ep) {
return eeep->wrapper->Fd();
}
bool EndpointCanTrackErr(grpc_endpoint* /* ep */) { return false; }
bool EndpointCanTrackErr(grpc_endpoint* ep) {
auto* eeep =
reinterpret_cast<EventEngineEndpointWrapper::grpc_event_engine_endpoint*>(
ep);
return eeep->wrapper->CanTrackErrors();
}
grpc_endpoint_vtable grpc_event_engine_endpoint_vtable = {
EndpointRead,

Loading…
Cancel
Save