aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/monlib/deprecated
diff options
context:
space:
mode:
authorSergey Polovko <sergey@polovko.me>2022-02-10 16:47:02 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:47:02 +0300
commit3e0b762a82514bac89c1dd6ea7211e381d8aa248 (patch)
treec2d1b379ecaf05ca8f11ed0b5da9d1a950e6e554 /library/cpp/monlib/deprecated
parentab3783171cc30e262243a0227c86118f7080c896 (diff)
downloadydb-3e0b762a82514bac89c1dd6ea7211e381d8aa248.tar.gz
Restoring authorship annotation for Sergey Polovko <sergey@polovko.me>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/monlib/deprecated')
-rw-r--r--library/cpp/monlib/deprecated/json/ut/ya.make4
-rw-r--r--library/cpp/monlib/deprecated/json/writer.cpp198
-rw-r--r--library/cpp/monlib/deprecated/json/writer.h42
-rw-r--r--library/cpp/monlib/deprecated/json/writer_ut.cpp22
-rw-r--r--library/cpp/monlib/deprecated/json/ya.make24
-rw-r--r--library/cpp/monlib/deprecated/ya.make16
6 files changed, 153 insertions, 153 deletions
diff --git a/library/cpp/monlib/deprecated/json/ut/ya.make b/library/cpp/monlib/deprecated/json/ut/ya.make
index 18315993b5..3c4c338882 100644
--- a/library/cpp/monlib/deprecated/json/ut/ya.make
+++ b/library/cpp/monlib/deprecated/json/ut/ya.make
@@ -1,4 +1,4 @@
-UNITTEST_FOR(library/cpp/monlib/deprecated/json)
+UNITTEST_FOR(library/cpp/monlib/deprecated/json)
OWNER(
jamel
@@ -6,7 +6,7 @@ OWNER(
)
SRCS(
- writer_ut.cpp
+ writer_ut.cpp
)
END()
diff --git a/library/cpp/monlib/deprecated/json/writer.cpp b/library/cpp/monlib/deprecated/json/writer.cpp
index a581f2e07a..fca3834ebc 100644
--- a/library/cpp/monlib/deprecated/json/writer.cpp
+++ b/library/cpp/monlib/deprecated/json/writer.cpp
@@ -1,100 +1,100 @@
-#include "writer.h"
-
-namespace NMonitoring {
- TDeprecatedJsonWriter::TDeprecatedJsonWriter(IOutputStream* out)
- : JsonWriter(out, false)
- , State(STATE_ROOT)
- {
- }
-
- void TDeprecatedJsonWriter::TransitionState(EState current, EState next) {
- if (State != current) {
- ythrow yexception() << "wrong state";
- }
- State = next;
- }
-
- void TDeprecatedJsonWriter::OpenDocument() {
- TransitionState(STATE_ROOT, STATE_DOCUMENT);
- JsonWriter.OpenMap();
- }
-
- void TDeprecatedJsonWriter::CloseDocument() {
- TransitionState(STATE_DOCUMENT, STATE_ROOT);
- JsonWriter.CloseMap();
- JsonWriter.Flush();
- }
-
- void TDeprecatedJsonWriter::OpenCommonLabels() {
- TransitionState(STATE_DOCUMENT, STATE_COMMON_LABELS);
- JsonWriter.Write("commonLabels");
- JsonWriter.OpenMap();
- }
-
- void TDeprecatedJsonWriter::CloseCommonLabels() {
- TransitionState(STATE_COMMON_LABELS, STATE_DOCUMENT);
- JsonWriter.CloseMap();
- }
-
- void TDeprecatedJsonWriter::WriteCommonLabel(TStringBuf name, TStringBuf value) {
- TransitionState(STATE_COMMON_LABELS, STATE_COMMON_LABELS);
- JsonWriter.Write(name, value);
- }
-
- void TDeprecatedJsonWriter::OpenMetrics() {
- TransitionState(STATE_DOCUMENT, STATE_METRICS);
- JsonWriter.Write("sensors");
- JsonWriter.OpenArray();
- }
-
- void TDeprecatedJsonWriter::CloseMetrics() {
- TransitionState(STATE_METRICS, STATE_DOCUMENT);
- JsonWriter.CloseArray();
- }
-
- void TDeprecatedJsonWriter::OpenMetric() {
- TransitionState(STATE_METRICS, STATE_METRIC);
- JsonWriter.OpenMap();
- }
-
- void TDeprecatedJsonWriter::CloseMetric() {
- TransitionState(STATE_METRIC, STATE_METRICS);
- JsonWriter.CloseMap();
- }
-
- void TDeprecatedJsonWriter::OpenLabels() {
- TransitionState(STATE_METRIC, STATE_LABELS);
- JsonWriter.Write("labels");
- JsonWriter.OpenMap();
- }
-
- void TDeprecatedJsonWriter::CloseLabels() {
- TransitionState(STATE_LABELS, STATE_METRIC);
- JsonWriter.CloseMap();
- }
-
- void TDeprecatedJsonWriter::WriteLabel(TStringBuf name, TStringBuf value) {
- TransitionState(STATE_LABELS, STATE_LABELS);
- JsonWriter.Write(name, value);
- }
-
- void TDeprecatedJsonWriter::WriteModeDeriv() {
- TransitionState(STATE_METRIC, STATE_METRIC);
- JsonWriter.Write("mode", "deriv");
- }
-
- void TDeprecatedJsonWriter::WriteValue(long long value) {
- TransitionState(STATE_METRIC, STATE_METRIC);
- JsonWriter.Write("value", value);
- }
-
- void TDeprecatedJsonWriter::WriteDoubleValue(double value) {
- TransitionState(STATE_METRIC, STATE_METRIC);
- JsonWriter.Write("value", value);
- }
-
- void TDeprecatedJsonWriter::WriteTs(ui64 ts) {
- TransitionState(STATE_METRIC, STATE_METRIC);
- JsonWriter.Write("ts", ts);
- }
+#include "writer.h"
+
+namespace NMonitoring {
+ TDeprecatedJsonWriter::TDeprecatedJsonWriter(IOutputStream* out)
+ : JsonWriter(out, false)
+ , State(STATE_ROOT)
+ {
+ }
+
+ void TDeprecatedJsonWriter::TransitionState(EState current, EState next) {
+ if (State != current) {
+ ythrow yexception() << "wrong state";
+ }
+ State = next;
+ }
+
+ void TDeprecatedJsonWriter::OpenDocument() {
+ TransitionState(STATE_ROOT, STATE_DOCUMENT);
+ JsonWriter.OpenMap();
+ }
+
+ void TDeprecatedJsonWriter::CloseDocument() {
+ TransitionState(STATE_DOCUMENT, STATE_ROOT);
+ JsonWriter.CloseMap();
+ JsonWriter.Flush();
+ }
+
+ void TDeprecatedJsonWriter::OpenCommonLabels() {
+ TransitionState(STATE_DOCUMENT, STATE_COMMON_LABELS);
+ JsonWriter.Write("commonLabels");
+ JsonWriter.OpenMap();
+ }
+
+ void TDeprecatedJsonWriter::CloseCommonLabels() {
+ TransitionState(STATE_COMMON_LABELS, STATE_DOCUMENT);
+ JsonWriter.CloseMap();
+ }
+
+ void TDeprecatedJsonWriter::WriteCommonLabel(TStringBuf name, TStringBuf value) {
+ TransitionState(STATE_COMMON_LABELS, STATE_COMMON_LABELS);
+ JsonWriter.Write(name, value);
+ }
+
+ void TDeprecatedJsonWriter::OpenMetrics() {
+ TransitionState(STATE_DOCUMENT, STATE_METRICS);
+ JsonWriter.Write("sensors");
+ JsonWriter.OpenArray();
+ }
+
+ void TDeprecatedJsonWriter::CloseMetrics() {
+ TransitionState(STATE_METRICS, STATE_DOCUMENT);
+ JsonWriter.CloseArray();
+ }
+
+ void TDeprecatedJsonWriter::OpenMetric() {
+ TransitionState(STATE_METRICS, STATE_METRIC);
+ JsonWriter.OpenMap();
+ }
+
+ void TDeprecatedJsonWriter::CloseMetric() {
+ TransitionState(STATE_METRIC, STATE_METRICS);
+ JsonWriter.CloseMap();
+ }
+
+ void TDeprecatedJsonWriter::OpenLabels() {
+ TransitionState(STATE_METRIC, STATE_LABELS);
+ JsonWriter.Write("labels");
+ JsonWriter.OpenMap();
+ }
+
+ void TDeprecatedJsonWriter::CloseLabels() {
+ TransitionState(STATE_LABELS, STATE_METRIC);
+ JsonWriter.CloseMap();
+ }
+
+ void TDeprecatedJsonWriter::WriteLabel(TStringBuf name, TStringBuf value) {
+ TransitionState(STATE_LABELS, STATE_LABELS);
+ JsonWriter.Write(name, value);
+ }
+
+ void TDeprecatedJsonWriter::WriteModeDeriv() {
+ TransitionState(STATE_METRIC, STATE_METRIC);
+ JsonWriter.Write("mode", "deriv");
+ }
+
+ void TDeprecatedJsonWriter::WriteValue(long long value) {
+ TransitionState(STATE_METRIC, STATE_METRIC);
+ JsonWriter.Write("value", value);
+ }
+
+ void TDeprecatedJsonWriter::WriteDoubleValue(double value) {
+ TransitionState(STATE_METRIC, STATE_METRIC);
+ JsonWriter.Write("value", value);
+ }
+
+ void TDeprecatedJsonWriter::WriteTs(ui64 ts) {
+ TransitionState(STATE_METRIC, STATE_METRIC);
+ JsonWriter.Write("ts", ts);
+ }
}
diff --git a/library/cpp/monlib/deprecated/json/writer.h b/library/cpp/monlib/deprecated/json/writer.h
index 183288143c..003992dd9f 100644
--- a/library/cpp/monlib/deprecated/json/writer.h
+++ b/library/cpp/monlib/deprecated/json/writer.h
@@ -2,30 +2,30 @@
#include <library/cpp/json/json_writer.h>
-namespace NMonitoring {
- /**
- * Deprecated writer of Solomon JSON format
- * https://wiki.yandex-team.ru/solomon/api/dataformat/json
- *
- * This writer will be deleted soon, so please consider to use
- * high level library library/cpp/monlib/encode which is decoupled from the
- * particular format.
- */
- class TDeprecatedJsonWriter {
+namespace NMonitoring {
+ /**
+ * Deprecated writer of Solomon JSON format
+ * https://wiki.yandex-team.ru/solomon/api/dataformat/json
+ *
+ * This writer will be deleted soon, so please consider to use
+ * high level library library/cpp/monlib/encode which is decoupled from the
+ * particular format.
+ */
+ class TDeprecatedJsonWriter {
private:
NJson::TJsonWriter JsonWriter;
enum EState {
STATE_ROOT,
STATE_DOCUMENT,
STATE_COMMON_LABELS,
- STATE_METRICS,
- STATE_METRIC,
+ STATE_METRICS,
+ STATE_METRIC,
STATE_LABELS,
};
EState State;
-
+
public:
- explicit TDeprecatedJsonWriter(IOutputStream* out);
+ explicit TDeprecatedJsonWriter(IOutputStream* out);
void OpenDocument();
void CloseDocument();
@@ -35,11 +35,11 @@ namespace NMonitoring {
void WriteCommonLabel(TStringBuf name, TStringBuf value);
- void OpenMetrics();
- void CloseMetrics();
+ void OpenMetrics();
+ void CloseMetrics();
- void OpenMetric();
- void CloseMetric();
+ void OpenMetric();
+ void CloseMetric();
void OpenLabels();
void CloseLabels();
@@ -59,13 +59,13 @@ namespace NMonitoring {
void WriteDoubleValue(double d);
void WriteTs(ui64 ts);
-
+
private:
void WriteLabelsInner(TStringBuf name, TStringBuf value) {
WriteLabel(name, value);
}
- template <typename... T>
+ template <typename... T>
void WriteLabelsInner(TStringBuf name, TStringBuf value, T... pairs) {
WriteLabel(name, value);
WriteLabelsInner(pairs...);
@@ -73,4 +73,4 @@ namespace NMonitoring {
inline void TransitionState(EState current, EState next);
};
-}
+}
diff --git a/library/cpp/monlib/deprecated/json/writer_ut.cpp b/library/cpp/monlib/deprecated/json/writer_ut.cpp
index 1f9fc8f393..f39fe85f1c 100644
--- a/library/cpp/monlib/deprecated/json/writer_ut.cpp
+++ b/library/cpp/monlib/deprecated/json/writer_ut.cpp
@@ -1,30 +1,30 @@
-#include "writer.h"
-
+#include "writer.h"
+
#include <library/cpp/testing/unittest/registar.h>
-using namespace NMonitoring;
+using namespace NMonitoring;
-Y_UNIT_TEST_SUITE(JsonWriterTests) {
+Y_UNIT_TEST_SUITE(JsonWriterTests) {
Y_UNIT_TEST(One) {
TStringStream ss;
- TDeprecatedJsonWriter w(&ss);
+ TDeprecatedJsonWriter w(&ss);
w.OpenDocument();
- w.OpenMetrics();
+ w.OpenMetrics();
for (int i = 0; i < 5; ++i) {
- w.OpenMetric();
+ w.OpenMetric();
w.OpenLabels();
- w.WriteLabel("user", TString("") + (char)('a' + i));
- w.WriteLabel("name", "NWrites");
+ w.WriteLabel("user", TString("") + (char)('a' + i));
+ w.WriteLabel("name", "NWrites");
w.CloseLabels();
if (i % 2 == 0) {
w.WriteModeDeriv();
}
w.WriteValue(10l);
- w.CloseMetric();
+ w.CloseMetric();
}
- w.CloseMetrics();
+ w.CloseMetrics();
w.CloseDocument();
//Cout << ss.Str() << "\n";
diff --git a/library/cpp/monlib/deprecated/json/ya.make b/library/cpp/monlib/deprecated/json/ya.make
index 0ca903ee62..b20030dd31 100644
--- a/library/cpp/monlib/deprecated/json/ya.make
+++ b/library/cpp/monlib/deprecated/json/ya.make
@@ -1,26 +1,26 @@
LIBRARY()
-# Deprecated writer of Solomon JSON format
+# Deprecated writer of Solomon JSON format
# https://wiki.yandex-team.ru/solomon/api/dataformat/json
-#
-# This writer will be deleted soon, so please consider to use
-# high level library library/cpp/monlib/encode which is decoupled from the
-# particular format.
+#
+# This writer will be deleted soon, so please consider to use
+# high level library library/cpp/monlib/encode which is decoupled from the
+# particular format.
OWNER(
jamel
g:solomon
)
-SRCS(
- writer.h
- writer.cpp
-)
-
+SRCS(
+ writer.h
+ writer.cpp
+)
+
PEERDIR(
library/cpp/json
)
END()
-
-RECURSE_FOR_TESTS(ut)
+
+RECURSE_FOR_TESTS(ut)
diff --git a/library/cpp/monlib/deprecated/ya.make b/library/cpp/monlib/deprecated/ya.make
index 9345139aee..7d541ab2a8 100644
--- a/library/cpp/monlib/deprecated/ya.make
+++ b/library/cpp/monlib/deprecated/ya.make
@@ -1,8 +1,8 @@
-OWNER(
- g:solomon
- jamel
-)
-
-RECURSE(
- json
-)
+OWNER(
+ g:solomon
+ jamel
+)
+
+RECURSE(
+ json
+)