aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/monlib/encode/spack/spack_v1_decoder.cpp
diff options
context:
space:
mode:
authorkbalakirev <kbalakirev@yandex-team.ru>2022-02-10 16:48:58 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:48:58 +0300
commit1906a186042870fd03a12180acd1a6fcee045e42 (patch)
tree6cb2ad21897c14f8beca06c9341cb3054952892b /library/cpp/monlib/encode/spack/spack_v1_decoder.cpp
parent8a7e5c149f1efbd31f0dbbf8f62f368debccb8a9 (diff)
downloadydb-1906a186042870fd03a12180acd1a6fcee045e42.tar.gz
Restoring authorship annotation for <kbalakirev@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/monlib/encode/spack/spack_v1_decoder.cpp')
-rw-r--r--library/cpp/monlib/encode/spack/spack_v1_decoder.cpp66
1 files changed, 33 insertions, 33 deletions
diff --git a/library/cpp/monlib/encode/spack/spack_v1_decoder.cpp b/library/cpp/monlib/encode/spack/spack_v1_decoder.cpp
index 1f445fc80d..cffcf94df1 100644
--- a/library/cpp/monlib/encode/spack/spack_v1_decoder.cpp
+++ b/library/cpp/monlib/encode/spack/spack_v1_decoder.cpp
@@ -167,49 +167,49 @@ namespace NMonitoring {
break;
case EMetricType::DSUMMARY:
- c->OnSummaryDouble(time, ReadSummaryDouble());
- break;
-
+ c->OnSummaryDouble(time, ReadSummaryDouble());
+ break;
+
case EMetricType::HIST:
case EMetricType::HIST_RATE:
c->OnHistogram(time, ReadHistogram());
break;
- case EMetricType::LOGHIST:
- c->OnLogHistogram(time, ReadLogHistogram());
- break;
-
+ case EMetricType::LOGHIST:
+ c->OnLogHistogram(time, ReadLogHistogram());
+ break;
+
default:
throw TSpackDecodeError() << "Unsupported metric type: " << metricType;
}
}
- ISummaryDoubleSnapshotPtr ReadSummaryDouble() {
- ui64 count = ReadFixed<ui64>();
- double sum = ReadFixed<double>();
- double min = ReadFixed<double>();
- double max = ReadFixed<double>();
- double last = ReadFixed<double>();
- return MakeIntrusive<TSummaryDoubleSnapshot>(sum, min, max, last, count);
- }
-
- TLogHistogramSnapshotPtr ReadLogHistogram() {
- double base = ReadFixed<double>();
- ui64 zerosCount = ReadFixed<ui64>();
- int startPower = static_cast<int>(ReadVarint());
- ui32 count = ReadVarint();
+ ISummaryDoubleSnapshotPtr ReadSummaryDouble() {
+ ui64 count = ReadFixed<ui64>();
+ double sum = ReadFixed<double>();
+ double min = ReadFixed<double>();
+ double max = ReadFixed<double>();
+ double last = ReadFixed<double>();
+ return MakeIntrusive<TSummaryDoubleSnapshot>(sum, min, max, last, count);
+ }
+
+ TLogHistogramSnapshotPtr ReadLogHistogram() {
+ double base = ReadFixed<double>();
+ ui64 zerosCount = ReadFixed<ui64>();
+ int startPower = static_cast<int>(ReadVarint());
+ ui32 count = ReadVarint();
// see https://a.yandex-team.ru/arc/trunk/arcadia/infra/yasm/stockpile_client/points.cpp?rev=r8593154#L31
// and https://a.yandex-team.ru/arc/trunk/arcadia/infra/yasm/common/points/hgram/normal/normal.h?rev=r8268697#L9
// TODO: share this constant value
Y_ENSURE(count <= 100u, "more than 100 buckets in log histogram: " << count);
- TVector<double> buckets;
- buckets.reserve(count);
- for (ui32 i = 0; i < count; ++i) {
- buckets.emplace_back(ReadFixed<double>());
- }
- return MakeIntrusive<TLogHistogramSnapshot>(base, zerosCount, startPower, std::move(buckets));
- }
-
+ TVector<double> buckets;
+ buckets.reserve(count);
+ for (ui32 i = 0; i < count; ++i) {
+ buckets.emplace_back(ReadFixed<double>());
+ }
+ return MakeIntrusive<TLogHistogramSnapshot>(base, zerosCount, startPower, std::move(buckets));
+ }
+
IHistogramSnapshotPtr ReadHistogram() {
ui32 bucketsCount = ReadVarint();
auto s = TExplicitHistogramSnapshot::New(bucketsCount);
@@ -245,9 +245,9 @@ namespace NMonitoring {
IMetricConsumer* c)
{
for (ui32 i = 0; i < count; i++) {
- auto nameIdx = ReadVarint();
- auto valueIdx = ReadVarint();
- c->OnLabel(labelNames.Get(nameIdx), labelValues.Get(valueIdx));
+ auto nameIdx = ReadVarint();
+ auto valueIdx = ReadVarint();
+ c->OnLabel(labelNames.Get(nameIdx), labelValues.Get(valueIdx));
}
}
@@ -385,7 +385,7 @@ namespace NMonitoring {
*result = EMetricType::DSUMMARY;
}
return true;
- } else if (byte == EncodeMetricType(EMetricType::LOGHIST)) {
+ } else if (byte == EncodeMetricType(EMetricType::LOGHIST)) {
if (result) {
*result = EMetricType::LOGHIST;
}