aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorleonidlazarev <leonidlazarev@yandex-team.com>2023-06-01 16:18:04 +0300
committerleonidlazarev <leonidlazarev@yandex-team.com>2023-06-01 16:18:04 +0300
commitee5d45522deb27bb93f485b36b8c066e004b8cc6 (patch)
treefd9108fd1749e325f1cb94895a6189adfe28f9e3
parent084d18fede279d50932f83a81a13c7703a478f0d (diff)
downloadydb-ee5d45522deb27bb93f485b36b8c066e004b8cc6.tar.gz
feat grpc: decode URL-encoded peer address in logs
-rw-r--r--ydb/core/client/server/grpc_server.cpp10
-rw-r--r--ydb/core/grpc_streaming/grpc_streaming.h26
2 files changed, 18 insertions, 18 deletions
diff --git a/ydb/core/client/server/grpc_server.cpp b/ydb/core/client/server/grpc_server.cpp
index 457ad85af29..c31c839d9ac 100644
--- a/ydb/core/client/server/grpc_server.cpp
+++ b/ydb/core/client/server/grpc_server.cpp
@@ -274,7 +274,7 @@ private:
return x;
};
LOG_DEBUG(ActorSystem, NKikimrServices::GRPC_SERVER, "[%p] issuing response Name# %s data# %s peer# %s", this,
- Name, makeResponseString().data(), Context.peer().c_str());
+ Name, makeResponseString().data(), GetPeerName().c_str());
ResponseSize = resp.ByteSize();
ResponseStatus = status;
StateFunc = &TSimpleRequest::FinishDone;
@@ -287,7 +287,7 @@ private:
TOut resp;
TString msg = "no resource";
LOG_DEBUG(ActorSystem, NKikimrServices::GRPC_SERVER, "[%p] issuing response Name# %s nodata (no resources) peer# %s", this,
- Name, Context.peer().c_str());
+ Name, GetPeerName().c_str());
StateFunc = &TSimpleRequest::FinishDoneWithoutProcessing;
OnBeforeCall();
@@ -312,7 +312,7 @@ private:
return resp;
};
LOG_DEBUG(ActorSystem, NKikimrServices::GRPC_SERVER, "[%p] received request Name# %s ok# %s data# %s peer# %s current inflight# %li", this,
- Name, ok ? "true" : "false", makeRequestString().data(), Context.peer().c_str(), Server->GetCurrentInFlight());
+ Name, ok ? "true" : "false", makeRequestString().data(), GetPeerName().c_str(), Server->GetCurrentInFlight());
if (Context.c_call() == nullptr) {
Y_VERIFY(!ok);
@@ -350,7 +350,7 @@ private:
bool FinishDone(bool ok) {
OnAfterCall();
LOG_DEBUG(ActorSystem, NKikimrServices::GRPC_SERVER, "[%p] finished request Name# %s ok# %s peer# %s", this,
- Name, ok ? "true" : "false", Context.peer().c_str());
+ Name, ok ? "true" : "false", GetPeerName().c_str());
Counters->FinishProcessing(RequestSize, ResponseSize, ok, ResponseStatus,
TDuration::Seconds(RequestTimer.Passed()));
Server->DecRequest();
@@ -362,7 +362,7 @@ private:
bool FinishDoneWithoutProcessing(bool ok) {
OnAfterCall();
LOG_DEBUG(ActorSystem, NKikimrServices::GRPC_SERVER, "[%p] finished request without processing Name# %s ok# %s peer# %s", this,
- Name, ok ? "true" : "false", Context.peer().c_str());
+ Name, ok ? "true" : "false", GetPeerName().c_str());
return false;
}
diff --git a/ydb/core/grpc_streaming/grpc_streaming.h b/ydb/core/grpc_streaming/grpc_streaming.h
index ecac6fcf171..efd6a15b227 100644
--- a/ydb/core/grpc_streaming/grpc_streaming.h
+++ b/ydb/core/grpc_streaming/grpc_streaming.h
@@ -225,7 +225,7 @@ private:
LOG_DEBUG(ActorSystem, LoggerServiceId, "[%p] stream accepted Name# %s ok# %s peer# %s",
this, Name,
status == NGrpc::EQueueEventStatus::OK ? "true" : "false",
- this->Context.peer().c_str());
+ this->GetPeerName().c_str());
if (status == NGrpc::EQueueEventStatus::ERROR) {
// Don't bother registering if accept failed
@@ -266,7 +266,7 @@ private:
LOG_DEBUG(ActorSystem, LoggerServiceId, "[%p] stream done notification Name# %s ok# %s peer# %s",
this, Name,
status == NGrpc::EQueueEventStatus::OK ? "true" : "false",
- this->Context.peer().c_str());
+ this->GetPeerName().c_str());
bool success = status == NGrpc::EQueueEventStatus::OK;
@@ -286,7 +286,7 @@ private:
void Cancel() {
LOG_DEBUG(ActorSystem, LoggerServiceId, "[%p] facade cancel Name# %s peer# %s",
this, Name,
- this->Context.peer().c_str());
+ this->GetPeerName().c_str());
this->Context.TryCancel();
}
@@ -299,7 +299,7 @@ private:
LOG_DEBUG(ActorSystem, LoggerServiceId, "[%p] facade attach Name# %s actor# %s peer# %s",
this, Name,
actor.ToString().c_str(),
- this->Context.peer().c_str());
+ this->GetPeerName().c_str());
auto guard = SingleThreaded.Enforce();
@@ -323,7 +323,7 @@ private:
bool Read() {
LOG_DEBUG(ActorSystem, LoggerServiceId, "[%p] facade read Name# %s peer# %s",
this, Name,
- this->Context.peer().c_str());
+ this->GetPeerName().c_str());
auto guard = SingleThreaded.Enforce();
@@ -363,7 +363,7 @@ private:
this, Name,
status == NGrpc::EQueueEventStatus::OK ? "true" : "false",
dumpResultText().c_str(),
- this->Context.peer().c_str());
+ this->GetPeerName().c_str());
// Take current in-progress read first
auto read = std::move(ReadInProgress);
@@ -386,7 +386,7 @@ private:
Y_VERIFY_DEBUG(flags & FlagFinishCalled);
if (Flags.compare_exchange_weak(flags, flags & ~FlagRegistered, std::memory_order_acq_rel)) {
LOG_DEBUG(ActorSystem, LoggerServiceId, "[%p] deregistering request Name# %s peer# %s (read done)",
- this, Name, this->Context.peer().c_str());
+ this, Name, this->GetPeerName().c_str());
Server->DeregisterRequestCtx(this);
break;
}
@@ -412,14 +412,14 @@ private:
LOG_DEBUG(ActorSystem, LoggerServiceId, "[%p] facade write Name# %s data# %s peer# %s grpc status# (%d) message# %s",
this, Name,
dumpMessageText().c_str(),
- this->Context.peer().c_str(),
+ this->GetPeerName().c_str(),
static_cast<int>(status->error_code()),
status->error_message().c_str());
} else {
LOG_DEBUG(ActorSystem, LoggerServiceId, "[%p] facade write Name# %s data# %s peer# %s",
this, Name,
dumpMessageText().c_str(),
- this->Context.peer().c_str());
+ this->GetPeerName().c_str());
}
Y_VERIFY(!options.is_corked(),
@@ -474,7 +474,7 @@ private:
LOG_DEBUG(ActorSystem, LoggerServiceId, "[%p] write finished Name# %s ok# %s peer# %s",
this, Name,
status == NGrpc::EQueueEventStatus::OK ? "true" : "false",
- this->Context.peer().c_str());
+ this->GetPeerName().c_str());
auto event = MakeHolder<typename IContext::TEvWriteFinished>();
event->Success = status == NGrpc::EQueueEventStatus::OK;
@@ -527,7 +527,7 @@ private:
bool Finish(const grpc::Status& status) {
LOG_DEBUG(ActorSystem, LoggerServiceId, "[%p] facade finish Name# %s peer# %s grpc status# (%d) message# %s",
this, Name,
- this->Context.peer().c_str(),
+ this->GetPeerName().c_str(),
static_cast<int>(status.error_code()),
status.error_message().c_str());
@@ -563,7 +563,7 @@ private:
LOG_DEBUG(ActorSystem, LoggerServiceId, "[%p] stream finished Name# %s ok# %s peer# %s grpc status# (%d) message# %s",
this, Name,
status == NGrpc::EQueueEventStatus::OK ? "true" : "false",
- this->Context.peer().c_str(),
+ this->GetPeerName().c_str(),
static_cast<int>(Status->error_code()),
Status->error_message().c_str());
@@ -598,7 +598,7 @@ private:
while ((flags & FlagRegistered) && ReadQueue.load() == 0) {
if (Flags.compare_exchange_weak(flags, flags & ~FlagRegistered, std::memory_order_acq_rel)) {
LOG_DEBUG(ActorSystem, LoggerServiceId, "[%p] deregistering request Name# %s peer# %s (finish done)",
- this, Name, this->Context.peer().c_str());
+ this, Name, this->GetPeerName().c_str());
Server->DeregisterRequestCtx(this);
break;
}