aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsergeyveselov <sergeyveselov@yandex-team.com>2023-11-03 12:33:43 +0300
committersergeyveselov <sergeyveselov@yandex-team.com>2023-11-03 12:57:19 +0300
commita020d3047031674dacf4fb87fbbbf82df29fe152 (patch)
treee7ba7a93a36e5261dcb48095b27f0913574d2d81
parent561d86b3dc4218ac76469e111f603556c7e2ffea (diff)
downloadydb-a020d3047031674dacf4fb87fbbbf82df29fe152.tar.gz
fSQS-777 write only one log record per SQS request
Writing log about request in SQS only once
-rw-r--r--ydb/core/ymq/actor/auth_factory.h1
-rw-r--r--ydb/core/ymq/actor/auth_multi_factory.cpp5
-rw-r--r--ydb/core/ymq/http/http.cpp10
-rw-r--r--ydb/core/ymq/http/http.h2
4 files changed, 11 insertions, 7 deletions
diff --git a/ydb/core/ymq/actor/auth_factory.h b/ydb/core/ymq/actor/auth_factory.h
index 8a7cd3298f..32a00ee5d2 100644
--- a/ydb/core/ymq/actor/auth_factory.h
+++ b/ydb/core/ymq/actor/auth_factory.h
@@ -15,6 +15,7 @@ struct TAuthActorData {
THolder<NKikimrClient::TSqsRequest> SQSRequest;
THolder<IReplyCallback> HTTPCallback;
+ std::function<void(TString)> UserSidCallback;
bool EnableQueueLeader;
diff --git a/ydb/core/ymq/actor/auth_multi_factory.cpp b/ydb/core/ymq/actor/auth_multi_factory.cpp
index 45b6a54ff3..03a287a335 100644
--- a/ydb/core/ymq/actor/auth_multi_factory.cpp
+++ b/ydb/core/ymq/actor/auth_multi_factory.cpp
@@ -99,6 +99,7 @@ public:
, CloudId_(data.CloudID)
, ResourceId_(data.ResourceID)
, Counters_(*data.Counters)
+ , UserSidCallback_(std::move(data.UserSidCallback))
{
Y_ABORT_UNLESS(RequestId_);
}
@@ -308,7 +309,7 @@ public:
}
UserSID_ = result.Token->GetUserSID();
- LOG_SQS_INFO("Request [" << RequestId_ << "] " << " on queue from subject: " << UserSID_);
+ UserSidCallback_(UserSID_);
OnFinishedRequest();
}
@@ -558,6 +559,8 @@ private:
TDuration FolderServiceRequestRetryPeriod_ = CLOUD_AUTH_RETRY_PERIOD;
NKikimrClient::TSqsResponse Response_;
+
+ std::function<void(TString)> UserSidCallback_;
};
void TMultiAuthFactory::Initialize(
diff --git a/ydb/core/ymq/http/http.cpp b/ydb/core/ymq/http/http.cpp
index deca686d6f..e5d2b70d68 100644
--- a/ydb/core/ymq/http/http.cpp
+++ b/ydb/core/ymq/http/http.cpp
@@ -185,6 +185,9 @@ TString THttpRequest::LogHttpRequestResponseCommonInfoString() {
logString << " Action [" << ActionToString(Action_) << "]";
}
logString << " IP [" << SourceAddress_ << "] Duration [" << duration.MilliSeconds() << "ms]";
+ if (UserSid_) {
+ logString << " Subject [" << UserSid_ << "]";
+ }
return logString;
}
@@ -230,12 +233,6 @@ bool THttpRequest::DoReply(const TReplyParams& p) {
const TDuration parseTime = TInstant::Now() - StartTime_;
RLOG_SQS_BASE_DEBUG(*Parent_->ActorSystem_, "Parse time: [" << parseTime.MilliSeconds() << "ms]");
- RLOG_SQS_BASE_INFO(
- *Parent_->ActorSystem_,
- "Start request. User [" << UserName_ << "] Queue [" << QueueName_ << "], Cloud [" << AccountName_
- << "], Folder [" << FolderId_ << "] Action [" << ActionToString(Action_)
- << "] IP [" << SourceAddress_ << "]"
- );
if (!Parent_->Config.GetYandexCloudMode() && UserName_.empty()) {
WriteResponse(p, MakeErrorXmlResponse(NErrors::MISSING_PARAMETER, Parent_->AggregatedUserCounters_.Get(), "No user name was provided."));
@@ -568,6 +565,7 @@ bool THttpRequest::SetupRequest() {
TAuthActorData data {
.SQSRequest = std::move(requestHolder),
.HTTPCallback = std::move(httpCallback),
+ .UserSidCallback = [this](const TString& userSid) { UserSid_ = userSid; },
.EnableQueueLeader = enableQueueLeader,
.Action = Action_,
.ExecutorPoolID = Parent_->PoolId_,
diff --git a/ydb/core/ymq/http/http.h b/ydb/core/ymq/http/http.h
index 64c3747f0f..91f666adb4 100644
--- a/ydb/core/ymq/http/http.h
+++ b/ydb/core/ymq/http/http.h
@@ -133,6 +133,8 @@ private:
bool IsPrivateRequest_ = false; // Has "/private" path prefix
TInstant StartTime_ = TInstant::Now();
+
+ TString UserSid_;
};
class TAsyncHttpServer