diff options
| author | kbalakirev <[email protected]> | 2022-02-10 16:48:58 +0300 | 
|---|---|---|
| committer | Daniil Cherednik <[email protected]> | 2022-02-10 16:48:58 +0300 | 
| commit | 1906a186042870fd03a12180acd1a6fcee045e42 (patch) | |
| tree | 6cb2ad21897c14f8beca06c9341cb3054952892b /library/cpp/monlib/encode/protobuf | |
| parent | 8a7e5c149f1efbd31f0dbbf8f62f368debccb8a9 (diff) | |
Restoring authorship annotation for <[email protected]>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/monlib/encode/protobuf')
| -rw-r--r-- | library/cpp/monlib/encode/protobuf/protobuf_encoder.cpp | 82 | ||||
| -rw-r--r-- | library/cpp/monlib/encode/protobuf/protos/samples.proto | 42 | 
2 files changed, 62 insertions, 62 deletions
diff --git a/library/cpp/monlib/encode/protobuf/protobuf_encoder.cpp b/library/cpp/monlib/encode/protobuf/protobuf_encoder.cpp index 2d11b9d5ba3..b7e2fca6292 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 {              } diff --git a/library/cpp/monlib/encode/protobuf/protos/samples.proto b/library/cpp/monlib/encode/protobuf/protos/samples.proto index 371f4181d23..6e6646303a6 100644 --- a/library/cpp/monlib/encode/protobuf/protos/samples.proto +++ b/library/cpp/monlib/encode/protobuf/protos/samples.proto @@ -19,8 +19,8 @@ enum EMetricType {      RATE = 4;      HISTOGRAM = 5;      HIST_RATE = 6; -    DSUMMARY = 7; -    LOGHISTOGRAM = 8; +    DSUMMARY = 7;  +    LOGHISTOGRAM = 8;   }  message THistogram { @@ -28,21 +28,21 @@ message THistogram {      repeated uint64 Values = 2; // values stored in each bucket  } -message TLogHistogram { -    double Base = 1; -    uint64 ZerosCount = 2; -    int32 StartPower = 3; -    repeated double Buckets = 4; -} - -message TSummaryDouble { -    double Sum = 1; -    double Min = 2; -    double Max = 3; -    double Last = 4; -    uint64 Count = 5; -} - +message TLogHistogram {  +    double Base = 1;  +    uint64 ZerosCount = 2;  +    int32 StartPower = 3;  +    repeated double Buckets = 4;  +}  +  +message TSummaryDouble {  +    double Sum = 1;  +    double Min = 2;  +    double Max = 3;  +    double Last = 4;  +    uint64 Count = 5;  +}  +   // see TSingleSample  message TPoint {      uint64 Time = 1; @@ -51,8 +51,8 @@ message TPoint {          fixed64 Uint64 = 3;          double Float64 = 4;          THistogram Histogram = 5; -        TSummaryDouble SummaryDouble = 6; -        TLogHistogram LogHistogram = 7; +        TSummaryDouble SummaryDouble = 6;  +        TLogHistogram LogHistogram = 7;       }  } @@ -67,8 +67,8 @@ message TSingleSample {          fixed64 Uint64 = 5;          double Float64 = 6;          THistogram Histogram = 7; -        TSummaryDouble SummaryDouble = 8; -        TLogHistogram LogHistogram = 9; +        TSummaryDouble SummaryDouble = 8;  +        TLogHistogram LogHistogram = 9;       }  }  | 
