Skip to content

Commit

Permalink
[grpc_trace] protect some log statements behind trace flags (#36956) (#…
Browse files Browse the repository at this point in the history
…37129)

Backport #36956 to 1.65
  • Loading branch information
yashykt authored Jul 1, 2024
1 parent cc02070 commit ef8a71c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/core/lib/event_engine/posix_engine/ev_epoll1_linux.cc
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,8 @@ Epoll1Poller::Epoll1Poller(Scheduler* scheduler)
wakeup_fd_ = *CreateWakeupFd();
CHECK(wakeup_fd_ != nullptr);
CHECK_GE(g_epoll_set_.epfd, 0);
LOG(INFO) << "grpc epoll fd: " << g_epoll_set_.epfd;
GRPC_TRACE_LOG(event_engine_poller, INFO)
<< "grpc epoll fd: " << g_epoll_set_.epfd;
struct epoll_event ev;
ev.events = static_cast<uint32_t>(EPOLLIN | EPOLLET);
ev.data.ptr = wakeup_fd_.get();
Expand Down
7 changes: 5 additions & 2 deletions src/core/lib/event_engine/posix_engine/tcp_socket_utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -627,12 +627,15 @@ void PosixSocketWrapper::TrySetSocketTcpUserTimeout(
// if it is available.
if (g_socket_supports_tcp_user_timeout.load() == 0) {
if (0 != getsockopt(fd_, IPPROTO_TCP, TCP_USER_TIMEOUT, &newval, &len)) {
// This log is intentionally not protected behind a flag, so that users
// know that TCP_USER_TIMEOUT is not being used.
LOG(INFO) << "TCP_USER_TIMEOUT is not available. TCP_USER_TIMEOUT "
"won't be used thereafter";
g_socket_supports_tcp_user_timeout.store(-1);
} else {
LOG(INFO) << "TCP_USER_TIMEOUT is available. TCP_USER_TIMEOUT will be "
"used thereafter";
GRPC_TRACE_LOG(tcp, INFO)
<< "TCP_USER_TIMEOUT is available. TCP_USER_TIMEOUT will be "
"used thereafter";
g_socket_supports_tcp_user_timeout.store(1);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/core/lib/iomgr/ev_epoll1_linux.cc
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ static bool epoll_set_init() {
return false;
}

gpr_log(GPR_INFO, "grpc epoll fd: %d", g_epoll_set.epfd);
GRPC_TRACE_LOG(polling, INFO) << "grpc epoll fd: " << g_epoll_set.epfd;
gpr_atm_no_barrier_store(&g_epoll_set.num_events, 0);
gpr_atm_no_barrier_store(&g_epoll_set.cursor, 0);
return true;
Expand Down

0 comments on commit ef8a71c

Please sign in to comment.