Skip to content

Commit

Permalink
[Gpr_To_Absl_Logging] Using GRPC_TRACE_LOG instead of GRPC_TRACE_FLAG…
Browse files Browse the repository at this point in the history
…_ENABLED
  • Loading branch information
tanvi-jagtap committed Aug 16, 2024
1 parent d59586c commit c21f60f
Show file tree
Hide file tree
Showing 21 changed files with 87 additions and 85 deletions.
2 changes: 1 addition & 1 deletion src/core/ext/transport/chaotic_good/server_transport.cc
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ auto ChaoticGoodServerTransport::CallOutboundLoop(
Map(SendCallInitialMetadataAndBody(stream_id, outgoing_frames,
call_initiator),
[stream_id](absl::Status main_body_result) {
GRPC_TRACE_LOG(chaotic_good, 2)
GRPC_TRACE_VLOG(chaotic_good, 2)
<< "CHAOTIC_GOOD: CallOutboundLoop: stream_id=" << stream_id
<< " main_body_result=" << main_body_result;
return Empty{};
Expand Down
18 changes: 9 additions & 9 deletions src/core/ext/transport/chttp2/transport/chttp2_transport.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2084,7 +2084,7 @@ void grpc_chttp2_maybe_complete_recv_message(grpc_chttp2_transport* t,
// Lambda is immediately invoked as a big scoped section that can be
// exited out of at any point by returning.
[&]() {
GRPC_TRACE_LOG(http, 2)
GRPC_TRACE_VLOG(http, 2)
<< "maybe_complete_recv_message " << s
<< " final_metadata_requested=" << s->final_metadata_requested
<< " seen_error=" << s->seen_error;
Expand All @@ -2098,7 +2098,7 @@ void grpc_chttp2_maybe_complete_recv_message(grpc_chttp2_transport* t,
int64_t min_progress_size;
auto r = grpc_deframe_unprocessed_incoming_frames(
s, &min_progress_size, &**s->recv_message, s->recv_message_flags);
GRPC_TRACE_LOG(http, 2)
GRPC_TRACE_VLOG(http, 2)
<< "Deframe data frame: "
<< grpc_core::PollToString(
r, [](absl::Status r) { return r.ToString(); });
Expand Down Expand Up @@ -2152,12 +2152,12 @@ void grpc_chttp2_maybe_complete_recv_message(grpc_chttp2_transport* t,
void grpc_chttp2_maybe_complete_recv_trailing_metadata(grpc_chttp2_transport* t,
grpc_chttp2_stream* s) {
grpc_chttp2_maybe_complete_recv_message(t, s);
GRPC_TRACE_LOG(http, 2) << "maybe_complete_recv_trailing_metadata cli="
<< t->is_client << " s=" << s
<< " closure=" << s->recv_trailing_metadata_finished
<< " read_closed=" << s->read_closed
<< " write_closed=" << s->write_closed << " "
<< s->frame_storage.length;
GRPC_TRACE_VLOG(http, 2) << "maybe_complete_recv_trailing_metadata cli="
<< t->is_client << " s=" << s
<< " closure=" << s->recv_trailing_metadata_finished
<< " read_closed=" << s->read_closed
<< " write_closed=" << s->write_closed << " "
<< s->frame_storage.length;
if (s->recv_trailing_metadata_finished != nullptr && s->read_closed &&
s->write_closed) {
if (s->seen_error || !t->is_client) {
Expand Down Expand Up @@ -2361,7 +2361,7 @@ grpc_chttp2_transport::RemovedStreamHandle grpc_chttp2_mark_stream_closed(
grpc_chttp2_transport* t, grpc_chttp2_stream* s, int close_reads,
int close_writes, grpc_error_handle error) {
grpc_chttp2_transport::RemovedStreamHandle rsh;
GRPC_TRACE_LOG(http, 2)
GRPC_TRACE_VLOG(http, 2)
<< "MARK_STREAM_CLOSED: t=" << t << " s=" << s << "(id=" << s->id << ") "
<< ((close_reads && close_writes)
? "read+write"
Expand Down
2 changes: 1 addition & 1 deletion src/core/ext/transport/chttp2/transport/writing.cc
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ static bool update_list(grpc_chttp2_transport* t, int64_t send_bytes,

static void report_stall(grpc_chttp2_transport* t, grpc_chttp2_stream* s,
const char* staller) {
GRPC_TRACE_LOG(flowctl, 2)
GRPC_TRACE_VLOG(flowctl, 2)
<< t->peer_string.as_string_view() << ":" << t << " stream " << s->id
<< " moved to stalled list by " << staller
<< ". This is FULLY expected to happen in a healthy program that is not "
Expand Down
4 changes: 2 additions & 2 deletions src/core/lib/channel/promise_based_filter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2111,7 +2111,7 @@ void ServerCallData::StartBatch(grpc_transport_stream_op_batch* b) {
// Handle cancellation.
void ServerCallData::Completed(grpc_error_handle error,
bool tarpit_cancellation, Flusher* flusher) {
GRPC_TRACE_LOG(channel, 2)
GRPC_TRACE_VLOG(channel, 2)
<< LogTag() << "ServerCallData::Completed: send_trailing_state="
<< StateString(send_trailing_state_) << " send_initial_state="
<< (send_initial_metadata_ == nullptr
Expand Down Expand Up @@ -2386,7 +2386,7 @@ void ServerCallData::WakeInsideCombiner(Flusher* flusher) {
flusher,
send_initial_metadata_ == nullptr ||
send_initial_metadata_->state == SendInitialMetadata::kForwarded);
GRPC_TRACE_LOG(channel, 2)
GRPC_TRACE_VLOG(channel, 2)
<< LogTag() << ": After send_message WakeInsideCombiner "
<< DebugString() << " is_idle=" << send_message()->IsIdle()
<< " is_forwarded=" << send_message()->IsForwarded();
Expand Down
8 changes: 4 additions & 4 deletions src/core/lib/event_engine/posix_engine/timer_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -118,13 +118,13 @@ void TimerManager::Shutdown() {
{
grpc_core::MutexLock lock(&mu_);
if (shutdown_) return;
GRPC_TRACE_LOG(timer, 2) << "TimerManager::" << this << " shutting down";
GRPC_TRACE_VLOG(timer, 2) << "TimerManager::" << this << " shutting down";
shutdown_ = true;
// Wait on the main loop to exit.
cv_wait_.Signal();
}
main_loop_exit_signal_->WaitForNotification();
GRPC_TRACE_LOG(timer, 2) << "TimerManager::" << this << " shutdown complete";
GRPC_TRACE_VLOG(timer, 2) << "TimerManager::" << this << " shutdown complete";
}

TimerManager::~TimerManager() { Shutdown(); }
Expand All @@ -140,8 +140,8 @@ void TimerManager::Kick() {
void TimerManager::RestartPostFork() {
grpc_core::MutexLock lock(&mu_);
CHECK(GPR_LIKELY(shutdown_));
GRPC_TRACE_LOG(timer, 2) << "TimerManager::" << this
<< " restarting after shutdown";
GRPC_TRACE_VLOG(timer, 2)
<< "TimerManager::" << this << " restarting after shutdown";
shutdown_ = false;
main_loop_exit_signal_.emplace();
thread_pool_->Run([this]() { MainLoop(); });
Expand Down
12 changes: 6 additions & 6 deletions src/core/lib/iomgr/cfstream_handle.cc
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ void CFStreamHandle::ReadCallback(CFReadStreamRef stream,
grpc_error_handle error;
CFErrorRef stream_error;
CFStreamHandle* handle = static_cast<CFStreamHandle*>(client_callback_info);
GRPC_TRACE_LOG(tcp, 2) << "CFStream ReadCallback (" << handle << ", "
<< stream << ", " << type << ", "
<< client_callback_info << ")";
GRPC_TRACE_VLOG(tcp, 2) << "CFStream ReadCallback (" << handle << ", "
<< stream << ", " << type << ", "
<< client_callback_info << ")";
switch (type) {
case kCFStreamEventOpenCompleted:
handle->open_event_.SetReady();
Expand Down Expand Up @@ -98,9 +98,9 @@ void CFStreamHandle::WriteCallback(CFWriteStreamRef stream,
grpc_error_handle error;
CFErrorRef stream_error;
CFStreamHandle* handle = static_cast<CFStreamHandle*>(clientCallBackInfo);
GRPC_TRACE_LOG(tcp, 2) << "CFStream WriteCallback (" << handle << ", "
<< stream << ", " << type << ", " << clientCallBackInfo
<< ")";
GRPC_TRACE_VLOG(tcp, 2) << "CFStream WriteCallback (" << handle << ", "
<< stream << ", " << type << ", "
<< clientCallBackInfo << ")";
switch (type) {
case kCFStreamEventOpenCompleted:
handle->open_event_.SetReady();
Expand Down
4 changes: 2 additions & 2 deletions src/core/lib/iomgr/closure.h
Original file line number Diff line number Diff line change
Expand Up @@ -292,15 +292,15 @@ class Closure {
return;
}
#ifndef NDEBUG
GRPC_TRACE_LOG(closure, 2)
GRPC_TRACE_VLOG(closure, 2)
<< "running closure " << closure << ": created ["
<< closure->file_created << ":" << closure->line_created << "]: run ["
<< location.file() << ":" << location.line() << "]";
CHECK_NE(closure->cb, nullptr);
#endif
closure->cb(closure->cb_arg, error);
#ifndef NDEBUG
GRPC_TRACE_LOG(closure, 2) << "closure " << closure << " finished";
GRPC_TRACE_VLOG(closure, 2) << "closure " << closure << " finished";
#endif
}
};
Expand Down
26 changes: 13 additions & 13 deletions src/core/lib/iomgr/endpoint_cfstream.cc
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,10 @@ static void CallReadCb(CFStreamEndpoint* ep, grpc_error_handle error) {
}

static void CallWriteCb(CFStreamEndpoint* ep, grpc_error_handle error) {
GRPC_TRACE_LOG(tcp, 2) << "CFStream endpoint:" << ep << " call_write_cb "
<< ep->write_cb << " " << ep->write_cb->cb << ":"
<< ep->write_cb->cb_arg
<< "write: error=" << grpc_core::StatusToString(error);
GRPC_TRACE_VLOG(tcp, 2) << "CFStream endpoint:" << ep << " call_write_cb "
<< ep->write_cb << " " << ep->write_cb->cb << ":"
<< ep->write_cb->cb_arg << "write: error="
<< grpc_core::StatusToString(error);
grpc_closure* cb = ep->write_cb;
ep->write_cb = nullptr;
ep->write_slices = nullptr;
Expand Down Expand Up @@ -232,9 +232,9 @@ static void CFStreamRead(grpc_endpoint* ep, grpc_slice_buffer* slices,
grpc_closure* cb, bool /*urgent*/,
int /*min_progress_size*/) {
CFStreamEndpoint* ep_impl = reinterpret_cast<CFStreamEndpoint*>(ep);
GRPC_TRACE_LOG(tcp, 2) << "CFStream endpoint:" << ep_impl << " read ("
<< slices << ", " << cb
<< ") length:" << slices->length;
GRPC_TRACE_VLOG(tcp, 2) << "CFStream endpoint:" << ep_impl << " read ("
<< slices << ", " << cb
<< ") length:" << slices->length;
CHECK_EQ(ep_impl->read_cb, nullptr);
ep_impl->read_cb = cb;
ep_impl->read_slices = slices;
Expand All @@ -249,9 +249,9 @@ static void CFStreamWrite(grpc_endpoint* ep, grpc_slice_buffer* slices,
grpc_closure* cb, void* /*arg*/,
int /*max_frame_size*/) {
CFStreamEndpoint* ep_impl = reinterpret_cast<CFStreamEndpoint*>(ep);
GRPC_TRACE_LOG(tcp, 2) << "CFStream endpoint:" << ep_impl << " write ("
<< slices << ", " << cb
<< ") length:" << slices->length;
GRPC_TRACE_VLOG(tcp, 2) << "CFStream endpoint:" << ep_impl << " write ("
<< slices << ", " << cb
<< ") length:" << slices->length;
CHECK_EQ(ep_impl->write_cb, nullptr);
ep_impl->write_cb = cb;
ep_impl->write_slices = slices;
Expand Down Expand Up @@ -305,9 +305,9 @@ grpc_endpoint* grpc_cfstream_endpoint_create(CFReadStreamRef read_stream,
const char* peer_string,
CFStreamHandle* stream_sync) {
CFStreamEndpoint* ep_impl = new CFStreamEndpoint;
GRPC_TRACE_LOG(tcp, 2) << "CFStream endpoint:" << ep_impl
<< " create readStream:" << read_stream
<< " writeStream: " << write_stream;
GRPC_TRACE_VLOG(tcp, 2) << "CFStream endpoint:" << ep_impl
<< " create readStream:" << read_stream
<< " writeStream: " << write_stream;
ep_impl->base.vtable = &vtable;
gpr_ref_init(&ep_impl->refcount, 1);
ep_impl->read_stream = read_stream;
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 @@ -360,7 +360,7 @@ static grpc_fd* fd_create(int fd, const char* name, bool track_err) {
grpc_iomgr_register_object(&new_fd->iomgr_object, fd_name.c_str());
fork_fd_list_add_grpc_fd(new_fd);
#ifndef NDEBUG
GRPC_TRACE_LOG(fd_refcount, 2)
GRPC_TRACE_VLOG(fd_refcount, 2)
<< "FD " << fd << " " << new_fd << " create " << fd_name;
#endif

Expand Down
4 changes: 2 additions & 2 deletions src/core/lib/iomgr/ev_poll_posix.cc
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ static void fork_fd_list_add_wakeup_fd(grpc_cached_wakeup_fd* fd) {
#define UNREF_BY(fd, n, reason) unref_by(fd, n, reason, __FILE__, __LINE__)
static void ref_by(grpc_fd* fd, int n, const char* reason, const char* file,
int line) {
GRPC_TRACE_LOG(fd_refcount, 2)
GRPC_TRACE_VLOG(fd_refcount, 2)
<< "FD " << fd->fd << " " << fd << " ref " << n << " "
<< gpr_atm_no_barrier_load(&fd->refst) << " -> "
<< gpr_atm_no_barrier_load(&fd->refst) + n << " [" << reason << "; "
Expand All @@ -356,7 +356,7 @@ static void ref_by(grpc_fd* fd, int n) {
#ifndef NDEBUG
static void unref_by(grpc_fd* fd, int n, const char* reason, const char* file,
int line) {
GRPC_TRACE_LOG(fd_refcount, 2)
GRPC_TRACE_VLOG(fd_refcount, 2)
<< "FD " << fd->fd << " " << fd << " unref " << n << " "
<< gpr_atm_no_barrier_load(&fd->refst) << " -> "
<< gpr_atm_no_barrier_load(&fd->refst) - n << " [" << reason << "; "
Expand Down
4 changes: 2 additions & 2 deletions src/core/lib/iomgr/event_engine_shims/closure.cc
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ void RunEventEngineClosure(grpc_closure* closure, grpc_error_handle error) {
grpc_core::ExecCtx exec_ctx;
#ifndef NDEBUG
closure->scheduled = false;
GRPC_TRACE_LOG(closure, 2)
GRPC_TRACE_VLOG(closure, 2)
<< "EventEngine: running closure " << closure << ": created ["
<< closure->file_created << ":" << closure->line_created
<< "]: " << (closure->run ? "run" : "scheduled") << " ["
<< closure->file_initiated << ":" << closure->line_initiated << "]";
#endif
closure->cb(closure->cb_arg, error);
#ifndef NDEBUG
GRPC_TRACE_LOG(closure, 2)
GRPC_TRACE_VLOG(closure, 2)
<< "EventEngine: closure " << closure << " finished";
#endif
}
Expand Down
4 changes: 2 additions & 2 deletions src/core/lib/iomgr/exec_ctx.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
static void exec_ctx_run(grpc_closure* closure) {
#ifndef NDEBUG
closure->scheduled = false;
GRPC_TRACE_LOG(closure, 2)
GRPC_TRACE_VLOG(closure, 2)
<< "running closure " << closure << ": created [" << closure->file_created
<< ":" << closure->line_created
<< "]: " << (closure->run ? "run" : "scheduled") << " ["
Expand All @@ -43,7 +43,7 @@ static void exec_ctx_run(grpc_closure* closure) {
closure->error_data.error = 0;
closure->cb(closure->cb_arg, std::move(error));
#ifndef NDEBUG
GRPC_TRACE_LOG(closure, 2) << "closure " << closure << " finished";
GRPC_TRACE_VLOG(closure, 2) << "closure " << closure << " finished";
#endif
}

Expand Down
8 changes: 4 additions & 4 deletions src/core/lib/iomgr/lockfree_event.cc
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ void LockfreeEvent::NotifyOn(grpc_closure* closure) {
// sure that the shutdown error has been initialized properly before us
// referencing it.
gpr_atm curr = gpr_atm_acq_load(&state_);
GRPC_TRACE_LOG(polling, 2) << "LockfreeEvent::NotifyOn: " << this
<< " curr=" << curr << " closure=" << closure;
GRPC_TRACE_VLOG(polling, 2) << "LockfreeEvent::NotifyOn: " << this
<< " curr=" << curr << " closure=" << closure;
switch (curr) {
case kClosureNotReady: {
// kClosureNotReady -> <closure>.
Expand Down Expand Up @@ -161,7 +161,7 @@ bool LockfreeEvent::SetShutdown(grpc_error_handle shutdown_error) {

while (true) {
gpr_atm curr = gpr_atm_no_barrier_load(&state_);
GRPC_TRACE_LOG(polling, 2)
GRPC_TRACE_VLOG(polling, 2)
<< "LockfreeEvent::SetShutdown: " << &state_ << " curr=" << curr
<< " err=" << StatusToString(shutdown_error);
switch (curr) {
Expand Down Expand Up @@ -209,7 +209,7 @@ void LockfreeEvent::SetReady() {
while (true) {
gpr_atm curr = gpr_atm_no_barrier_load(&state_);

GRPC_TRACE_LOG(polling, 2)
GRPC_TRACE_VLOG(polling, 2)
<< "LockfreeEvent::SetReady: " << &state_ << " curr=" << curr;

switch (curr) {
Expand Down
13 changes: 7 additions & 6 deletions src/core/lib/iomgr/tcp_client_cfstream.cc
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ static void CFStreamConnectCleanup(CFStreamConnect* connect) {

static void OnAlarm(void* arg, grpc_error_handle error) {
CFStreamConnect* connect = static_cast<CFStreamConnect*>(arg);
GRPC_TRACE_LOG(tcp, 2) << "CLIENT_CONNECT :" << connect << " OnAlarm, error:"
<< grpc_core::StatusToString(error);
GRPC_TRACE_VLOG(tcp, 2) << "CLIENT_CONNECT :" << connect << " OnAlarm, error:"
<< grpc_core::StatusToString(error);
gpr_mu_lock(&connect->mu);
grpc_closure* closure = connect->closure;
connect->closure = nil;
Expand All @@ -97,8 +97,8 @@ static void OnAlarm(void* arg, grpc_error_handle error) {

static void OnOpen(void* arg, grpc_error_handle error) {
CFStreamConnect* connect = static_cast<CFStreamConnect*>(arg);
GRPC_TRACE_LOG(tcp, 2) << "CLIENT_CONNECT :" << connect << " OnOpen, error:"
<< grpc_core::StatusToString(error);
GRPC_TRACE_VLOG(tcp, 2) << "CLIENT_CONNECT :" << connect << " OnOpen, error:"
<< grpc_core::StatusToString(error);
gpr_mu_lock(&connect->mu);
grpc_timer_cancel(&connect->alarm);
grpc_closure* closure = connect->closure;
Expand Down Expand Up @@ -169,8 +169,9 @@ static int64_t CFStreamClientConnect(
gpr_ref_init(&connect->refcount, 1);
gpr_mu_init(&connect->mu);

GRPC_TRACE_LOG(tcp, 2) << "CLIENT_CONNECT: " << connect << ", "
<< connect->addr_name << ": asynchronously connecting";
GRPC_TRACE_VLOG(tcp, 2) << "CLIENT_CONNECT: " << connect << ", "
<< connect->addr_name
<< ": asynchronously connecting";

CFReadStreamRef read_stream;
CFWriteStreamRef write_stream;
Expand Down
Loading

0 comments on commit c21f60f

Please sign in to comment.