aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/lwtrace/mon/analytics/csv_output.h
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/mon/analytics/csv_output.h
parentd6d7db348c2cc64e71243cab9940ee6778f4317d (diff)
downloadydb-e5d4696304c6689379ac7ce334512404d4b7836c.tar.gz
Restoring authorship annotation for <serxa@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/lwtrace/mon/analytics/csv_output.h')
-rw-r--r--library/cpp/lwtrace/mon/analytics/csv_output.h82
1 files changed, 41 insertions, 41 deletions
diff --git a/library/cpp/lwtrace/mon/analytics/csv_output.h b/library/cpp/lwtrace/mon/analytics/csv_output.h
index 7e441d9e3f..90ded32f5d 100644
--- a/library/cpp/lwtrace/mon/analytics/csv_output.h
+++ b/library/cpp/lwtrace/mon/analytics/csv_output.h
@@ -1,52 +1,52 @@
-#pragma once
-
-#include <util/string/printf.h>
-#include <util/stream/str.h>
-#include <util/generic/set.h>
+#pragma once
+
+#include <util/string/printf.h>
+#include <util/stream/str.h>
+#include <util/generic/set.h>
#include "data.h"
-
-namespace NAnalytics {
-
+
+namespace NAnalytics {
+
inline TString ToCsv(const TTable& in, TString sep = TString("\t"), bool head = true)
-{
+{
TSet<TString> cols;
- bool hasName = false;
- for (const TRow& row : in) {
- hasName = hasName || !row.Name.empty();
- for (const auto& kv : row) {
- cols.insert(kv.first);
- }
- }
-
- TStringStream ss;
- if (head) {
- bool first = true;
- if (hasName) {
+ bool hasName = false;
+ for (const TRow& row : in) {
+ hasName = hasName || !row.Name.empty();
+ for (const auto& kv : row) {
+ cols.insert(kv.first);
+ }
+ }
+
+ TStringStream ss;
+ if (head) {
+ bool first = true;
+ if (hasName) {
ss << (first? TString(): sep) << "Name";
- first = false;
- }
+ first = false;
+ }
for (const TString& c : cols) {
ss << (first? TString(): sep) << c;
- first = false;
- }
- ss << Endl;
- }
-
- for (const TRow& row : in) {
- bool first = true;
- if (hasName) {
+ first = false;
+ }
+ ss << Endl;
+ }
+
+ for (const TRow& row : in) {
+ bool first = true;
+ if (hasName) {
ss << (first? TString(): sep) << row.Name;
- first = false;
- }
+ first = false;
+ }
for (const TString& c : cols) {
ss << (first? TString(): sep);
- first = false;
+ first = false;
TString value;
ss << (row.GetAsString(c, value) ? value : TString("-"));
- }
- ss << Endl;
- }
- return ss.Str();
-}
-
-}
+ }
+ ss << Endl;
+ }
+ return ss.Str();
+}
+
+}