diff options
| -rw-r--r-- | yt/cpp/mapreduce/client/init.cpp | 4 | ||||
| -rw-r--r-- | yt/cpp/mapreduce/client/operation.cpp | 6 | ||||
| -rw-r--r-- | yt/cpp/mapreduce/interface/config.cpp | 34 | ||||
| -rw-r--r-- | yt/cpp/mapreduce/interface/config.h | 10 | ||||
| -rw-r--r-- | yt/cpp/mapreduce/raw_client/rpc_parameters_serialization.cpp | 6 |
5 files changed, 16 insertions, 44 deletions
diff --git a/yt/cpp/mapreduce/client/init.cpp b/yt/cpp/mapreduce/client/init.cpp index ea1f7a55616..3a68942cab1 100644 --- a/yt/cpp/mapreduce/client/init.cpp +++ b/yt/cpp/mapreduce/client/init.cpp @@ -166,7 +166,7 @@ NLogging::ELogLevel ToCoreLogLevel(ILogger::ELevel level) Y_ABORT(); } -void CommonInitialize(int argc, const char** argv) +void CommonInitialize(int, const char**) { auto logLevelStr = to_lower(TConfig::Get()->LogLevel); ILogger::ELevel logLevel; @@ -187,8 +187,6 @@ void CommonInitialize(int argc, const char** argv) NLogging::TLogManager::Get()->Configure(coreLoggingConfig); } SetLogger(logger); - - TProcessState::Get()->SetCommandLine(argc, argv); } void NonJobInitialize(const TInitializeOptions& options) diff --git a/yt/cpp/mapreduce/client/operation.cpp b/yt/cpp/mapreduce/client/operation.cpp index c96c191bdd7..824b36b206e 100644 --- a/yt/cpp/mapreduce/client/operation.cpp +++ b/yt/cpp/mapreduce/client/operation.cpp @@ -804,10 +804,8 @@ void BuildCommonOperationPart( startedBySpec["user"] = properties->UserName; startedBySpec["wrapper_version"] = properties->ClientVersion; - startedBySpec["command"] = TNode::CreateList(); - for (const auto& arg : properties->CensoredCommandLine) { - startedBySpec["command"].Add(arg); - } + startedBySpec["binary"] = properties->BinaryPath; + startedBySpec["binary_name"] = properties->BinaryName; auto nirvanaBlockUrl = GetNirvanaBlockUrlFromContext(); if (!nirvanaBlockUrl.IsUndefined()) { startedBySpec["nirvana_block_url"] = nirvanaBlockUrl; diff --git a/yt/cpp/mapreduce/interface/config.cpp b/yt/cpp/mapreduce/interface/config.cpp index 418868a7eba..b1f546f7a4e 100644 --- a/yt/cpp/mapreduce/interface/config.cpp +++ b/yt/cpp/mapreduce/interface/config.cpp @@ -1,6 +1,5 @@ #include "config.h" - -#include "operation.h" +#include "serialize.h" #include <yt/cpp/mapreduce/interface/logging/yt_log.h> @@ -12,17 +11,18 @@ #include <library/cpp/yson/json/yson2json_adapter.h> -#include <util/string/strip.h> #include <util/folder/dirut.h> #include <util/folder/path.h> -#include <util/stream/file.h> #include <util/generic/singleton.h> +#include <util/stream/file.h> #include <util/string/builder.h> #include <util/string/cast.h> +#include <util/string/strip.h> #include <util/string/type.h> +#include <util/system/env.h> +#include <util/system/execpath.h> #include <util/system/hostname.h> #include <util/system/user.h> -#include <util/system/env.h> namespace NYT { @@ -294,27 +294,9 @@ TProcessState::TProcessState() Pid = static_cast<int>(getpid()); - if (!ClientVersion) { - ClientVersion = ::TStringBuilder() << "YT C++ native " << GetProgramCommitId(); - } -} - -static TString CensorString(TString input) -{ - static const TString prefix = "AQAD-"; - if (input.find(prefix) == TString::npos) { - return input; - } else { - return TString(input.size(), '*'); - } -} - -void TProcessState::SetCommandLine(int argc, const char* argv[]) -{ - for (int i = 0; i < argc; ++i) { - CommandLine.push_back(argv[i]); - CensoredCommandLine.push_back(CensorString(CommandLine.back())); - } + ClientVersion = ::TStringBuilder() << "YT C++ native " << GetProgramCommitId(); + BinaryPath = GetExecPath(); + BinaryName = GetBaseName(BinaryPath); } TProcessState* TProcessState::Get() diff --git a/yt/cpp/mapreduce/interface/config.h b/yt/cpp/mapreduce/interface/config.h index 71f0c4fcdc2..05c4c473e5c 100644 --- a/yt/cpp/mapreduce/interface/config.h +++ b/yt/cpp/mapreduce/interface/config.h @@ -2,10 +2,11 @@ #include "fwd.h" #include "common.h" -#include "node.h" #include <library/cpp/yt/misc/enum.h> +#include <library/cpp/yson/node/node.h> + #include <util/generic/maybe.h> #include <util/generic/string.h> #include <util/generic/hash_set.h> @@ -236,17 +237,14 @@ struct TProcessState { TString FqdnHostName; TString UserName; - TVector<TString> CommandLine; - // Command line with everything that looks like tokens censored. - TVector<TString> CensoredCommandLine; int Pid; TString ClientVersion; + TString BinaryPath; + TString BinaryName; TProcessState(); - void SetCommandLine(int argc, const char* argv[]); - static TProcessState* Get(); }; diff --git a/yt/cpp/mapreduce/raw_client/rpc_parameters_serialization.cpp b/yt/cpp/mapreduce/raw_client/rpc_parameters_serialization.cpp index 3a78ed3319f..cd36cea25ae 100644 --- a/yt/cpp/mapreduce/raw_client/rpc_parameters_serialization.cpp +++ b/yt/cpp/mapreduce/raw_client/rpc_parameters_serialization.cpp @@ -84,11 +84,7 @@ static TString GetDefaultTransactionTitle() res << "User transaction. Created by: " << processState->UserName << " on " << processState->FqdnHostName << " client: " << processState->ClientVersion << " pid: " << processState->Pid; - if (!processState->CommandLine.empty()) { - res << " program: " << processState->CommandLine[0]; - } else { - res << " command line is unknown probably NYT::Initialize was never called"; - } + res << " program: " << processState->BinaryName; #ifndef NDEBUG res << " build: debug"; |
