diff options
| author | gusev-p <[email protected]> | 2022-02-10 16:47:20 +0300 | 
|---|---|---|
| committer | Daniil Cherednik <[email protected]> | 2022-02-10 16:47:20 +0300 | 
| commit | 47af3b5bf148ddab250833ec454d30d7c4930c31 (patch) | |
| tree | 9814fbd1c3effac9b8377c5d604b367b14e2db55 /library/cpp/monlib/encode/spack | |
| parent | 1715700d00b30399d3648be821fd585ae552365e (diff) | |
Restoring authorship annotation for <[email protected]>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/monlib/encode/spack')
| -rw-r--r-- | library/cpp/monlib/encode/spack/spack_v1.h | 32 | ||||
| -rw-r--r-- | library/cpp/monlib/encode/spack/spack_v1_decoder.cpp | 38 | ||||
| -rw-r--r-- | library/cpp/monlib/encode/spack/spack_v1_encoder.cpp | 74 | ||||
| -rw-r--r-- | library/cpp/monlib/encode/spack/spack_v1_ut.cpp | 294 | 
4 files changed, 219 insertions, 219 deletions
diff --git a/library/cpp/monlib/encode/spack/spack_v1.h b/library/cpp/monlib/encode/spack/spack_v1.h index e962d214676..cf1c9417b90 100644 --- a/library/cpp/monlib/encode/spack/spack_v1.h +++ b/library/cpp/monlib/encode/spack/spack_v1.h @@ -78,7 +78,7 @@ namespace NMonitoring {      ///////////////////////////////////////////////////////////////////////////////      struct Y_PACKED TSpackHeader {          ui16 Magic = 0x5053;   // "SP" -        ui16 Version;          // MSB - major version, LSB - minor version  +        ui16 Version;          // MSB - major version, LSB - minor version          ui16 HeaderSize = sizeof(TSpackHeader);          ui8 TimePrecision;          ui8 Compression; @@ -89,12 +89,12 @@ namespace NMonitoring {          // add new fields here      }; -    enum ESpackV1Version: ui16 {  -        SV1_00 = 0x0100,  -        SV1_01 = 0x0101,  -        SV1_02 = 0x0102  -    };  -  +    enum ESpackV1Version: ui16 { +        SV1_00 = 0x0100, +        SV1_01 = 0x0101, +        SV1_02 = 0x0102 +    }; +      IMetricEncoderPtr EncoderSpackV1(          IOutputStream* out,          ETimePrecision timePrecision, @@ -102,14 +102,14 @@ namespace NMonitoring {          EMetricsMergingMode mergingMode = EMetricsMergingMode::DEFAULT      ); -    IMetricEncoderPtr EncoderSpackV12(  -        IOutputStream* out,  -        ETimePrecision timePrecision,  -        ECompression compression,  -        EMetricsMergingMode mergingMode = EMetricsMergingMode::DEFAULT,  -        TStringBuf metricNameLabel = "name"  -    );  +    IMetricEncoderPtr EncoderSpackV12( +        IOutputStream* out, +        ETimePrecision timePrecision, +        ECompression compression, +        EMetricsMergingMode mergingMode = EMetricsMergingMode::DEFAULT, +        TStringBuf metricNameLabel = "name" +    ); + +    void DecodeSpackV1(IInputStream* in, IMetricConsumer* c, TStringBuf metricNameLabel = "name"); -    void DecodeSpackV1(IInputStream* in, IMetricConsumer* c, TStringBuf metricNameLabel = "name");  -   } diff --git a/library/cpp/monlib/encode/spack/spack_v1_decoder.cpp b/library/cpp/monlib/encode/spack/spack_v1_decoder.cpp index 330e81a7a25..1f445fc80da 100644 --- a/library/cpp/monlib/encode/spack/spack_v1_decoder.cpp +++ b/library/cpp/monlib/encode/spack/spack_v1_decoder.cpp @@ -27,9 +27,9 @@ namespace NMonitoring {          ///////////////////////////////////////////////////////////////////////          class TDecoderSpackV1 {          public: -            TDecoderSpackV1(IInputStream* in, TStringBuf metricNameLabel)  +            TDecoderSpackV1(IInputStream* in, TStringBuf metricNameLabel)                  : In_(in) -                , MetricNameLabel_(metricNameLabel)  +                , MetricNameLabel_(metricNameLabel)              {              } @@ -83,9 +83,9 @@ namespace NMonitoring {                  // (4) read common labels                  if (ui32 commonLabelsCount = ReadVarint()) { -                    c->OnLabelsBegin();  +                    c->OnLabelsBegin();                      ReadLabels(labelNames, labelValues, commonLabelsCount, c); -                    c->OnLabelsEnd();  +                    c->OnLabelsEnd();                  }                  // (5) read metrics @@ -110,20 +110,20 @@ namespace NMonitoring {                      // TODO: use it                      ReadFixed<ui8>(); // skip flags byte -                    auto metricNameValueIndex = std::numeric_limits<ui32>::max();  -                    if (Header_.Version >= SV1_02) {  -                        metricNameValueIndex = ReadVarint();  -                    }  -  +                    auto metricNameValueIndex = std::numeric_limits<ui32>::max(); +                    if (Header_.Version >= SV1_02) { +                        metricNameValueIndex = ReadVarint(); +                    } +                      // (5.2) labels                      ui32 labelsCount = ReadVarint(); -                    DECODE_ENSURE(Header_.Version >= SV1_02 || labelsCount > 0, "metric #" << i << " has no labels");  -                    c->OnLabelsBegin();  -                    if (Header_.Version >= SV1_02) {  -                        c->OnLabel(MetricNameLabel_, labelValues.Get(metricNameValueIndex));  -                    }  +                    DECODE_ENSURE(Header_.Version >= SV1_02 || labelsCount > 0, "metric #" << i << " has no labels"); +                    c->OnLabelsBegin(); +                    if (Header_.Version >= SV1_02) { +                        c->OnLabel(MetricNameLabel_, labelValues.Get(metricNameValueIndex)); +                    }                      ReadLabels(labelNames, labelValues, labelsCount, c); -                    c->OnLabelsEnd();  +                    c->OnLabelsEnd();                      // (5.3) values                      switch (valueType) { @@ -214,7 +214,7 @@ namespace NMonitoring {                  ui32 bucketsCount = ReadVarint();                  auto s = TExplicitHistogramSnapshot::New(bucketsCount); -                if (SV1_00 == Header_.Version) { // v1.0  +                if (SV1_00 == Header_.Version) { // v1.0                      for (ui32 i = 0; i < bucketsCount; i++) {                          i64 bound = ReadFixed<i64>();                          double doubleBound = (bound != Max<i64>()) @@ -275,7 +275,7 @@ namespace NMonitoring {          private:              IInputStream* In_; -            TString MetricNameLabel_;  +            TString MetricNameLabel_;              ETimePrecision TimePrecision_;              TSpackHeader Header_;          }; // class TDecoderSpackV1 @@ -450,8 +450,8 @@ namespace NMonitoring {          }      } -    void DecodeSpackV1(IInputStream* in, IMetricConsumer* c, TStringBuf metricNameLabel) {  -        TDecoderSpackV1 decoder(in, metricNameLabel);  +    void DecodeSpackV1(IInputStream* in, IMetricConsumer* c, TStringBuf metricNameLabel) { +        TDecoderSpackV1 decoder(in, metricNameLabel);          decoder.Decode(c);      } diff --git a/library/cpp/monlib/encode/spack/spack_v1_encoder.cpp b/library/cpp/monlib/encode/spack/spack_v1_encoder.cpp index 3e7a2fc7ea0..a2b0bb5f50a 100644 --- a/library/cpp/monlib/encode/spack/spack_v1_encoder.cpp +++ b/library/cpp/monlib/encode/spack/spack_v1_encoder.cpp @@ -23,15 +23,15 @@ namespace NMonitoring {                  IOutputStream* out,                  ETimePrecision timePrecision,                  ECompression compression, -                EMetricsMergingMode mergingMode,  -                ESpackV1Version version,  -                TStringBuf metricNameLabel  +                EMetricsMergingMode mergingMode, +                ESpackV1Version version, +                TStringBuf metricNameLabel              )                  : Out_(out)                  , TimePrecision_(timePrecision)                  , Compression_(compression) -                , Version_(version)  -                , MetricName_(Version_ >= SV1_02 ? LabelNamesPool_.PutIfAbsent(metricNameLabel) : nullptr)  +                , Version_(version) +                , MetricName_(Version_ >= SV1_02 ? LabelNamesPool_.PutIfAbsent(metricNameLabel) : nullptr)              {                  MetricsMergingMode_ = mergingMode; @@ -89,7 +89,7 @@ namespace NMonitoring {                  // (1) write header                  TSpackHeader header; -                header.Version = Version_;  +                header.Version = Version_;                  header.TimePrecision = EncodeTimePrecision(TimePrecision_);                  header.Compression = EncodeCompression(Compression_);                  header.LabelNamesSize = static_cast<ui32>( @@ -119,7 +119,7 @@ namespace NMonitoring {                  WriteTime(CommonTime_);                  // (4) write common labels' indexes -                WriteLabels(CommonLabels_, nullptr);  +                WriteLabels(CommonLabels_, nullptr);                  // (5) write metrics                  // metrics count already written in header @@ -132,19 +132,19 @@ namespace NMonitoring {                      ui8 flagsByte = 0x00;                      Out_->Write(&flagsByte, sizeof(flagsByte)); -                    // v1.2 format addition — metric name  -                    if (Version_ >= SV1_02) {  -                        const auto it = FindIf(metric.Labels, [&](const auto& l) {  -                            return l.Key == MetricName_;  -                        });  -                        Y_ENSURE(it != metric.Labels.end(),  -                                 "metric name label '" << LabelNamesPool_.Get(MetricName_->Index) << "' not found, "  -                                 << "all metric labels '" << FormatLabels(metric.Labels) << "'");  -                        WriteVarUInt32(Out_, it->Value->Index);  -                    }  -  +                    // v1.2 format addition — metric name +                    if (Version_ >= SV1_02) { +                        const auto it = FindIf(metric.Labels, [&](const auto& l) { +                            return l.Key == MetricName_; +                        }); +                        Y_ENSURE(it != metric.Labels.end(), +                                 "metric name label '" << LabelNamesPool_.Get(MetricName_->Index) << "' not found, " +                                 << "all metric labels '" << FormatLabels(metric.Labels) << "'"); +                        WriteVarUInt32(Out_, it->Value->Index); +                    } +                      // (5.2) labels -                    WriteLabels(metric.Labels, MetricName_);  +                    WriteLabels(metric.Labels, MetricName_);                      // (5.3) values                      switch (metric.TimeSeries.Size()) { @@ -190,12 +190,12 @@ namespace NMonitoring {                  return (static_cast<ui8>(metric.MetricType) << 2) | static_cast<ui8>(valueType);              } -            void WriteLabels(const TPooledLabels& labels, const TPooledStr* skipKey) {  -                WriteVarUInt32(Out_, static_cast<ui32>(skipKey ? labels.size() - 1 : labels.size()));  +            void WriteLabels(const TPooledLabels& labels, const TPooledStr* skipKey) { +                WriteVarUInt32(Out_, static_cast<ui32>(skipKey ? labels.size() - 1 : labels.size()));                  for (auto&& label : labels) { -                    if (label.Key == skipKey) {  -                        continue;  -                    }  +                    if (label.Key == skipKey) { +                        continue; +                    }                      WriteVarUInt32(Out_, label.Key->Index);                      WriteVarUInt32(Out_, label.Value->Index);                  } @@ -289,8 +289,8 @@ namespace NMonitoring {              IOutputStream* Out_;              ETimePrecision TimePrecision_;              ECompression Compression_; -            ESpackV1Version Version_;  -            const TPooledStr* MetricName_;  +            ESpackV1Version Version_; +            const TPooledStr* MetricName_;              bool Closed_ = false;          }; @@ -302,17 +302,17 @@ namespace NMonitoring {          ECompression compression,          EMetricsMergingMode mergingMode      ) { -        return MakeHolder<TEncoderSpackV1>(out, timePrecision, compression, mergingMode, SV1_01, "");  +        return MakeHolder<TEncoderSpackV1>(out, timePrecision, compression, mergingMode, SV1_01, "");      } -    IMetricEncoderPtr EncoderSpackV12(  -        IOutputStream* out,  -        ETimePrecision timePrecision,  -        ECompression compression,  -        EMetricsMergingMode mergingMode,  -        TStringBuf metricNameLabel  -    ) {  -        Y_ENSURE(!metricNameLabel.Empty(), "metricNameLabel can't be empty");  -        return MakeHolder<TEncoderSpackV1>(out, timePrecision, compression, mergingMode, SV1_02, metricNameLabel);  -    }  +    IMetricEncoderPtr EncoderSpackV12( +        IOutputStream* out, +        ETimePrecision timePrecision, +        ECompression compression, +        EMetricsMergingMode mergingMode, +        TStringBuf metricNameLabel +    ) { +        Y_ENSURE(!metricNameLabel.Empty(), "metricNameLabel can't be empty"); +        return MakeHolder<TEncoderSpackV1>(out, timePrecision, compression, mergingMode, SV1_02, metricNameLabel); +    }  } diff --git a/library/cpp/monlib/encode/spack/spack_v1_ut.cpp b/library/cpp/monlib/encode/spack/spack_v1_ut.cpp index c6748cb0f5e..fe778eb7e02 100644 --- a/library/cpp/monlib/encode/spack/spack_v1_ut.cpp +++ b/library/cpp/monlib/encode/spack/spack_v1_ut.cpp @@ -468,7 +468,7 @@ Y_UNIT_TEST_SUITE(TSpackTest) {          IMetricEncoderPtr e = EncoderProtobuf(&samples);          TBuffer data(expectedSize); -        if (SV1_00 == version) { // v1.0  +        if (SV1_00 == version) { // v1.0              data.Append(reinterpret_cast<char*>(expectedHeader_v1_0), Y_ARRAY_SIZE(expectedHeader_v1_0));          } else {              data.Append(reinterpret_cast<char*>(expectedHeader), Y_ARRAY_SIZE(expectedHeader)); @@ -480,7 +480,7 @@ Y_UNIT_TEST_SUITE(TSpackTest) {          data.Append(reinterpret_cast<char*>(expectedMetric2), Y_ARRAY_SIZE(expectedMetric2));          data.Append(reinterpret_cast<char*>(expectedMetric3), Y_ARRAY_SIZE(expectedMetric3));          data.Append(reinterpret_cast<char*>(expectedMetric4), Y_ARRAY_SIZE(expectedMetric4)); -        if (SV1_00 == version) { // v1.0  +        if (SV1_00 == version) { // v1.0              data.Append(reinterpret_cast<char*>(expectedMetric5_v1_0), Y_ARRAY_SIZE(expectedMetric5_v1_0));          } else {              data.Append(reinterpret_cast<char*>(expectedMetric5), Y_ARRAY_SIZE(expectedMetric5)); @@ -494,7 +494,7 @@ Y_UNIT_TEST_SUITE(TSpackTest) {      void DecodeDataToSamples(NProto::TMultiSamplesList & samples) {          TSpackHeader header; -        header.Version = SV1_01;  +        header.Version = SV1_01;          DecodeDataToSamples(samples, header.Version);      } @@ -689,7 +689,7 @@ Y_UNIT_TEST_SUITE(TSpackTest) {          // Check that histogram bounds decoded from different versions are the same          NProto::TMultiSamplesList samples, samples_v1_0;          DecodeDataToSamples(samples); -        DecodeDataToSamples(samples_v1_0, /*version = */ SV1_00);  +        DecodeDataToSamples(samples_v1_0, /*version = */ SV1_00);          const NProto::THistogram& pointHistogram = samples.GetSamples(4).GetPoints(0).GetHistogram();          const NProto::THistogram& pointHistogram_v1_0 = samples_v1_0.GetSamples(4).GetPoints(0).GetHistogram(); @@ -698,148 +698,148 @@ Y_UNIT_TEST_SUITE(TSpackTest) {              UNIT_ASSERT_DOUBLES_EQUAL(pointHistogram.GetBounds(i), pointHistogram_v1_0.GetBounds(i), Min<double>());          }      } -  -    Y_UNIT_TEST(SimpleV12) {  -        ui8 expectedSerialized[] = {  -            // header  -            0x53, 0x50,             // magic "SP"                     (fixed ui16)  -        // minor, major  -            0x02, 0x01,             // version                        (fixed ui16)  -            0x18, 0x00,             // header size                    (fixed ui16)  -            0x00,                   // time precision                 (fixed ui8)  -            0x00,                   // compression algorithm          (fixed ui8)  -            0x0A, 0x00, 0x00, 0x00, // label names size   (fixed ui32)  -            0x14, 0x00, 0x00, 0x00, // labels values size (fixed ui32)  -            0x01, 0x00, 0x00, 0x00, // metric count       (fixed ui32)  -            0x01, 0x00, 0x00, 0x00, // points count       (fixed ui32)  -  -            // string pools  -            0x73, 0x00,                                     // "s\0"  -            0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x00, // "project\0"  -            0x73, 0x6f, 0x6c, 0x6f, 0x6d, 0x6f, 0x6e, 0x00, // "solomon\0"  -            0x74, 0x65, 0x6D, 0x70, 0x65, 0x72, 0x61, 0x74, // temperature  -            0x75, 0x72, 0x65, 0x00,  -  -            // common time  -            0x00, 0x2f, 0x68, 0x59,                         // common time in seconds                  (fixed ui32)  -  -            // common labels  -            0x00,                                           // common labels count                     (varint)  -  -            // metric  -            0x09,                                           // types (COUNTER | ONE_WITHOUT_TS)        (fixed ui8)  -            0x00,                                           // flags                                   (fixed ui8)  -            0x01,                                           // name index                              (varint)  -            0x01,                                           // metric labels count                     (varint)  -            0x01,                                           // 'project' label name index              (varint)  -            0x00,                                           // 'project' label value index             (varint)  -            0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // value (fixed ui64)  -        };  -  -        // encode  -        {  -            TBuffer actualSerialized;  -            {  -                TBufferOutput out(actualSerialized);  -                auto e = EncoderSpackV12(  -                    &out,  -                    ETimePrecision::SECONDS,  -                    ECompression::IDENTITY,  -                    EMetricsMergingMode::DEFAULT,  -                    "s");  -  -                e->OnStreamBegin();  -                e->OnCommonTime(TInstant::Seconds(1500000000));  -  -                {  -                    e->OnMetricBegin(EMetricType::COUNTER);  -                    {  -                        e->OnLabelsBegin();  + +    Y_UNIT_TEST(SimpleV12) { +        ui8 expectedSerialized[] = { +            // header +            0x53, 0x50,             // magic "SP"                     (fixed ui16) +        // minor, major +            0x02, 0x01,             // version                        (fixed ui16) +            0x18, 0x00,             // header size                    (fixed ui16) +            0x00,                   // time precision                 (fixed ui8) +            0x00,                   // compression algorithm          (fixed ui8) +            0x0A, 0x00, 0x00, 0x00, // label names size   (fixed ui32) +            0x14, 0x00, 0x00, 0x00, // labels values size (fixed ui32) +            0x01, 0x00, 0x00, 0x00, // metric count       (fixed ui32) +            0x01, 0x00, 0x00, 0x00, // points count       (fixed ui32) + +            // string pools +            0x73, 0x00,                                     // "s\0" +            0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x00, // "project\0" +            0x73, 0x6f, 0x6c, 0x6f, 0x6d, 0x6f, 0x6e, 0x00, // "solomon\0" +            0x74, 0x65, 0x6D, 0x70, 0x65, 0x72, 0x61, 0x74, // temperature +            0x75, 0x72, 0x65, 0x00, + +            // common time +            0x00, 0x2f, 0x68, 0x59,                         // common time in seconds                  (fixed ui32) + +            // common labels +            0x00,                                           // common labels count                     (varint) + +            // metric +            0x09,                                           // types (COUNTER | ONE_WITHOUT_TS)        (fixed ui8) +            0x00,                                           // flags                                   (fixed ui8) +            0x01,                                           // name index                              (varint) +            0x01,                                           // metric labels count                     (varint) +            0x01,                                           // 'project' label name index              (varint) +            0x00,                                           // 'project' label value index             (varint) +            0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // value (fixed ui64) +        }; + +        // encode +        { +            TBuffer actualSerialized; +            { +                TBufferOutput out(actualSerialized); +                auto e = EncoderSpackV12( +                    &out, +                    ETimePrecision::SECONDS, +                    ECompression::IDENTITY, +                    EMetricsMergingMode::DEFAULT, +                    "s"); + +                e->OnStreamBegin(); +                e->OnCommonTime(TInstant::Seconds(1500000000)); + +                { +                    e->OnMetricBegin(EMetricType::COUNTER); +                    { +                        e->OnLabelsBegin(); +                        e->OnLabel("project", "solomon"); +                        e->OnLabel("s", "temperature"); +                        e->OnLabelsEnd(); +                    } +                    // Only the last value will be encoded +                    e->OnUint64(TInstant::Zero(), 10); +                    e->OnUint64(TInstant::Zero(), 13); +                    e->OnUint64(TInstant::Zero(), 17); +                    e->OnMetricEnd(); +                } + +                e->OnStreamEnd(); +                e->Close(); +            } + +            UNIT_ASSERT_VALUES_EQUAL(actualSerialized.Size(), Y_ARRAY_SIZE(expectedSerialized)); +            UNIT_ASSERT_BINARY_EQUALS(actualSerialized.Data(), expectedSerialized); +        } + +        // decode +        { +            NProto::TMultiSamplesList samples; +            { +                auto input = TMemoryInput(expectedSerialized, Y_ARRAY_SIZE(expectedSerialized)); +                auto encoder = EncoderProtobuf(&samples); +                DecodeSpackV1(&input, encoder.Get(), "s"); +            } + +            UNIT_ASSERT_VALUES_EQUAL(TInstant::MilliSeconds(samples.GetCommonTime()), +                                     TInstant::Seconds(1500000000)); + +            UNIT_ASSERT_VALUES_EQUAL(samples.CommonLabelsSize(), 0); + +            UNIT_ASSERT_VALUES_EQUAL(samples.SamplesSize(), 1); +            { +                const auto& s = samples.GetSamples(0); +                UNIT_ASSERT_EQUAL(s.GetMetricType(), NProto::COUNTER); +                UNIT_ASSERT_VALUES_EQUAL(s.LabelsSize(), 2); +                AssertLabelEqual(s.GetLabels(0), "s", "temperature"); +                AssertLabelEqual(s.GetLabels(1), "project", "solomon"); + +                UNIT_ASSERT_VALUES_EQUAL(s.PointsSize(), 1); +                AssertPointEqual(s.GetPoints(0), TInstant::Zero(), ui64(17)); +            } +        } +    } + +    Y_UNIT_TEST(V12MissingNameForOneMetric) { +        TBuffer b; +        TBufferOutput out(b); +        auto e = EncoderSpackV12( +            &out, +            ETimePrecision::SECONDS, +            ECompression::IDENTITY, +            EMetricsMergingMode::DEFAULT, +            "s"); + +        UNIT_ASSERT_EXCEPTION_CONTAINS( +            [&]() { +                e->OnStreamBegin(); +                { +                    e->OnMetricBegin(EMetricType::COUNTER); +                    { +                        e->OnLabelsBegin(); +                        e->OnLabel("s", "s1"); +                        e->OnLabelsEnd(); +                    } +                    e->OnUint64(TInstant::Zero(), 1); +                    e->OnMetricEnd(); + +                    e->OnMetricBegin(EMetricType::COUNTER); +                    { +                        e->OnLabelsBegin();                          e->OnLabel("project", "solomon"); -                        e->OnLabel("s", "temperature");  -                        e->OnLabelsEnd();  -                    }  -                    // Only the last value will be encoded  -                    e->OnUint64(TInstant::Zero(), 10);  -                    e->OnUint64(TInstant::Zero(), 13);  -                    e->OnUint64(TInstant::Zero(), 17);  -                    e->OnMetricEnd();  -                }  -  -                e->OnStreamEnd();  -                e->Close();  -            }  -  -            UNIT_ASSERT_VALUES_EQUAL(actualSerialized.Size(), Y_ARRAY_SIZE(expectedSerialized));  -            UNIT_ASSERT_BINARY_EQUALS(actualSerialized.Data(), expectedSerialized);  -        }  -  -        // decode  -        {  -            NProto::TMultiSamplesList samples;  -            {  -                auto input = TMemoryInput(expectedSerialized, Y_ARRAY_SIZE(expectedSerialized));  -                auto encoder = EncoderProtobuf(&samples);  -                DecodeSpackV1(&input, encoder.Get(), "s");  -            }  -  -            UNIT_ASSERT_VALUES_EQUAL(TInstant::MilliSeconds(samples.GetCommonTime()),  -                                     TInstant::Seconds(1500000000));  -  -            UNIT_ASSERT_VALUES_EQUAL(samples.CommonLabelsSize(), 0);  -  -            UNIT_ASSERT_VALUES_EQUAL(samples.SamplesSize(), 1);  -            {  -                const auto& s = samples.GetSamples(0);  -                UNIT_ASSERT_EQUAL(s.GetMetricType(), NProto::COUNTER);  -                UNIT_ASSERT_VALUES_EQUAL(s.LabelsSize(), 2);  -                AssertLabelEqual(s.GetLabels(0), "s", "temperature");  -                AssertLabelEqual(s.GetLabels(1), "project", "solomon");  -  -                UNIT_ASSERT_VALUES_EQUAL(s.PointsSize(), 1);  -                AssertPointEqual(s.GetPoints(0), TInstant::Zero(), ui64(17));  -            }  -        }  -    }  -  -    Y_UNIT_TEST(V12MissingNameForOneMetric) {  -        TBuffer b;  -        TBufferOutput out(b);  -        auto e = EncoderSpackV12(  -            &out,  -            ETimePrecision::SECONDS,  -            ECompression::IDENTITY,  -            EMetricsMergingMode::DEFAULT,  -            "s");  -  -        UNIT_ASSERT_EXCEPTION_CONTAINS(  -            [&]() {  -                e->OnStreamBegin();  -                {  -                    e->OnMetricBegin(EMetricType::COUNTER);  -                    {  -                        e->OnLabelsBegin();  -                        e->OnLabel("s", "s1");  -                        e->OnLabelsEnd();  -                    }  -                    e->OnUint64(TInstant::Zero(), 1);  -                    e->OnMetricEnd();  -  -                    e->OnMetricBegin(EMetricType::COUNTER);  -                    {  -                        e->OnLabelsBegin();  -                        e->OnLabel("project", "solomon");  -                        e->OnLabel("m", "v");  -                        e->OnLabelsEnd();  -                    }  -                    e->OnUint64(TInstant::Zero(), 2);  -                    e->OnMetricEnd();  -                }  -  -                e->OnStreamEnd();  -                e->Close();  -            }(),  -            yexception,  -            "metric name label 's' not found, all metric labels '{m=v, project=solomon}'");  -    }  +                        e->OnLabel("m", "v"); +                        e->OnLabelsEnd(); +                    } +                    e->OnUint64(TInstant::Zero(), 2); +                    e->OnMetricEnd(); +                } + +                e->OnStreamEnd(); +                e->Close(); +            }(), +            yexception, +            "metric name label 's' not found, all metric labels '{m=v, project=solomon}'"); +    }  }  | 
