aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/lwtrace/start.cpp
diff options
context:
space:
mode:
authorserxa <serxa@yandex-team.ru>2022-02-10 16:49:08 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:49:08 +0300
commite5d4696304c6689379ac7ce334512404d4b7836c (patch)
tree5d5cb817648f650d76cf1076100726fd9b8448e8 /library/cpp/lwtrace/start.cpp
parentd6d7db348c2cc64e71243cab9940ee6778f4317d (diff)
downloadydb-e5d4696304c6689379ac7ce334512404d4b7836c.tar.gz
Restoring authorship annotation for <serxa@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/lwtrace/start.cpp')
-rw-r--r--library/cpp/lwtrace/start.cpp80
1 files changed, 40 insertions, 40 deletions
diff --git a/library/cpp/lwtrace/start.cpp b/library/cpp/lwtrace/start.cpp
index 7d17d6c572..121d5472b6 100644
--- a/library/cpp/lwtrace/start.cpp
+++ b/library/cpp/lwtrace/start.cpp
@@ -14,56 +14,56 @@
using namespace NLWTrace;
namespace {
- struct TTraceManagerHolder {
- TManager TraceManager;
- TTraceManagerHolder()
- : TraceManager(*Singleton<TProbeRegistry>(), true)
- {
- }
- };
-
- void TraceFromEnv(TString path) {
- TString script = TUnbufferedFileInput(path).ReadAll();
- TQuery query;
- bool ok = google::protobuf::TextFormat::ParseFromString(script, &query);
- Y_VERIFY(ok, "failed to parse protobuf");
- Singleton<TTraceManagerHolder>()->TraceManager.New("env", query);
- }
-
-} // anonymous namespace
-
-void NLWTrace::StartLwtraceFromEnv() {
- static bool started = false;
- if (started) {
- return;
- } else {
- started = true;
- }
-
+ struct TTraceManagerHolder {
+ TManager TraceManager;
+ TTraceManagerHolder()
+ : TraceManager(*Singleton<TProbeRegistry>(), true)
+ {
+ }
+ };
+
+ void TraceFromEnv(TString path) {
+ TString script = TUnbufferedFileInput(path).ReadAll();
+ TQuery query;
+ bool ok = google::protobuf::TextFormat::ParseFromString(script, &query);
+ Y_VERIFY(ok, "failed to parse protobuf");
+ Singleton<TTraceManagerHolder>()->TraceManager.New("env", query);
+ }
+
+} // anonymous namespace
+
+void NLWTrace::StartLwtraceFromEnv() {
+ static bool started = false;
+ if (started) {
+ return;
+ } else {
+ started = true;
+ }
+
TString path = GetEnv("LWTRACE");
if (!path) {
return;
}
try {
- TraceFromEnv(path);
+ TraceFromEnv(path);
} catch (...) {
Cerr << "failed to load lwtrace script: " << CurrentExceptionMessage() << "\n";
abort();
}
}
-
-void NLWTrace::StartLwtraceFromEnv(std::function<void(TManager&)> prepare) {
+
+void NLWTrace::StartLwtraceFromEnv(std::function<void(TManager&)> prepare) {
TString path = GetEnv("LWTRACE");
if (Y_LIKELY(!path)) {
- return;
- }
-
- try {
- prepare(Singleton<TTraceManagerHolder>()->TraceManager);
- TraceFromEnv(path);
- } catch (...) {
- Cerr << "failed to load lwtrace script: " << CurrentExceptionMessage() << "\n";
- abort();
- }
-}
+ return;
+ }
+
+ try {
+ prepare(Singleton<TTraceManagerHolder>()->TraceManager);
+ TraceFromEnv(path);
+ } catch (...) {
+ Cerr << "failed to load lwtrace script: " << CurrentExceptionMessage() << "\n";
+ abort();
+ }
+}