diff options
author | nga <nga@yandex-team.ru> | 2022-02-10 16:48:09 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:48:09 +0300 |
commit | c2a1af049e9deca890e9923abe64fe6c59060348 (patch) | |
tree | b222e5ac2e2e98872661c51ccceee5da0d291e13 /library/cpp/monlib/deprecated/json/writer.cpp | |
parent | 1f553f46fb4f3c5eec631352cdd900a0709016af (diff) | |
download | ydb-c2a1af049e9deca890e9923abe64fe6c59060348.tar.gz |
Restoring authorship annotation for <nga@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/monlib/deprecated/json/writer.cpp')
-rw-r--r-- | library/cpp/monlib/deprecated/json/writer.cpp | 34 |
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 9917288687..a581f2e07a 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); } -} +} |