diff options
author | kbalakirev <kbalakirev@yandex-team.ru> | 2022-02-10 16:48:58 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:48:58 +0300 |
commit | 1906a186042870fd03a12180acd1a6fcee045e42 (patch) | |
tree | 6cb2ad21897c14f8beca06c9341cb3054952892b /library/cpp/monlib/encode/protobuf/protobuf_encoder.cpp | |
parent | 8a7e5c149f1efbd31f0dbbf8f62f368debccb8a9 (diff) | |
download | ydb-1906a186042870fd03a12180acd1a6fcee045e42.tar.gz |
Restoring authorship annotation for <kbalakirev@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/monlib/encode/protobuf/protobuf_encoder.cpp')
-rw-r--r-- | library/cpp/monlib/encode/protobuf/protobuf_encoder.cpp | 82 |
1 files changed, 41 insertions, 41 deletions
diff --git a/library/cpp/monlib/encode/protobuf/protobuf_encoder.cpp b/library/cpp/monlib/encode/protobuf/protobuf_encoder.cpp index 2d11b9d5ba..b7e2fca629 100644 --- a/library/cpp/monlib/encode/protobuf/protobuf_encoder.cpp +++ b/library/cpp/monlib/encode/protobuf/protobuf_encoder.cpp @@ -19,9 +19,9 @@ namespace NMonitoring { case EMetricType::HIST_RATE: return NProto::HIST_RATE; case EMetricType::DSUMMARY: - return NProto::DSUMMARY; - case EMetricType::LOGHIST: - return NProto::LOGHISTOGRAM; + return NProto::DSUMMARY; + case EMetricType::LOGHIST: + return NProto::LOGHISTOGRAM; case EMetricType::UNKNOWN: return NProto::UNKNOWN; } @@ -37,23 +37,23 @@ namespace NMonitoring { } } - void FillSummaryDouble(const ISummaryDoubleSnapshot& snapshot, NProto::TSummaryDouble* summary) { - summary->SetSum(snapshot.GetSum()); - summary->SetMin(snapshot.GetMin()); - summary->SetMax(snapshot.GetMax()); - summary->SetLast(snapshot.GetLast()); - summary->SetCount(snapshot.GetCount()); - } - - void FillLogHistogram(const TLogHistogramSnapshot& snapshot, NProto::TLogHistogram* logHist) { - logHist->SetBase(snapshot.Base()); - logHist->SetZerosCount(snapshot.ZerosCount()); - logHist->SetStartPower(snapshot.StartPower()); - for (ui32 i = 0; i < snapshot.Count(); ++i) { - logHist->AddBuckets(snapshot.Bucket(i)); - } - } - + void FillSummaryDouble(const ISummaryDoubleSnapshot& snapshot, NProto::TSummaryDouble* summary) { + summary->SetSum(snapshot.GetSum()); + summary->SetMin(snapshot.GetMin()); + summary->SetMax(snapshot.GetMax()); + summary->SetLast(snapshot.GetLast()); + summary->SetCount(snapshot.GetCount()); + } + + void FillLogHistogram(const TLogHistogramSnapshot& snapshot, NProto::TLogHistogram* logHist) { + logHist->SetBase(snapshot.Base()); + logHist->SetZerosCount(snapshot.ZerosCount()); + logHist->SetStartPower(snapshot.StartPower()); + for (ui32 i = 0; i < snapshot.Count(); ++i) { + logHist->AddBuckets(snapshot.Bucket(i)); + } + } + /////////////////////////////////////////////////////////////////////////////// // TSingleamplesEncoder /////////////////////////////////////////////////////////////////////////////// @@ -121,18 +121,18 @@ namespace NMonitoring { FillHistogram(*snapshot, Sample_->MutableHistogram()); } - void OnSummaryDouble(TInstant time, ISummaryDoubleSnapshotPtr snapshot) override { + void OnSummaryDouble(TInstant time, ISummaryDoubleSnapshotPtr snapshot) override { Y_ENSURE(Sample_, "metric not started"); - Sample_->SetTime(time.MilliSeconds()); - FillSummaryDouble(*snapshot, Sample_->MutableSummaryDouble()); - } - - void OnLogHistogram(TInstant time, TLogHistogramSnapshotPtr snapshot) override { + Sample_->SetTime(time.MilliSeconds()); + FillSummaryDouble(*snapshot, Sample_->MutableSummaryDouble()); + } + + void OnLogHistogram(TInstant time, TLogHistogramSnapshotPtr snapshot) override { Y_ENSURE(Sample_, "metric not started"); - Sample_->SetTime(time.MilliSeconds()); - FillLogHistogram(*snapshot, Sample_->MutableLogHistogram()); - } - + Sample_->SetTime(time.MilliSeconds()); + FillLogHistogram(*snapshot, Sample_->MutableLogHistogram()); + } + void Close() override { } @@ -215,18 +215,18 @@ namespace NMonitoring { void OnSummaryDouble(TInstant time, ISummaryDoubleSnapshotPtr snapshot) override { Y_ENSURE(Sample_, "metric not started"); - NProto::TPoint* point = Sample_->AddPoints(); - point->SetTime(time.MilliSeconds()); - FillSummaryDouble(*snapshot, point->MutableSummaryDouble()); - } - - void OnLogHistogram(TInstant time, TLogHistogramSnapshotPtr snapshot) override { + NProto::TPoint* point = Sample_->AddPoints(); + point->SetTime(time.MilliSeconds()); + FillSummaryDouble(*snapshot, point->MutableSummaryDouble()); + } + + void OnLogHistogram(TInstant time, TLogHistogramSnapshotPtr snapshot) override { Y_ENSURE(Sample_, "metric not started"); - NProto::TPoint* point = Sample_->AddPoints(); - point->SetTime(time.MilliSeconds()); - FillLogHistogram(*snapshot, point->MutableLogHistogram()); - } - + NProto::TPoint* point = Sample_->AddPoints(); + point->SetTime(time.MilliSeconds()); + FillLogHistogram(*snapshot, point->MutableLogHistogram()); + } + void Close() override { } |