diff options
author | tobo <tobo@yandex-team.ru> | 2022-02-10 16:47:27 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:47:27 +0300 |
commit | 55a7f90e4cd31e9481cace8ee5dfd682c27e810e (patch) | |
tree | 9814fbd1c3effac9b8377c5d604b367b14e2db55 /library/cpp/monlib | |
parent | 7fe839092527589b38f014d854c51565b3c1adfa (diff) | |
download | ydb-55a7f90e4cd31e9481cace8ee5dfd682c27e810e.tar.gz |
Restoring authorship annotation for <tobo@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/monlib')
29 files changed, 204 insertions, 204 deletions
diff --git a/library/cpp/monlib/dynamic_counters/contention_ut.cpp b/library/cpp/monlib/dynamic_counters/contention_ut.cpp index 575a4f0e6d..8798044ee3 100644 --- a/library/cpp/monlib/dynamic_counters/contention_ut.cpp +++ b/library/cpp/monlib/dynamic_counters/contention_ut.cpp @@ -24,7 +24,7 @@ Y_UNIT_TEST_SUITE(TDynamicCountersContentionTest) { Thread.Start(); } - ~TConsumer() override { + ~TConsumer() override { Thread.Join(); } diff --git a/library/cpp/monlib/dynamic_counters/counters.cpp b/library/cpp/monlib/dynamic_counters/counters.cpp index a1e7883c1d..3635d87d0d 100644 --- a/library/cpp/monlib/dynamic_counters/counters.cpp +++ b/library/cpp/monlib/dynamic_counters/counters.cpp @@ -44,7 +44,7 @@ namespace { } } -static constexpr TStringBuf INDENT = " "; +static constexpr TStringBuf INDENT = " "; TDynamicCounters::TDynamicCounters(EVisibility vis) { @@ -223,10 +223,10 @@ void TDynamicCounters::OutputPlainText(IOutputStream& os, const TString& indent) auto snapshot = histogram->Snapshot(); for (ui32 i = 0, count = snapshot->Count(); i < count; i++) { - os << indent << INDENT << TStringBuf("bin="); + os << indent << INDENT << TStringBuf("bin="); TBucketBound bound = snapshot->UpperBound(i); if (bound == Max<TBucketBound>()) { - os << TStringBuf("inf"); + os << TStringBuf("inf"); } else { os << bound; } diff --git a/library/cpp/monlib/dynamic_counters/golovan_page.cpp b/library/cpp/monlib/dynamic_counters/golovan_page.cpp index 67680484c9..49cf2d39bb 100644 --- a/library/cpp/monlib/dynamic_counters/golovan_page.cpp +++ b/library/cpp/monlib/dynamic_counters/golovan_page.cpp @@ -22,7 +22,7 @@ public: FirstCounter = true; } - void OnCounter(const TString&, const TString& value, const TCounterForPtr* counter) override { + void OnCounter(const TString&, const TString& value, const TCounterForPtr* counter) override { if (FirstCounter) { FirstCounter = false; } else { @@ -42,14 +42,14 @@ public: void OnHistogram(const TString&, const TString&, IHistogramSnapshotPtr, bool) override { } - void OnGroupBegin(const TString&, const TString& value, const TDynamicCounters*) override { + void OnGroupBegin(const TString&, const TString& value, const TDynamicCounters*) override { prefix += value; if (!value.empty()) { prefix += "_"; } } - void OnGroupEnd(const TString&, const TString&, const TDynamicCounters*) override { + void OnGroupEnd(const TString&, const TString&, const TDynamicCounters*) override { prefix = ""; } diff --git a/library/cpp/monlib/dynamic_counters/page.cpp b/library/cpp/monlib/dynamic_counters/page.cpp index eecf536623..5124a47bb3 100644 --- a/library/cpp/monlib/dynamic_counters/page.cpp +++ b/library/cpp/monlib/dynamic_counters/page.cpp @@ -15,9 +15,9 @@ namespace { } TMaybe<EFormat> ParseFormat(TStringBuf str) { - if (str == TStringBuf("json")) { + if (str == TStringBuf("json")) { return EFormat::JSON; - } else if (str == TStringBuf("spack")) { + } else if (str == TStringBuf("spack")) { return EFormat::SPACK; } else if (str == TStringBuf("prometheus")) { return EFormat::PROMETHEUS; @@ -46,7 +46,7 @@ void TDynamicCountersPage::Output(NMonitoring::IMonHttpRequest& request) { parts.pop_back(); } - if (!parts.empty() && parts.back() == TStringBuf("private")) { + if (!parts.empty() && parts.back() == TStringBuf("private")) { visibility = TCountableBase::EVisibility::Private; parts.pop_back(); } diff --git a/library/cpp/monlib/encode/format.cpp b/library/cpp/monlib/encode/format.cpp index d366b32681..400ce5a643 100644 --- a/library/cpp/monlib/encode/format.cpp +++ b/library/cpp/monlib/encode/format.cpp @@ -116,17 +116,17 @@ template <> NMonitoring::EFormat FromStringImpl<NMonitoring::EFormat>(const char* str, size_t len) { using NMonitoring::EFormat; TStringBuf value(str, len); - if (value == TStringBuf("SPACK")) { + if (value == TStringBuf("SPACK")) { return EFormat::SPACK; - } else if (value == TStringBuf("JSON")) { + } else if (value == TStringBuf("JSON")) { return EFormat::JSON; - } else if (value == TStringBuf("PROTOBUF")) { + } else if (value == TStringBuf("PROTOBUF")) { return EFormat::PROTOBUF; - } else if (value == TStringBuf("TEXT")) { + } else if (value == TStringBuf("TEXT")) { return EFormat::TEXT; - } else if (value == TStringBuf("PROMETHEUS")) { + } else if (value == TStringBuf("PROMETHEUS")) { return EFormat::PROMETHEUS; - } else if (value == TStringBuf("UNKNOWN")) { + } else if (value == TStringBuf("UNKNOWN")) { return EFormat::UNKNOWN; } ythrow yexception() << "unknown format: " << value; @@ -137,22 +137,22 @@ void Out<NMonitoring::EFormat>(IOutputStream& o, NMonitoring::EFormat f) { using NMonitoring::EFormat; switch (f) { case EFormat::SPACK: - o << TStringBuf("SPACK"); + o << TStringBuf("SPACK"); return; case EFormat::JSON: - o << TStringBuf("JSON"); + o << TStringBuf("JSON"); return; case EFormat::PROTOBUF: - o << TStringBuf("PROTOBUF"); + o << TStringBuf("PROTOBUF"); return; case EFormat::TEXT: - o << TStringBuf("TEXT"); + o << TStringBuf("TEXT"); return; case EFormat::PROMETHEUS: - o << TStringBuf("PROMETHEUS"); + o << TStringBuf("PROMETHEUS"); return; case EFormat::UNKNOWN: - o << TStringBuf("UNKNOWN"); + o << TStringBuf("UNKNOWN"); return; } @@ -163,15 +163,15 @@ template <> NMonitoring::ECompression FromStringImpl<NMonitoring::ECompression>(const char* str, size_t len) { using NMonitoring::ECompression; TStringBuf value(str, len); - if (value == TStringBuf("IDENTITY")) { + if (value == TStringBuf("IDENTITY")) { return ECompression::IDENTITY; - } else if (value == TStringBuf("ZLIB")) { + } else if (value == TStringBuf("ZLIB")) { return ECompression::ZLIB; - } else if (value == TStringBuf("LZ4")) { + } else if (value == TStringBuf("LZ4")) { return ECompression::LZ4; - } else if (value == TStringBuf("ZSTD")) { + } else if (value == TStringBuf("ZSTD")) { return ECompression::ZSTD; - } else if (value == TStringBuf("UNKNOWN")) { + } else if (value == TStringBuf("UNKNOWN")) { return ECompression::UNKNOWN; } ythrow yexception() << "unknown compression: " << value; @@ -182,19 +182,19 @@ void Out<NMonitoring::ECompression>(IOutputStream& o, NMonitoring::ECompression using NMonitoring::ECompression; switch (c) { case ECompression::IDENTITY: - o << TStringBuf("IDENTITY"); + o << TStringBuf("IDENTITY"); return; case ECompression::ZLIB: - o << TStringBuf("ZLIB"); + o << TStringBuf("ZLIB"); return; case ECompression::LZ4: - o << TStringBuf("LZ4"); + o << TStringBuf("LZ4"); return; case ECompression::ZSTD: - o << TStringBuf("ZSTD"); + o << TStringBuf("ZSTD"); return; case ECompression::UNKNOWN: - o << TStringBuf("UNKNOWN"); + o << TStringBuf("UNKNOWN"); return; } diff --git a/library/cpp/monlib/encode/format.h b/library/cpp/monlib/encode/format.h index d0e2143e3a..495d42d786 100644 --- a/library/cpp/monlib/encode/format.h +++ b/library/cpp/monlib/encode/format.h @@ -4,18 +4,18 @@ namespace NMonitoring { namespace NFormatContenType { - constexpr TStringBuf TEXT = "application/x-solomon-txt"; - constexpr TStringBuf JSON = "application/json"; - constexpr TStringBuf PROTOBUF = "application/x-solomon-pb"; - constexpr TStringBuf SPACK = "application/x-solomon-spack"; - constexpr TStringBuf PROMETHEUS = "text/plain"; + constexpr TStringBuf TEXT = "application/x-solomon-txt"; + constexpr TStringBuf JSON = "application/json"; + constexpr TStringBuf PROTOBUF = "application/x-solomon-pb"; + constexpr TStringBuf SPACK = "application/x-solomon-spack"; + constexpr TStringBuf PROMETHEUS = "text/plain"; } namespace NFormatContentEncoding { - constexpr TStringBuf IDENTITY = "identity"; - constexpr TStringBuf ZLIB = "zlib"; - constexpr TStringBuf LZ4 = "lz4"; - constexpr TStringBuf ZSTD = "zstd"; + constexpr TStringBuf IDENTITY = "identity"; + constexpr TStringBuf ZLIB = "zlib"; + constexpr TStringBuf LZ4 = "lz4"; + constexpr TStringBuf ZSTD = "zstd"; } /** diff --git a/library/cpp/monlib/encode/json/json_decoder.cpp b/library/cpp/monlib/encode/json/json_decoder.cpp index 8777caa021..d44ff5fd28 100644 --- a/library/cpp/monlib/encode/json/json_decoder.cpp +++ b/library/cpp/monlib/encode/json/json_decoder.cpp @@ -172,11 +172,11 @@ private: }; std::pair<double, bool> ParseSpecDouble(TStringBuf string) { - if (string == TStringBuf("nan") || string == TStringBuf("NaN")) { + if (string == TStringBuf("nan") || string == TStringBuf("NaN")) { return {std::numeric_limits<double>::quiet_NaN(), true}; - } else if (string == TStringBuf("inf") || string == TStringBuf("Infinity")) { + } else if (string == TStringBuf("inf") || string == TStringBuf("Infinity")) { return {std::numeric_limits<double>::infinity(), true}; - } else if (string == TStringBuf("-inf") || string == TStringBuf("-Infinity")) { + } else if (string == TStringBuf("-inf") || string == TStringBuf("-Infinity")) { return {-std::numeric_limits<double>::infinity(), true}; } else { return {0, false}; @@ -762,7 +762,7 @@ if (Y_UNLIKELY(!(CONDITION))) { \ break; case TState::METRIC_MODE: - if (value == TStringBuf("deriv")) { + if (value == TStringBuf("deriv")) { LastMetric_.Type = EMetricType::RATE; } State_.ToPrev(); @@ -814,11 +814,11 @@ if (Y_UNLIKELY(!(CONDITION))) { \ bool OnMapKey(const TStringBuf& key) override { switch (State_.Current()) { case TState::ROOT_OBJECT: - if (key == TStringBuf("commonLabels") || key == TStringBuf("labels")) { + if (key == TStringBuf("commonLabels") || key == TStringBuf("labels")) { State_.ToNext(TState::COMMON_LABELS); - } else if (key == TStringBuf("ts")) { + } else if (key == TStringBuf("ts")) { State_.ToNext(TState::COMMON_TS); - } else if (key == TStringBuf("sensors") || key == TStringBuf("metrics")) { + } else if (key == TStringBuf("sensors") || key == TStringBuf("metrics")) { State_.ToNext(TState::METRICS_ARRAY); } break; @@ -829,36 +829,36 @@ if (Y_UNLIKELY(!(CONDITION))) { \ break; case TState::METRIC_OBJECT: - if (key == TStringBuf("labels")) { + if (key == TStringBuf("labels")) { State_.ToNext(TState::METRIC_LABELS); } else if (key == TStringBuf("name")) { State_.ToNext(TState::METRIC_NAME); - } else if (key == TStringBuf("ts")) { + } else if (key == TStringBuf("ts")) { PARSE_ENSURE(!LastMetric_.SeenTimeseries, "mixed timeseries and ts attributes"); LastMetric_.SeenTsOrValue = true; State_.ToNext(TState::METRIC_TS); - } else if (key == TStringBuf("value")) { + } else if (key == TStringBuf("value")) { PARSE_ENSURE(!LastMetric_.SeenTimeseries, "mixed timeseries and value attributes"); LastMetric_.SeenTsOrValue = true; State_.ToNext(TState::METRIC_VALUE); - } else if (key == TStringBuf("timeseries")) { + } else if (key == TStringBuf("timeseries")) { PARSE_ENSURE(!LastMetric_.SeenTsOrValue, "mixed timeseries and ts/value attributes"); LastMetric_.SeenTimeseries = true; State_.ToNext(TState::METRIC_TIMESERIES); - } else if (key == TStringBuf("mode")) { + } else if (key == TStringBuf("mode")) { State_.ToNext(TState::METRIC_MODE); - } else if (key == TStringBuf("kind") || key == TStringBuf("type")) { + } else if (key == TStringBuf("kind") || key == TStringBuf("type")) { State_.ToNext(TState::METRIC_TYPE); - } else if (key == TStringBuf("hist")) { + } else if (key == TStringBuf("hist")) { State_.ToNext(TState::METRIC_HIST); - } else if (key == TStringBuf("summary")) { + } else if (key == TStringBuf("summary")) { State_.ToNext(TState::METRIC_DSUMMARY); - } else if (key == TStringBuf("log_hist")) { + } else if (key == TStringBuf("log_hist")) { State_.ToNext(TState::METRIC_LOG_HIST); - } else if (key == TStringBuf("memOnly")) { + } else if (key == TStringBuf("memOnly")) { // deprecated. Skip it without errors for backward compatibility } else { ErrorMsg_ = TStringBuilder() << "unexpected key \"" << key << "\" in a metric schema"; @@ -867,51 +867,51 @@ if (Y_UNLIKELY(!(CONDITION))) { \ break; case TState::METRIC_TIMESERIES: - if (key == TStringBuf("ts")) { + if (key == TStringBuf("ts")) { State_.ToNext(TState::METRIC_TS); - } else if (key == TStringBuf("value")) { + } else if (key == TStringBuf("value")) { State_.ToNext(TState::METRIC_VALUE); - } else if (key == TStringBuf("hist")) { + } else if (key == TStringBuf("hist")) { State_.ToNext(TState::METRIC_HIST); - } else if (key == TStringBuf("summary")) { + } else if (key == TStringBuf("summary")) { State_.ToNext(TState::METRIC_DSUMMARY); - } else if (key == TStringBuf("log_hist")) { + } else if (key == TStringBuf("log_hist")) { State_.ToNext(TState::METRIC_LOG_HIST); } break; case TState::METRIC_HIST: - if (key == TStringBuf("bounds")) { + if (key == TStringBuf("bounds")) { State_.ToNext(TState::METRIC_HIST_BOUNDS); - } else if (key == TStringBuf("buckets")) { + } else if (key == TStringBuf("buckets")) { State_.ToNext(TState::METRIC_HIST_BUCKETS); - } else if (key == TStringBuf("inf")) { + } else if (key == TStringBuf("inf")) { State_.ToNext(TState::METRIC_HIST_INF); } break; case TState::METRIC_LOG_HIST: - if (key == TStringBuf("base")) { + if (key == TStringBuf("base")) { State_.ToNext(TState::METRIC_LOG_HIST_BASE); - } else if (key == TStringBuf("zeros_count")) { + } else if (key == TStringBuf("zeros_count")) { State_.ToNext(TState::METRIC_LOG_HIST_ZEROS); - } else if (key == TStringBuf("start_power")) { + } else if (key == TStringBuf("start_power")) { State_.ToNext(TState::METRIC_LOG_HIST_START_POWER); - } else if (key == TStringBuf("buckets")) { + } else if (key == TStringBuf("buckets")) { State_.ToNext(TState::METRIC_LOG_HIST_BUCKETS); } break; case TState::METRIC_DSUMMARY: - if (key == TStringBuf("sum")) { + if (key == TStringBuf("sum")) { State_.ToNext(TState::METRIC_DSUMMARY_SUM); - } else if (key == TStringBuf("min")) { + } else if (key == TStringBuf("min")) { State_.ToNext(TState::METRIC_DSUMMARY_MIN); - } else if (key == TStringBuf("max")) { + } else if (key == TStringBuf("max")) { State_.ToNext(TState::METRIC_DSUMMARY_MAX); - } else if (key == TStringBuf("last")) { + } else if (key == TStringBuf("last")) { State_.ToNext(TState::METRIC_DSUMMARY_LAST); - } else if (key == TStringBuf("count")) { + } else if (key == TStringBuf("count")) { State_.ToNext(TState::METRIC_DSUMMARY_COUNT); } diff --git a/library/cpp/monlib/encode/json/json_decoder_ut.cpp b/library/cpp/monlib/encode/json/json_decoder_ut.cpp index 6c047f96e5..4464e1d26a 100644 --- a/library/cpp/monlib/encode/json/json_decoder_ut.cpp +++ b/library/cpp/monlib/encode/json/json_decoder_ut.cpp @@ -15,15 +15,15 @@ enum EJsonPart : ui8 { }; constexpr std::array<TStringBuf, 3> JSON_PARTS = { - TStringBuf(R"("metrics": [{ + TStringBuf(R"("metrics": [{ "labels": { "key": "value" }, "type": "GAUGE", "value": 123 }])"), - TStringBuf(R"("ts": 1)"), + TStringBuf(R"("ts": 1)"), - TStringBuf(R"("commonLabels": { + TStringBuf(R"("commonLabels": { "key1": "value1", "key2": "value2" })"), @@ -52,10 +52,10 @@ void ValidateCommonParts(TCommonParts&& commonParts, bool checkLabels, bool chec if (checkLabels) { auto& labels = commonParts.CommonLabels; UNIT_ASSERT_VALUES_EQUAL(labels.Size(), 2); - UNIT_ASSERT(labels.Has(TStringBuf("key1"))); - UNIT_ASSERT(labels.Has(TStringBuf("key2"))); - UNIT_ASSERT_VALUES_EQUAL(labels.Get(TStringBuf("key1")).value()->Value(), "value1"); - UNIT_ASSERT_VALUES_EQUAL(labels.Get(TStringBuf("key2")).value()->Value(), "value2"); + UNIT_ASSERT(labels.Has(TStringBuf("key1"))); + UNIT_ASSERT(labels.Has(TStringBuf("key2"))); + UNIT_ASSERT_VALUES_EQUAL(labels.Get(TStringBuf("key1")).value()->Value(), "value1"); + UNIT_ASSERT_VALUES_EQUAL(labels.Get(TStringBuf("key2")).value()->Value(), "value2"); } } diff --git a/library/cpp/monlib/encode/json/json_encoder.cpp b/library/cpp/monlib/encode/json/json_encoder.cpp index 7a6d6406e7..20d2bb6283 100644 --- a/library/cpp/monlib/encode/json/json_encoder.cpp +++ b/library/cpp/monlib/encode/json/json_encoder.cpp @@ -36,7 +36,7 @@ namespace NMonitoring { void WriteTime(TInstant time) { if (time != TInstant::Zero()) { - Buf_.WriteKey(TStringBuf("ts")); + Buf_.WriteKey(TStringBuf("ts")); if (Style_ == EJsonStyle::Solomon) { Buf_.WriteULongLong(time.Seconds()); } else { @@ -46,24 +46,24 @@ namespace NMonitoring { } void WriteValue(double value) { - Buf_.WriteKey(TStringBuf("value")); + Buf_.WriteKey(TStringBuf("value")); Buf_.WriteDouble(value); } void WriteValue(i64 value) { - Buf_.WriteKey(TStringBuf("value")); + Buf_.WriteKey(TStringBuf("value")); Buf_.WriteLongLong(value); } void WriteValue(ui64 value) { - Buf_.WriteKey(TStringBuf("value")); + Buf_.WriteKey(TStringBuf("value")); Buf_.WriteULongLong(value); } void WriteValue(IHistogramSnapshot* s) { Y_ENSURE(Style_ == EJsonStyle::Solomon); - Buf_.WriteKey(TStringBuf("hist")); + Buf_.WriteKey(TStringBuf("hist")); Buf_.BeginObject(); if (ui32 count = s->Count()) { bool hasInf = (s->UpperBound(count - 1) == Max<double>()); @@ -71,14 +71,14 @@ namespace NMonitoring { count--; } - Buf_.WriteKey(TStringBuf("bounds")); + Buf_.WriteKey(TStringBuf("bounds")); Buf_.BeginList(); for (ui32 i = 0; i < count; i++) { Buf_.WriteDouble(s->UpperBound(i)); } Buf_.EndList(); - Buf_.WriteKey(TStringBuf("buckets")); + Buf_.WriteKey(TStringBuf("buckets")); Buf_.BeginList(); for (ui32 i = 0; i < count; i++) { Buf_.WriteULongLong(s->Value(i)); @@ -86,7 +86,7 @@ namespace NMonitoring { Buf_.EndList(); if (hasInf) { - Buf_.WriteKey(TStringBuf("inf")); + Buf_.WriteKey(TStringBuf("inf")); Buf_.WriteULongLong(s->Value(count)); } } @@ -96,22 +96,22 @@ namespace NMonitoring { void WriteValue(ISummaryDoubleSnapshot* s) { Y_ENSURE(Style_ == EJsonStyle::Solomon); - Buf_.WriteKey(TStringBuf("summary")); + Buf_.WriteKey(TStringBuf("summary")); Buf_.BeginObject(); - Buf_.WriteKey(TStringBuf("sum")); + Buf_.WriteKey(TStringBuf("sum")); Buf_.WriteDouble(s->GetSum()); - Buf_.WriteKey(TStringBuf("min")); + Buf_.WriteKey(TStringBuf("min")); Buf_.WriteDouble(s->GetMin()); - Buf_.WriteKey(TStringBuf("max")); + Buf_.WriteKey(TStringBuf("max")); Buf_.WriteDouble(s->GetMax()); - Buf_.WriteKey(TStringBuf("last")); + Buf_.WriteKey(TStringBuf("last")); Buf_.WriteDouble(s->GetLast()); - Buf_.WriteKey(TStringBuf("count")); + Buf_.WriteKey(TStringBuf("count")); Buf_.WriteULongLong(s->GetCount()); Buf_.EndObject(); @@ -120,19 +120,19 @@ namespace NMonitoring { void WriteValue(TLogHistogramSnapshot* s) { Y_ENSURE(Style_ == EJsonStyle::Solomon); - Buf_.WriteKey(TStringBuf("log_hist")); + Buf_.WriteKey(TStringBuf("log_hist")); Buf_.BeginObject(); - Buf_.WriteKey(TStringBuf("base")); + Buf_.WriteKey(TStringBuf("base")); Buf_.WriteDouble(s->Base()); - Buf_.WriteKey(TStringBuf("zeros_count")); + Buf_.WriteKey(TStringBuf("zeros_count")); Buf_.WriteULongLong(s->ZerosCount()); - Buf_.WriteKey(TStringBuf("start_power")); + Buf_.WriteKey(TStringBuf("start_power")); Buf_.WriteInt(s->StartPower()); - Buf_.WriteKey(TStringBuf("buckets")); + Buf_.WriteKey(TStringBuf("buckets")); Buf_.BeginList(); for (size_t i = 0; i < s->Count(); ++i) { Buf_.WriteDouble(s->Bucket(i)); @@ -239,7 +239,7 @@ namespace NMonitoring { { } - ~TEncoderJson() override { + ~TEncoderJson() override { Close(); } @@ -303,7 +303,7 @@ namespace NMonitoring { Buf_.WriteKey(TStringBuf(Style_ == EJsonStyle::Solomon ? "commonLabels" : "labels")); } else if (State_ == TEncoderState::EState::METRIC) { State_ = TEncoderState::EState::METRIC_LABELS; - Buf_.WriteKey(TStringBuf("labels")); + Buf_.WriteKey(TStringBuf("labels")); } else { State_.ThrowInvalid("expected METRIC or ROOT"); } @@ -381,7 +381,7 @@ namespace NMonitoring { "mixed metric value types in one metric"); if (!TimeSeries_) { - Buf_.WriteKey(TStringBuf("timeseries")); + Buf_.WriteKey(TStringBuf("timeseries")); Buf_.BeginList(); Buf_.BeginObject(); Y_ENSURE(LastPoint_.GetTime() != TInstant::Zero(), @@ -426,7 +426,7 @@ namespace NMonitoring { MetricsMergingMode_ = EMetricsMergingMode::MERGE_METRICS; } - ~TBufferedJsonEncoder() override { + ~TBufferedJsonEncoder() override { Close(); } @@ -490,7 +490,7 @@ namespace NMonitoring { WriteMetricType(metric.MetricType); - Buf_.WriteKey(TStringBuf("labels")); + Buf_.WriteKey(TStringBuf("labels")); WriteLabels(metric.Labels, false); metric.TimeSeries.SortByTs(); @@ -499,7 +499,7 @@ namespace NMonitoring { WriteTime(point.GetTime()); WriteValue(metric.TimeSeries.GetValueType(), point.GetValue()); } else if (metric.TimeSeries.Size() > 1) { - Buf_.WriteKey(TStringBuf("timeseries")); + Buf_.WriteKey(TStringBuf("timeseries")); Buf_.BeginList(); metric.TimeSeries.ForEach([this](TInstant time, EMetricValueType type, TMetricValue value) { Buf_.BeginObject(); diff --git a/library/cpp/monlib/encode/legacy_protobuf/legacy_proto_decoder.cpp b/library/cpp/monlib/encode/legacy_protobuf/legacy_proto_decoder.cpp index f74cade8e8..f87a2d7e8f 100644 --- a/library/cpp/monlib/encode/legacy_protobuf/legacy_proto_decoder.cpp +++ b/library/cpp/monlib/encode/legacy_protobuf/legacy_proto_decoder.cpp @@ -163,10 +163,10 @@ namespace NMonitoring { TRACE("found fixed label " << l); } - EType Type() const override { + EType Type() const override { return EType::Fixed; } - TLabel Get(const NProtoBuf::Message&) override { + TLabel Get(const NProtoBuf::Message&) override { return Label_; } @@ -184,10 +184,10 @@ namespace NMonitoring { TRACE("found lazy label"); } - EType Type() const override { + EType Type() const override { return EType::Lazy; } - TLabel Get(const NProtoBuf::Message& msg) override { + TLabel Get(const NProtoBuf::Message& msg) override { return Fn_(msg); } @@ -289,7 +289,7 @@ namespace NMonitoring { TStringBuf lhs, rhs; const bool isDynamic = str.TrySplit(':', lhs, rhs); - const bool isIndexing = isDynamic && rhs == TStringBuf("#"); + const bool isIndexing = isDynamic && rhs == TStringBuf("#"); if (isIndexing) { TRACE("parsed index labels"); diff --git a/library/cpp/monlib/encode/prometheus/prometheus_decoder.cpp b/library/cpp/monlib/encode/prometheus/prometheus_decoder.cpp index 0cdecebcfa..7e81357dbd 100644 --- a/library/cpp/monlib/encode/prometheus/prometheus_decoder.cpp +++ b/library/cpp/monlib/encode/prometheus/prometheus_decoder.cpp @@ -22,7 +22,7 @@ namespace NMonitoring { namespace { - constexpr ui32 MAX_LABEL_VALUE_LEN = 256; + constexpr ui32 MAX_LABEL_VALUE_LEN = 256; using TLabelsMap = THashMap<TString, TString>; @@ -225,7 +225,7 @@ namespace NMonitoring { SkipSpaces(); TStringBuf keyword = ReadToken(); - if (keyword == TStringBuf("TYPE")) { + if (keyword == TStringBuf("TYPE")) { SkipSpaces(); TStringBuf nextName = ReadTokenAsMetricName(); @@ -561,11 +561,11 @@ namespace NMonitoring { } double ParseGoDouble(TStringBuf str) { - if (str == TStringBuf("+Inf")) { + if (str == TStringBuf("+Inf")) { return std::numeric_limits<double>::infinity(); - } else if (str == TStringBuf("-Inf")) { + } else if (str == TStringBuf("-Inf")) { return -std::numeric_limits<double>::infinity(); - } else if (str == TStringBuf("NaN")) { + } else if (str == TStringBuf("NaN")) { return NAN; } diff --git a/library/cpp/monlib/encode/prometheus/prometheus_encoder.cpp b/library/cpp/monlib/encode/prometheus/prometheus_encoder.cpp index 7eee2d709d..15efeb8c03 100644 --- a/library/cpp/monlib/encode/prometheus/prometheus_encoder.cpp +++ b/library/cpp/monlib/encode/prometheus/prometheus_encoder.cpp @@ -71,7 +71,7 @@ namespace NMonitoring { TBucketBound bound = h->UpperBound(i); TStringBuf boundStr; if (bound == HISTOGRAM_INF_BOUND) { - boundStr = TStringBuf("+Inf"); + boundStr = TStringBuf("+Inf"); } else { size_t len = FloatToString(bound, TmpBuf_, Y_ARRAY_SIZE(TmpBuf_)); boundStr = TStringBuf(TmpBuf_, len); diff --git a/library/cpp/monlib/encode/prometheus/prometheus_model.h b/library/cpp/monlib/encode/prometheus/prometheus_model.h index 377934f8b4..cb7f2cb15b 100644 --- a/library/cpp/monlib/encode/prometheus/prometheus_model.h +++ b/library/cpp/monlib/encode/prometheus/prometheus_model.h @@ -13,16 +13,16 @@ namespace NPrometheus { // and https://github.com/prometheus/common/blob/master/expfmt/text_parse.go // - inline constexpr TStringBuf BUCKET_SUFFIX = "_bucket"; - inline constexpr TStringBuf COUNT_SUFFIX = "_count"; - inline constexpr TStringBuf SUM_SUFFIX = "_sum"; - inline constexpr TStringBuf MIN_SUFFIX = "_min"; - inline constexpr TStringBuf MAX_SUFFIX = "_max"; - inline constexpr TStringBuf LAST_SUFFIX = "_last"; + inline constexpr TStringBuf BUCKET_SUFFIX = "_bucket"; + inline constexpr TStringBuf COUNT_SUFFIX = "_count"; + inline constexpr TStringBuf SUM_SUFFIX = "_sum"; + inline constexpr TStringBuf MIN_SUFFIX = "_min"; + inline constexpr TStringBuf MAX_SUFFIX = "_max"; + inline constexpr TStringBuf LAST_SUFFIX = "_last"; // Used for the label that defines the upper bound of a bucket of a // histogram ("le" -> "less or equal"). - inline constexpr TStringBuf BUCKET_LABEL = "le"; + inline constexpr TStringBuf BUCKET_LABEL = "le"; inline bool IsValidLabelNameStart(char ch) { diff --git a/library/cpp/monlib/encode/protobuf/protobuf_encoder.cpp b/library/cpp/monlib/encode/protobuf/protobuf_encoder.cpp index 1b4a1a23b4..2d11b9d5ba 100644 --- a/library/cpp/monlib/encode/protobuf/protobuf_encoder.cpp +++ b/library/cpp/monlib/encode/protobuf/protobuf_encoder.cpp @@ -213,7 +213,7 @@ namespace NMonitoring { FillHistogram(*snapshot, point->MutableHistogram()); } - void OnSummaryDouble(TInstant time, ISummaryDoubleSnapshotPtr snapshot) override { + void OnSummaryDouble(TInstant time, ISummaryDoubleSnapshotPtr snapshot) override { Y_ENSURE(Sample_, "metric not started"); NProto::TPoint* point = Sample_->AddPoints(); point->SetTime(time.MilliSeconds()); diff --git a/library/cpp/monlib/encode/spack/compression.cpp b/library/cpp/monlib/encode/spack/compression.cpp index d7223203ad..0d2152fc85 100644 --- a/library/cpp/monlib/encode/spack/compression.cpp +++ b/library/cpp/monlib/encode/spack/compression.cpp @@ -124,7 +124,7 @@ namespace NMonitoring { static size_t Compress(TBlock in, TBlock out) { size_t rc = ZSTD_compress(out.data(), out.size(), in.data(), in.size(), LEVEL); if (Y_UNLIKELY(ZSTD_isError(rc))) { - ythrow yexception() << TStringBuf("zstd compression failed: ") + ythrow yexception() << TStringBuf("zstd compression failed: ") << ZSTD_getErrorName(rc); } return rc; @@ -133,7 +133,7 @@ namespace NMonitoring { static void Decompress(TBlock in, TBlock out) { size_t rc = ZSTD_decompress(out.data(), out.size(), in.data(), in.size()); if (Y_UNLIKELY(ZSTD_isError(rc))) { - ythrow yexception() << TStringBuf("zstd decompression failed: ") + ythrow yexception() << TStringBuf("zstd decompression failed: ") << ZSTD_getErrorName(rc); } Y_ENSURE(rc == out.size(), "zstd decompressed wrong size"); @@ -249,7 +249,7 @@ namespace NMonitoring { { } - ~TFramedCompressStream() override { + ~TFramedCompressStream() override { try { Finish(); } catch (...) { diff --git a/library/cpp/monlib/encode/spack/spack_v1_encoder.cpp b/library/cpp/monlib/encode/spack/spack_v1_encoder.cpp index 7d5766d728..a2b0bb5f50 100644 --- a/library/cpp/monlib/encode/spack/spack_v1_encoder.cpp +++ b/library/cpp/monlib/encode/spack/spack_v1_encoder.cpp @@ -39,7 +39,7 @@ namespace NMonitoring { LabelValuesPool_.SetSorted(true); } - ~TEncoderSpackV1() override { + ~TEncoderSpackV1() override { Close(); } diff --git a/library/cpp/monlib/encode/text/text_encoder.cpp b/library/cpp/monlib/encode/text/text_encoder.cpp index e60caf2144..10336261f0 100644 --- a/library/cpp/monlib/encode/text/text_encoder.cpp +++ b/library/cpp/monlib/encode/text/text_encoder.cpp @@ -30,7 +30,7 @@ namespace NMonitoring { State_.Expect(TEncoderState::EState::ROOT); CommonTime_ = time; if (time != TInstant::Zero()) { - Out_->Write(TStringBuf("common time: ")); + Out_->Write(TStringBuf("common time: ")); WriteTime(time); Out_->Write('\n'); } @@ -62,7 +62,7 @@ namespace NMonitoring { State_ = TEncoderState::EState::METRIC; } else if (State_ == TEncoderState::EState::COMMON_LABELS) { State_ = TEncoderState::EState::ROOT; - Out_->Write(TStringBuf("common labels: ")); + Out_->Write(TStringBuf("common labels: ")); WriteLabels(); Out_->Write('\n'); } else { @@ -149,11 +149,11 @@ namespace NMonitoring { out << '{'; for (auto&& l : Labels_) { - out << l.Name() << TStringBuf("='") << l.Value() << '\''; + out << l.Name() << TStringBuf("='") << l.Value() << '\''; ++i; if (i < size) { - out << TStringBuf(", "); + out << TStringBuf(", "); } }; @@ -166,7 +166,7 @@ namespace NMonitoring { (*Out_) << LeftPad(typeStr, MaxMetricTypeNameLength) << ' '; // (2) name and labels - auto name = Labels_.Extract(TStringBuf("sensor")); + auto name = Labels_.Extract(TStringBuf("sensor")); if (name) { if (name->Value().find(' ') != TString::npos) { (*Out_) << '"' << name->Value() << '"'; @@ -179,10 +179,10 @@ namespace NMonitoring { // (3) values if (!TimeSeries_.Empty()) { TimeSeries_.SortByTs(); - Out_->Write(TStringBuf(" [")); + Out_->Write(TStringBuf(" [")); for (size_t i = 0; i < TimeSeries_.Size(); i++) { if (i > 0) { - Out_->Write(TStringBuf(", ")); + Out_->Write(TStringBuf(", ")); } const auto& point = TimeSeries_[i]; @@ -191,7 +191,7 @@ namespace NMonitoring { } else { Out_->Write('('); WriteTime(point.GetTime()); - Out_->Write(TStringBuf(", ")); + Out_->Write(TStringBuf(", ")); WriteValue(TimeSeries_.GetValueType(), point.GetValue()); Out_->Write(')'); } diff --git a/library/cpp/monlib/encode/unistat/unistat_decoder.cpp b/library/cpp/monlib/encode/unistat/unistat_decoder.cpp index 7497ae1f79..b2344b0905 100644 --- a/library/cpp/monlib/encode/unistat/unistat_decoder.cpp +++ b/library/cpp/monlib/encode/unistat/unistat_decoder.cpp @@ -156,9 +156,9 @@ namespace NMonitoring { Y_ENSURE(suffix.size() >= 3 && suffix.size() <= 5, "Disallowed suffix value: " << suffix); - if (suffix == TStringBuf("summ") || suffix == TStringBuf("hgram")) { + if (suffix == TStringBuf("summ") || suffix == TStringBuf("hgram")) { return true; - } else if (suffix == TStringBuf("max")) { + } else if (suffix == TStringBuf("max")) { return false; } diff --git a/library/cpp/monlib/encode/unistat/unistat_ut.cpp b/library/cpp/monlib/encode/unistat/unistat_ut.cpp index 7da071a587..dbbc238bf3 100644 --- a/library/cpp/monlib/encode/unistat/unistat_ut.cpp +++ b/library/cpp/monlib/encode/unistat/unistat_ut.cpp @@ -9,7 +9,7 @@ using namespace NMonitoring; Y_UNIT_TEST_SUITE(TUnistatDecoderTest) { Y_UNIT_TEST(ScalarMetric) { - constexpr auto input = TStringBuf(R"([["something_axxx", 42]])"); + constexpr auto input = TStringBuf(R"([["something_axxx", 42]])"); NProto::TMultiSamplesList samples; auto encoder = EncoderProtobuf(&samples); @@ -57,7 +57,7 @@ Y_UNIT_TEST_SUITE(TUnistatDecoderTest) { } Y_UNIT_TEST(ThrowsOnTopLevelObject) { - constexpr auto input = TStringBuf(R"({["something_axxx", 42]})"); + constexpr auto input = TStringBuf(R"({["something_axxx", 42]})"); NProto::TMultiSamplesList samples; auto encoder = EncoderProtobuf(&samples); @@ -66,7 +66,7 @@ Y_UNIT_TEST_SUITE(TUnistatDecoderTest) { } Y_UNIT_TEST(ThrowsOnUnwrappedMetric) { - constexpr auto input = TStringBuf(R"(["something_axxx", 42])"); + constexpr auto input = TStringBuf(R"(["something_axxx", 42])"); NProto::TMultiSamplesList samples; auto encoder = EncoderProtobuf(&samples); @@ -75,7 +75,7 @@ Y_UNIT_TEST_SUITE(TUnistatDecoderTest) { } Y_UNIT_TEST(HistogramMetric) { - constexpr auto input = TStringBuf(R"([["something_hgram", [[0, 1], [200, 2], [500, 3]] ]])"); + constexpr auto input = TStringBuf(R"([["something_hgram", [[0, 1], [200, 2], [500, 3]] ]])"); NProto::TMultiSamplesList samples; auto encoder = EncoderProtobuf(&samples); @@ -106,7 +106,7 @@ Y_UNIT_TEST_SUITE(TUnistatDecoderTest) { } Y_UNIT_TEST(AbsoluteHistogram) { - constexpr auto input = TStringBuf(R"([["something_ahhh", [[0, 1], [200, 2], [500, 3]] ]])"); + constexpr auto input = TStringBuf(R"([["something_ahhh", [[0, 1], [200, 2], [500, 3]] ]])"); NProto::TMultiSamplesList samples; auto encoder = EncoderProtobuf(&samples); @@ -134,23 +134,23 @@ Y_UNIT_TEST_SUITE(TUnistatDecoderTest) { auto encoder = EncoderProtobuf(&samples); { - constexpr auto input = TStringBuf(R"([["someth!ng_ahhh", [[0, 1], [200, 2], [500, 3]] ]])"); + constexpr auto input = TStringBuf(R"([["someth!ng_ahhh", [[0, 1], [200, 2], [500, 3]] ]])"); UNIT_ASSERT_EXCEPTION(DecodeUnistat(input, encoder.Get()), yexception); } { - constexpr auto input = TStringBuf(R"([["foo_a", [[0, 1], [200, 2], [500, 3]] ]])"); + constexpr auto input = TStringBuf(R"([["foo_a", [[0, 1], [200, 2], [500, 3]] ]])"); UNIT_ASSERT_EXCEPTION(DecodeUnistat(input, encoder.Get()), yexception); } { - constexpr auto input = TStringBuf(R"([["foo_ahhh;tag=value", [[0, 1], [200, 2], [500, 3]] ]])"); + constexpr auto input = TStringBuf(R"([["foo_ahhh;tag=value", [[0, 1], [200, 2], [500, 3]] ]])"); UNIT_ASSERT_EXCEPTION(DecodeUnistat(input, encoder.Get()), yexception); } } Y_UNIT_TEST(MultipleMetrics) { - constexpr auto input = TStringBuf(R"([["something_axxx", 42], ["some-other_dhhh", 53]])"); + constexpr auto input = TStringBuf(R"([["something_axxx", 42], ["some-other_dhhh", 53]])"); NProto::TMultiSamplesList samples; auto encoder = EncoderProtobuf(&samples); @@ -182,7 +182,7 @@ Y_UNIT_TEST_SUITE(TUnistatDecoderTest) { } Y_UNIT_TEST(UnderscoreName) { - constexpr auto input = TStringBuf(R"([["something_anything_dmmm", 42]])"); + constexpr auto input = TStringBuf(R"([["something_anything_dmmm", 42]])"); NProto::TMultiSamplesList samples; auto encoder = EncoderProtobuf(&samples); @@ -202,7 +202,7 @@ Y_UNIT_TEST_SUITE(TUnistatDecoderTest) { } Y_UNIT_TEST(MaxAggr) { - constexpr auto input = TStringBuf(R"([["something_anything_max", 42]])"); + constexpr auto input = TStringBuf(R"([["something_anything_max", 42]])"); NProto::TMultiSamplesList samples; auto encoder = EncoderProtobuf(&samples); diff --git a/library/cpp/monlib/metrics/ewma.cpp b/library/cpp/monlib/metrics/ewma.cpp index 1c170ff394..8a296c3225 100644 --- a/library/cpp/monlib/metrics/ewma.cpp +++ b/library/cpp/monlib/metrics/ewma.cpp @@ -22,7 +22,7 @@ namespace { Y_VERIFY(metric != nullptr, "Passing nullptr metric is not allowed"); } - ~TExpMovingAverage() override = default; + ~TExpMovingAverage() override = default; // This method NOT thread safe void Tick() override { diff --git a/library/cpp/monlib/metrics/histogram_snapshot.cpp b/library/cpp/monlib/metrics/histogram_snapshot.cpp index 488505b1cc..75b5811546 100644 --- a/library/cpp/monlib/metrics/histogram_snapshot.cpp +++ b/library/cpp/monlib/metrics/histogram_snapshot.cpp @@ -28,25 +28,25 @@ namespace { template <typename TStream> auto& Output(TStream& os, const NMonitoring::IHistogramSnapshot& hist) { - os << TStringBuf("{"); + os << TStringBuf("{"); ui32 i = 0; ui32 count = hist.Count(); if (count > 0) { for (; i < count - 1; ++i) { - os << hist.UpperBound(i) << TStringBuf(": ") << hist.Value(i); - os << TStringBuf(", "); + os << hist.UpperBound(i) << TStringBuf(": ") << hist.Value(i); + os << TStringBuf(", "); } if (hist.UpperBound(i) == Max<NMonitoring::TBucketBound>()) { - os << TStringBuf("inf: ") << hist.Value(i); + os << TStringBuf("inf: ") << hist.Value(i); } else { - os << hist.UpperBound(i) << TStringBuf(": ") << hist.Value(i); + os << hist.UpperBound(i) << TStringBuf(": ") << hist.Value(i); } } - os << TStringBuf("}"); + os << TStringBuf("}"); return os; } diff --git a/library/cpp/monlib/metrics/labels.cpp b/library/cpp/monlib/metrics/labels.cpp index 1beeb00ad1..1eaadb7cba 100644 --- a/library/cpp/monlib/metrics/labels.cpp +++ b/library/cpp/monlib/metrics/labels.cpp @@ -8,7 +8,7 @@ static void OutputLabels(IOutputStream& out, const NMonitoring::ILabels& labels) out << '{'; for (const auto& label: labels) { if (i++ > 0) { - out << TStringBuf(", "); + out << TStringBuf(", "); } out << label; } diff --git a/library/cpp/monlib/metrics/labels_ut.cpp b/library/cpp/monlib/metrics/labels_ut.cpp index e1a4f0c392..f0e4f532ab 100644 --- a/library/cpp/monlib/metrics/labels_ut.cpp +++ b/library/cpp/monlib/metrics/labels_ut.cpp @@ -93,9 +93,9 @@ Y_UNIT_TEST_SUITE(TLabelsTest) { Y_UNIT_TEST(Labels) { TLabels labels; - UNIT_ASSERT(labels.Add(TStringBuf("name1"), TStringBuf("value1"))); + UNIT_ASSERT(labels.Add(TStringBuf("name1"), TStringBuf("value1"))); UNIT_ASSERT(labels.Size() == 1); - UNIT_ASSERT(labels.Has(TStringBuf("name1"))); + UNIT_ASSERT(labels.Has(TStringBuf("name1"))); { auto l = labels.Find("name1"); UNIT_ASSERT(l.Defined()); @@ -108,12 +108,12 @@ Y_UNIT_TEST_SUITE(TLabelsTest) { } // duplicated name - UNIT_ASSERT(!labels.Add(TStringBuf("name1"), TStringBuf("value2"))); + UNIT_ASSERT(!labels.Add(TStringBuf("name1"), TStringBuf("value2"))); UNIT_ASSERT(labels.Size() == 1); - UNIT_ASSERT(labels.Add(TStringBuf("name2"), TStringBuf("value2"))); + UNIT_ASSERT(labels.Add(TStringBuf("name2"), TStringBuf("value2"))); UNIT_ASSERT(labels.Size() == 2); - UNIT_ASSERT(labels.Has(TStringBuf("name2"))); + UNIT_ASSERT(labels.Has(TStringBuf("name2"))); { auto l = labels.Find("name2"); UNIT_ASSERT(l.Defined()); diff --git a/library/cpp/monlib/metrics/log_histogram_snapshot.cpp b/library/cpp/monlib/metrics/log_histogram_snapshot.cpp index fae201f269..21cf2ca2bb 100644 --- a/library/cpp/monlib/metrics/log_histogram_snapshot.cpp +++ b/library/cpp/monlib/metrics/log_histogram_snapshot.cpp @@ -9,16 +9,16 @@ namespace { template <typename TStream> auto& Output(TStream& o, const NMonitoring::TLogHistogramSnapshot& hist) { - o << TStringBuf("{"); + o << TStringBuf("{"); for (auto i = 0u; i < hist.Count(); ++i) { - o << hist.UpperBound(i) << TStringBuf(": ") << hist.Bucket(i); - o << TStringBuf(", "); + o << hist.UpperBound(i) << TStringBuf(": ") << hist.Bucket(i); + o << TStringBuf(", "); } - o << TStringBuf("zeros: ") << hist.ZerosCount(); + o << TStringBuf("zeros: ") << hist.ZerosCount(); - o << TStringBuf("}"); + o << TStringBuf("}"); return o; } diff --git a/library/cpp/monlib/metrics/metric_type.cpp b/library/cpp/monlib/metrics/metric_type.cpp index ca1d32f7c6..a8a546e843 100644 --- a/library/cpp/monlib/metrics/metric_type.cpp +++ b/library/cpp/monlib/metrics/metric_type.cpp @@ -8,42 +8,42 @@ namespace NMonitoring { TStringBuf MetricTypeToStr(EMetricType type) { switch (type) { case EMetricType::GAUGE: - return TStringBuf("GAUGE"); + return TStringBuf("GAUGE"); case EMetricType::COUNTER: - return TStringBuf("COUNTER"); + return TStringBuf("COUNTER"); case EMetricType::RATE: - return TStringBuf("RATE"); + return TStringBuf("RATE"); case EMetricType::IGAUGE: - return TStringBuf("IGAUGE"); + return TStringBuf("IGAUGE"); case EMetricType::HIST: - return TStringBuf("HIST"); + return TStringBuf("HIST"); case EMetricType::HIST_RATE: - return TStringBuf("HIST_RATE"); + return TStringBuf("HIST_RATE"); case EMetricType::DSUMMARY: - return TStringBuf("DSUMMARY"); + return TStringBuf("DSUMMARY"); case EMetricType::LOGHIST: - return TStringBuf("LOGHIST"); + return TStringBuf("LOGHIST"); default: - return TStringBuf("UNKNOWN"); + return TStringBuf("UNKNOWN"); } } EMetricType MetricTypeFromStr(TStringBuf str) { - if (str == TStringBuf("GAUGE") || str == TStringBuf("DGAUGE")) { + if (str == TStringBuf("GAUGE") || str == TStringBuf("DGAUGE")) { return EMetricType::GAUGE; - } else if (str == TStringBuf("COUNTER")) { + } else if (str == TStringBuf("COUNTER")) { return EMetricType::COUNTER; - } else if (str == TStringBuf("RATE")) { + } else if (str == TStringBuf("RATE")) { return EMetricType::RATE; - } else if (str == TStringBuf("IGAUGE")) { + } else if (str == TStringBuf("IGAUGE")) { return EMetricType::IGAUGE; - } else if (str == TStringBuf("HIST")) { + } else if (str == TStringBuf("HIST")) { return EMetricType::HIST; - } else if (str == TStringBuf("HIST_RATE")) { + } else if (str == TStringBuf("HIST_RATE")) { return EMetricType::HIST_RATE; - } else if (str == TStringBuf("DSUMMARY")) { + } else if (str == TStringBuf("DSUMMARY")) { return EMetricType::DSUMMARY; - } else if (str == TStringBuf("LOGHIST")) { + } else if (str == TStringBuf("LOGHIST")) { return EMetricType::LOGHIST; } else { ythrow yexception() << "unknown metric type: " << str; diff --git a/library/cpp/monlib/metrics/summary_snapshot.cpp b/library/cpp/monlib/metrics/summary_snapshot.cpp index 7d90846bfe..0b13263337 100644 --- a/library/cpp/monlib/metrics/summary_snapshot.cpp +++ b/library/cpp/monlib/metrics/summary_snapshot.cpp @@ -9,15 +9,15 @@ namespace { template <typename TStream> auto& Output(TStream& o, const NMonitoring::ISummaryDoubleSnapshot& s) { - o << TStringBuf("{"); + o << TStringBuf("{"); - o << TStringBuf("sum: ") << s.GetSum() << TStringBuf(", "); - o << TStringBuf("min: ") << s.GetMin() << TStringBuf(", "); - o << TStringBuf("max: ") << s.GetMax() << TStringBuf(", "); - o << TStringBuf("last: ") << s.GetLast() << TStringBuf(", "); - o << TStringBuf("count: ") << s.GetCount(); + o << TStringBuf("sum: ") << s.GetSum() << TStringBuf(", "); + o << TStringBuf("min: ") << s.GetMin() << TStringBuf(", "); + o << TStringBuf("max: ") << s.GetMax() << TStringBuf(", "); + o << TStringBuf("last: ") << s.GetLast() << TStringBuf(", "); + o << TStringBuf("count: ") << s.GetCount(); - o << TStringBuf("}"); + o << TStringBuf("}"); return o; } diff --git a/library/cpp/monlib/service/format.h b/library/cpp/monlib/service/format.h index 5eb3261966..0044b586b1 100644 --- a/library/cpp/monlib/service/format.h +++ b/library/cpp/monlib/service/format.h @@ -21,9 +21,9 @@ namespace NMonitoring { auto it = FindIf(std::begin(headers), std::end(headers), [=] (const auto& h) { if constexpr (NPrivate::THasName<std::decay_t<decltype(h)>>::value) { - return AsciiCompareIgnoreCase(h.Name(), TStringBuf("accept-encoding")) == 0; + return AsciiCompareIgnoreCase(h.Name(), TStringBuf("accept-encoding")) == 0; } else if (isPlainPair) { - return AsciiCompareIgnoreCase(h.first, TStringBuf("accept-encoding")) == 0; + return AsciiCompareIgnoreCase(h.first, TStringBuf("accept-encoding")) == 0; } }); @@ -46,14 +46,14 @@ namespace NMonitoring { template <typename TRequest> NMonitoring::EFormat ParseFormat(const TRequest& req) { auto&& formatStr = req.GetParams() - .Get(TStringBuf("format")); + .Get(TStringBuf("format")); if (!formatStr.empty()) { - if (formatStr == TStringBuf("SPACK")) { + if (formatStr == TStringBuf("SPACK")) { return EFormat::SPACK; - } else if (formatStr == TStringBuf("TEXT")) { + } else if (formatStr == TStringBuf("TEXT")) { return EFormat::TEXT; - } else if (formatStr == TStringBuf("JSON")) { + } else if (formatStr == TStringBuf("JSON")) { return EFormat::JSON; } else { ythrow yexception() << "unknown format: " << formatStr << ". Only spack is supported here"; @@ -66,9 +66,9 @@ namespace NMonitoring { auto it = FindIf(std::begin(headers), std::end(headers), [=] (const auto& h) { if constexpr (NPrivate::THasName<std::decay_t<decltype(h)>>::value) { - return AsciiCompareIgnoreCase(h.Name(), TStringBuf("accept")) == 0; + return AsciiCompareIgnoreCase(h.Name(), TStringBuf("accept")) == 0; } else if (isPlainPair) { - return AsciiCompareIgnoreCase(h.first, TStringBuf("accept")) == 0; + return AsciiCompareIgnoreCase(h.first, TStringBuf("accept")) == 0; } }); diff --git a/library/cpp/monlib/service/pages/index_mon_page.cpp b/library/cpp/monlib/service/pages/index_mon_page.cpp index 3e2db86b9e..83ff8b529a 100644 --- a/library/cpp/monlib/service/pages/index_mon_page.cpp +++ b/library/cpp/monlib/service/pages/index_mon_page.cpp @@ -15,7 +15,7 @@ void TIndexMonPage::OutputIndexPage(IMonHttpRequest& request) { void TIndexMonPage::Output(IMonHttpRequest& request) { TStringBuf pathInfo = request.GetPathInfo(); - if (pathInfo.empty() || pathInfo == TStringBuf("/")) { + if (pathInfo.empty() || pathInfo == TStringBuf("/")) { OutputIndexPage(request); return; } diff --git a/library/cpp/monlib/service/pages/registry_mon_page.cpp b/library/cpp/monlib/service/pages/registry_mon_page.cpp index ecdba2e827..c59e50f622 100644 --- a/library/cpp/monlib/service/pages/registry_mon_page.cpp +++ b/library/cpp/monlib/service/pages/registry_mon_page.cpp @@ -15,10 +15,10 @@ namespace NMonitoring { IMetricEncoderPtr encoder; TString resp; - if (formatStr == TStringBuf("json")) { + if (formatStr == TStringBuf("json")) { resp = HTTPOKJSON; encoder = NMonitoring::EncoderJson(&out); - } else if (formatStr == TStringBuf("spack")) { + } else if (formatStr == TStringBuf("spack")) { resp = HTTPOKSPACK; const auto compression = ParseCompression(request); encoder = NMonitoring::EncoderSpackV1(&out, ETimePrecision::SECONDS, compression); |