aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/monlib/deprecated/json/writer.cpp
diff options
context:
space:
mode:
authornga <nga@yandex-team.ru>2022-02-10 16:48:09 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:48:09 +0300
commit1f553f46fb4f3c5eec631352cdd900a0709016af (patch)
treea231fba2c03b440becaea6c86a2702d0bfb0336e /library/cpp/monlib/deprecated/json/writer.cpp
parentc4de7efdedc25b49cbea74bd589eecb61b55b60a (diff)
downloadydb-1f553f46fb4f3c5eec631352cdd900a0709016af.tar.gz
Restoring authorship annotation for <nga@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/monlib/deprecated/json/writer.cpp')
-rw-r--r--library/cpp/monlib/deprecated/json/writer.cpp34
1 files changed, 17 insertions, 17 deletions
diff --git a/library/cpp/monlib/deprecated/json/writer.cpp b/library/cpp/monlib/deprecated/json/writer.cpp
index a581f2e07a..9917288687 100644
--- a/library/cpp/monlib/deprecated/json/writer.cpp
+++ b/library/cpp/monlib/deprecated/json/writer.cpp
@@ -1,36 +1,36 @@
#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();
@@ -51,50 +51,50 @@ namespace NMonitoring {
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);
}
-}
+}