From 498a47e48d41e5ec64ee3aa622a76a80274f35bd Mon Sep 17 00:00:00 2001 From: kbalakirev <kbalakirev@yandex-team.ru> Date: Thu, 10 Feb 2022 16:48:58 +0300 Subject: Restoring authorship annotation for <kbalakirev@yandex-team.ru>. Commit 2 of 2. --- library/cpp/monlib/encode/text/text_encoder.cpp | 20 ++++++------- library/cpp/monlib/encode/text/text_encoder_ut.cpp | 34 +++++++++++----------- 2 files changed, 27 insertions(+), 27 deletions(-) (limited to 'library/cpp/monlib/encode/text') diff --git a/library/cpp/monlib/encode/text/text_encoder.cpp b/library/cpp/monlib/encode/text/text_encoder.cpp index 8aca133542..10336261f0 100644 --- a/library/cpp/monlib/encode/text/text_encoder.cpp +++ b/library/cpp/monlib/encode/text/text_encoder.cpp @@ -94,16 +94,16 @@ namespace NMonitoring { TimeSeries_.Add(time, snapshot.Get()); } - void OnSummaryDouble(TInstant time, ISummaryDoubleSnapshotPtr snapshot) override { + void OnSummaryDouble(TInstant time, ISummaryDoubleSnapshotPtr snapshot) override { State_.Expect(TEncoderState::EState::METRIC); - TimeSeries_.Add(time, snapshot.Get()); - } - + TimeSeries_.Add(time, snapshot.Get()); + } + void OnLogHistogram(TInstant ts, TLogHistogramSnapshotPtr snapshot) override { State_.Expect(TEncoderState::EState::METRIC); TimeSeries_.Add(ts, snapshot.Get()); - } - + } + void Close() override { } @@ -132,11 +132,11 @@ namespace NMonitoring { (*Out_) << *value.AsHistogram(); break; case EMetricValueType::SUMMARY: - (*Out_) << *value.AsSummaryDouble(); - break; - case EMetricValueType::LOGHISTOGRAM: + (*Out_) << *value.AsSummaryDouble(); + break; + case EMetricValueType::LOGHISTOGRAM: (*Out_) << *value.AsLogHistogram(); - break; + break; case EMetricValueType::UNKNOWN: ythrow yexception() << "unknown metric value type"; } diff --git a/library/cpp/monlib/encode/text/text_encoder_ut.cpp b/library/cpp/monlib/encode/text/text_encoder_ut.cpp index 09418cff96..554b6f5fa9 100644 --- a/library/cpp/monlib/encode/text/text_encoder_ut.cpp +++ b/library/cpp/monlib/encode/text/text_encoder_ut.cpp @@ -260,24 +260,24 @@ Y_UNIT_TEST_SUITE(TTextText) { " HIST readTimeMillis{} [{1: 0, 2: 0, 3: 1, 4: 0, 5: 7, inf: 1}]\n" "HIST_RATE writeTimeMillis{} [{1: 0, 2: 0, 3: 1, 4: 0, 5: 7, inf: 1}]\n"); } - - Y_UNIT_TEST(Summary) { - auto s = MakeIntrusive<TSummaryDoubleSnapshot>(10.1, -0.45, 0.478, 0.3, 30u); + + Y_UNIT_TEST(Summary) { + auto s = MakeIntrusive<TSummaryDoubleSnapshot>(10.1, -0.45, 0.478, 0.3, 30u); TString result = EncodeToString(true, [s](IMetricEncoder* e) { - e->OnStreamBegin(); - { + e->OnStreamBegin(); + { e->OnMetricBegin(EMetricType::DSUMMARY); - { - e->OnLabelsBegin(); - e->OnLabel("sensor", "temperature"); - e->OnLabelsEnd(); - } - e->OnSummaryDouble(TInstant::Zero(), s); + { + e->OnLabelsBegin(); + e->OnLabel("sensor", "temperature"); + e->OnLabelsEnd(); + } + e->OnSummaryDouble(TInstant::Zero(), s); e->OnMetricEnd(); - } - e->OnStreamEnd(); - }); - UNIT_ASSERT_STRINGS_EQUAL(result, - " DSUMMARY temperature{} [{sum: 10.1, min: -0.45, max: 0.478, last: 0.3, count: 30}]\n"); - } + } + e->OnStreamEnd(); + }); + UNIT_ASSERT_STRINGS_EQUAL(result, + " DSUMMARY temperature{} [{sum: 10.1, min: -0.45, max: 0.478, last: 0.3, count: 30}]\n"); + } } -- cgit v1.2.3