diff options
author | gusev-p <gusev-p@yandex-team.ru> | 2022-02-10 16:47:20 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:47:20 +0300 |
commit | 47af3b5bf148ddab250833ec454d30d7c4930c31 (patch) | |
tree | 9814fbd1c3effac9b8377c5d604b367b14e2db55 /library/cpp/monlib/encode/buffered/buffered_encoder_base.cpp | |
parent | 1715700d00b30399d3648be821fd585ae552365e (diff) | |
download | ydb-47af3b5bf148ddab250833ec454d30d7c4930c31.tar.gz |
Restoring authorship annotation for <gusev-p@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/monlib/encode/buffered/buffered_encoder_base.cpp')
-rw-r--r-- | library/cpp/monlib/encode/buffered/buffered_encoder_base.cpp | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/library/cpp/monlib/encode/buffered/buffered_encoder_base.cpp b/library/cpp/monlib/encode/buffered/buffered_encoder_base.cpp index 4928fdf70f..87c832d642 100644 --- a/library/cpp/monlib/encode/buffered/buffered_encoder_base.cpp +++ b/library/cpp/monlib/encode/buffered/buffered_encoder_base.cpp @@ -1,8 +1,8 @@ #include "buffered_encoder_base.h" -#include <util/string/join.h> -#include <util/string/builder.h> - +#include <util/string/join.h> +#include <util/string/builder.h> + namespace NMonitoring { void TBufferedEncoderBase::OnStreamBegin() { @@ -42,8 +42,8 @@ void TBufferedEncoderBase::OnMetricEnd() { Y_ENSURE(existing.GetValueType() == metric.TimeSeries.GetValueType(), "Time series point type mismatch: expected " << existing.GetValueType() - << " but found " << metric.TimeSeries.GetValueType() - << ", labels '" << FormatLabels(metric.Labels) << "'"); + << " but found " << metric.TimeSeries.GetValueType() + << ", labels '" << FormatLabels(metric.Labels) << "'"); existing.CopyFrom(metric.TimeSeries); Metrics_.pop_back(); @@ -144,27 +144,27 @@ void TBufferedEncoderBase::OnLogHistogram(TInstant time, TLogHistogramSnapshotPt metric.TimeSeries.Add(time, s.Get()); } -TString TBufferedEncoderBase::FormatLabels(const TPooledLabels& labels) const { - auto formattedLabels = TVector<TString>(Reserve(labels.size() + CommonLabels_.size())); - auto addLabel = [&](const TPooledLabel& l) { - auto formattedLabel = TStringBuilder() << LabelNamesPool_.Get(l.Key) << '=' << LabelValuesPool_.Get(l.Value); - formattedLabels.push_back(std::move(formattedLabel)); - }; - - for (const auto& l: labels) { - addLabel(l); - } - for (const auto& l: CommonLabels_) { - const auto it = FindIf(labels, [&](const TPooledLabel& label) { - return label.Key == l.Key; - }); - if (it == labels.end()) { - addLabel(l); - } - } - Sort(formattedLabels); - - return TStringBuilder() << "{" << JoinSeq(", ", formattedLabels) << "}"; -} - +TString TBufferedEncoderBase::FormatLabels(const TPooledLabels& labels) const { + auto formattedLabels = TVector<TString>(Reserve(labels.size() + CommonLabels_.size())); + auto addLabel = [&](const TPooledLabel& l) { + auto formattedLabel = TStringBuilder() << LabelNamesPool_.Get(l.Key) << '=' << LabelValuesPool_.Get(l.Value); + formattedLabels.push_back(std::move(formattedLabel)); + }; + + for (const auto& l: labels) { + addLabel(l); + } + for (const auto& l: CommonLabels_) { + const auto it = FindIf(labels, [&](const TPooledLabel& label) { + return label.Key == l.Key; + }); + if (it == labels.end()) { + addLabel(l); + } + } + Sort(formattedLabels); + + return TStringBuilder() << "{" << JoinSeq(", ", formattedLabels) << "}"; +} + } // namespace NMonitoring |