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 | 1715700d00b30399d3648be821fd585ae552365e (patch) | |
| tree | 6857a59158ea36e56d87fb32fbb8e44673c0ca0f /library/cpp/monlib/encode/buffered | |
| parent | b23c1d7a8015c2006a148fd93b84cdeb0aee17a3 (diff) | |
Restoring authorship annotation for <[email protected]>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/monlib/encode/buffered')
3 files changed, 36 insertions, 36 deletions
| diff --git a/library/cpp/monlib/encode/buffered/buffered_encoder_base.cpp b/library/cpp/monlib/encode/buffered/buffered_encoder_base.cpp index 87c832d642b..4928fdf70fd 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 diff --git a/library/cpp/monlib/encode/buffered/buffered_encoder_base.h b/library/cpp/monlib/encode/buffered/buffered_encoder_base.h index fe3714e58f0..12f838d905c 100644 --- a/library/cpp/monlib/encode/buffered/buffered_encoder_base.h +++ b/library/cpp/monlib/encode/buffered/buffered_encoder_base.h @@ -82,10 +82,10 @@ protected:          TMetricTimeSeries TimeSeries;      }; -protected: -    TString FormatLabels(const TPooledLabels& labels) const; - -protected: +protected:  +    TString FormatLabels(const TPooledLabels& labels) const;  +  +protected:       TEncoderState State_;      TStringPoolBuilder LabelNamesPool_; diff --git a/library/cpp/monlib/encode/buffered/string_pool.h b/library/cpp/monlib/encode/buffered/string_pool.h index 00e5644608a..f07d0507299 100644 --- a/library/cpp/monlib/encode/buffered/string_pool.h +++ b/library/cpp/monlib/encode/buffered/string_pool.h @@ -37,10 +37,10 @@ namespace NMonitoring {              return StrVector_.at(index).first;          } -        TStringBuf Get(const TValue* value) const { -            return StrVector_.at(value->Index).first; -        } - +        TStringBuf Get(const TValue* value) const {  +            return StrVector_.at(value->Index).first;  +        }  +           template <typename TConsumer>          void ForEach(TConsumer&& c) {              Y_ENSURE(IsBuilt_, "Pool must be sorted first"); | 
