diff options
author | babenko <babenko@yandex-team.com> | 2024-09-03 17:25:07 +0300 |
---|---|---|
committer | babenko <babenko@yandex-team.com> | 2024-09-03 17:38:52 +0300 |
commit | 89322edaa0af5b108223a6ff6533b44456fa1d56 (patch) | |
tree | f465c197cb6c8ee95553d941757ed3f9be817cf5 | |
parent | 4a23bc2f0f1ebf6cfcf1bae08e95f55f759c9b22 (diff) | |
download | ydb-89322edaa0af5b108223a6ff6533b44456fa1d56.tar.gz |
YT-22593: Switch library/profiling to std::string (mostly) [TRIVIAL]
94b9b076c06ea42ab4700d70c26a95b517c98783
31 files changed, 258 insertions, 256 deletions
diff --git a/yt/yt/core/concurrency/unittests/fair_share_action_queue_ut.cpp b/yt/yt/core/concurrency/unittests/fair_share_action_queue_ut.cpp index 1d948a187d..a60ae66765 100644 --- a/yt/yt/core/concurrency/unittests/fair_share_action_queue_ut.cpp +++ b/yt/yt/core/concurrency/unittests/fair_share_action_queue_ut.cpp @@ -45,7 +45,7 @@ public: WaitFor(BIND(std::forward<F>(func)).AsyncVia(invoker).Run()).ThrowOnError(); } - auto GetSensors(TString json) + auto GetSensors(std::string json) { for (auto& c : json) { if (c == ':') { @@ -65,7 +65,7 @@ public: } template <class EQueues, class EBuckets> - void VerifyJson(TString json, THashMap<EBuckets, std::vector<EQueues>> bucketToQueues) + void VerifyJson(const std::string& json, THashMap<EBuckets, std::vector<EQueues>> bucketToQueues) { TEnumIndexedArray<EQueues, int> enqueuedPerQueue; TEnumIndexedArray<EBuckets, int> enqueuedPerBucket; @@ -141,8 +141,8 @@ TEST_F(TTestFairShareActionQueue, TestProfiling) auto registry = New<TSolomonRegistry>(); THashMap<EBuckets, std::vector<EQueues>> bucketToQueues{}; - bucketToQueues[EBuckets::Bucket1] = std::vector{EQueues::Queue1, EQueues::Queue2}; - bucketToQueues[EBuckets::Bucket2] = std::vector{EQueues::Queue3}; + bucketToQueues[EBuckets::Bucket1] = {EQueues::Queue1, EQueues::Queue2}; + bucketToQueues[EBuckets::Bucket2] = {EQueues::Queue3}; auto queue = CreateEnumIndexedFairShareActionQueue<EQueues>("ActionQueue", bucketToQueues, registry); auto config = CreateExporterConfig(); diff --git a/yt/yt/core/concurrency/unittests/profiled_fair_share_invoker_pool_ut.cpp b/yt/yt/core/concurrency/unittests/profiled_fair_share_invoker_pool_ut.cpp index 6aab403a3e..f7c7604453 100644 --- a/yt/yt/core/concurrency/unittests/profiled_fair_share_invoker_pool_ut.cpp +++ b/yt/yt/core/concurrency/unittests/profiled_fair_share_invoker_pool_ut.cpp @@ -666,7 +666,7 @@ public: WaitFor(BIND(std::forward<F>(func)).AsyncVia(invoker).Run()).ThrowOnError(); } - auto GetSensors(TString json) + auto GetSensors(std::string json) { auto yson = NYson::TYsonString(NJson2Yson::SerializeJsonValueAsYson(NJson::ReadJsonFastTree(json))); diff --git a/yt/yt/library/profiling/example/main.cpp b/yt/yt/library/profiling/example/main.cpp index ad16fd7169..99676e4a12 100644 --- a/yt/yt/library/profiling/example/main.cpp +++ b/yt/yt/library/profiling/example/main.cpp @@ -40,7 +40,7 @@ int main(int argc, char* argv[]) } auto port = FromString<int>(argv[1]); - auto fast = TString{"--fast"} == TString{argv[2]}; + auto fast = std::string{"--fast"} == std::string{argv[2]}; auto poller = CreateThreadPoolPoller(1, "Example"); auto server = CreateServer(port, poller); auto actionQueue = New<TActionQueue>("Control"); diff --git a/yt/yt/library/profiling/impl.h b/yt/yt/library/profiling/impl.h index 59f0b25ce7..8985a7d244 100644 --- a/yt/yt/library/profiling/impl.h +++ b/yt/yt/library/profiling/impl.h @@ -16,84 +16,84 @@ struct IRegistryImpl { public: virtual ICounterImplPtr RegisterCounter( - const TString& name, + const std::string& name, const TTagSet& tags, TSensorOptions options) = 0; virtual ITimeCounterImplPtr RegisterTimeCounter( - const TString& name, + const std::string& name, const TTagSet& tags, TSensorOptions options) = 0; virtual IGaugeImplPtr RegisterGauge( - const TString& name, + const std::string& name, const TTagSet& tags, TSensorOptions options) = 0; virtual ITimeGaugeImplPtr RegisterTimeGauge( - const TString& name, + const std::string& name, const TTagSet& tags, TSensorOptions options) = 0; virtual ISummaryImplPtr RegisterSummary( - const TString& name, + const std::string& name, const TTagSet& tags, TSensorOptions options) = 0; virtual IGaugeImplPtr RegisterGaugeSummary( - const TString& name, + const std::string& name, const TTagSet& tags, TSensorOptions options) = 0; virtual ITimeGaugeImplPtr RegisterTimeGaugeSummary( - const TString& name, + const std::string& name, const TTagSet& tags, TSensorOptions options) = 0; virtual ITimerImplPtr RegisterTimerSummary( - const TString& name, + const std::string& name, const TTagSet& tags, TSensorOptions options) = 0; virtual ITimerImplPtr RegisterTimeHistogram( - const TString& name, + const std::string& name, const TTagSet& tags, TSensorOptions options) = 0; virtual IHistogramImplPtr RegisterGaugeHistogram( - const TString& name, + const std::string& name, const TTagSet& tags, TSensorOptions options) = 0; virtual IHistogramImplPtr RegisterRateHistogram( - const TString& name, + const std::string& name, const TTagSet& tags, TSensorOptions options) = 0; virtual void RegisterFuncCounter( - const TString& name, + const std::string& name, const TTagSet& tags, TSensorOptions options, const TRefCountedPtr& owner, std::function<i64()> reader) = 0; virtual void RegisterFuncGauge( - const TString& name, + const std::string& name, const TTagSet& tags, TSensorOptions options, const TRefCountedPtr& owner, std::function<double()> reader) = 0; virtual void RegisterProducer( - const TString& prefix, + const std::string& prefix, const TTagSet& tags, TSensorOptions options, const ISensorProducerPtr& owner) = 0; virtual void RenameDynamicTag( const TDynamicTagPtr& tag, - const TString& name, - const TString& value) = 0; + const std::string& name, + const std::string& value) = 0; }; DEFINE_REFCOUNTED_TYPE(IRegistryImpl) diff --git a/yt/yt/library/profiling/perf/counters.cpp b/yt/yt/library/profiling/perf/counters.cpp index f5f5455725..ee9af81387 100644 --- a/yt/yt/library/profiling/perf/counters.cpp +++ b/yt/yt/library/profiling/perf/counters.cpp @@ -224,7 +224,7 @@ void EnablePerfCounters() { auto owner = LeakyRefCountedSingleton<TCounterOwner>(); - auto exportCounter = [&] (const TString& category, const TString& name, EPerfEventType type) { + auto exportCounter = [&] (const std::string& category, const std::string& name, EPerfEventType type) { try { owner->Counters.emplace_back(new TPerfEventCounter{type}); TProfiler{category}.AddFuncCounter(name, owner, [counter=owner->Counters.back().get()] { diff --git a/yt/yt/library/profiling/producer.cpp b/yt/yt/library/profiling/producer.cpp index a224837c06..9c2b2e8bb2 100644 --- a/yt/yt/library/profiling/producer.cpp +++ b/yt/yt/library/profiling/producer.cpp @@ -14,10 +14,10 @@ TWithTagGuard::TWithTagGuard(ISensorWriter* writer) YT_VERIFY(Writer_); } -TWithTagGuard::TWithTagGuard(ISensorWriter* writer, TString tagKey, TString tagValue) +TWithTagGuard::TWithTagGuard(ISensorWriter* writer, const std::string& tagKey, const std::string& tagValue) : TWithTagGuard(writer) { - AddTag(std::move(tagKey), std::move(tagValue)); + AddTag(tagKey, tagValue); } void TWithTagGuard::AddTag(TTag tag) @@ -26,9 +26,9 @@ void TWithTagGuard::AddTag(TTag tag) ++AddedTagCount_; } -void TWithTagGuard::AddTag(TString tagKey, TString tagValue) +void TWithTagGuard::AddTag(const std::string& tagKey, const std::string& tagValue) { - AddTag({std::move(tagKey), std::move(tagValue)}); + AddTag({tagKey, tagValue}); } TWithTagGuard::~TWithTagGuard() @@ -50,22 +50,22 @@ void TSensorBuffer::PopTag() Tags_.pop_back(); } -void TSensorBuffer::AddGauge(const TString& name, double value) +void TSensorBuffer::AddGauge(const std::string& name, double value) { Gauges_.emplace_back(name, Tags_, value); } -void TSensorBuffer::AddCounter(const TString& name, i64 value) +void TSensorBuffer::AddCounter(const std::string& name, i64 value) { Counters_.emplace_back(name, Tags_, value); } -const std::vector<std::tuple<TString, TTagList, i64>>& TSensorBuffer::GetCounters() const +const std::vector<std::tuple<std::string, TTagList, i64>>& TSensorBuffer::GetCounters() const { return Counters_; } -const std::vector<std::tuple<TString, TTagList, double>>& TSensorBuffer::GetGauges() const +const std::vector<std::tuple<std::string, TTagList, double>>& TSensorBuffer::GetGauges() const { return Gauges_; } diff --git a/yt/yt/library/profiling/producer.h b/yt/yt/library/profiling/producer.h index d71a80c03f..e583f980d9 100644 --- a/yt/yt/library/profiling/producer.h +++ b/yt/yt/library/profiling/producer.h @@ -20,13 +20,13 @@ struct ISensorWriter virtual void PushTag(TTag tag) = 0; virtual void PopTag() = 0; - virtual void AddGauge(const TString& name, double value) = 0; + virtual void AddGauge(const std::string& name, double value) = 0; //! AddCounter emits single counter value. /*! * #value MUST be monotonically increasing. */ - virtual void AddCounter(const TString& name, i64 value) = 0; + virtual void AddCounter(const std::string& name, i64 value) = 0; }; //////////////////////////////////////////////////////////////////////////////// @@ -42,12 +42,12 @@ public: explicit TWithTagGuard(ISensorWriter* writer); // NB: For convenience. [[nodiscard]] - TWithTagGuard(ISensorWriter* writer, TString tagKey, TString tagValue); + TWithTagGuard(ISensorWriter* writer, const std::string& tagKey, const std::string& tagValue); ~TWithTagGuard(); void AddTag(TTag tag); - void AddTag(TString tagKey, TString tagValue); + void AddTag(const std::string& tagKey, const std::string& tagValue); private: ISensorWriter* const Writer_; @@ -63,19 +63,19 @@ public: void PushTag(TTag tag) override; void PopTag() override; - void AddGauge(const TString& name, double value) override; - void AddCounter(const TString& name, i64 value) override; + void AddGauge(const std::string& name, double value) override; + void AddCounter(const std::string& name, i64 value) override; void WriteTo(ISensorWriter* writer); - const std::vector<std::tuple<TString, TTagList, i64>>& GetCounters() const; - const std::vector<std::tuple<TString, TTagList, double>>& GetGauges() const; + const std::vector<std::tuple<std::string, TTagList, i64>>& GetCounters() const; + const std::vector<std::tuple<std::string, TTagList, double>>& GetGauges() const; private: TTagList Tags_; - std::vector<std::tuple<TString, TTagList, i64>> Counters_; - std::vector<std::tuple<TString, TTagList, double>> Gauges_; + std::vector<std::tuple<std::string, TTagList, i64>> Counters_; + std::vector<std::tuple<std::string, TTagList, double>> Gauges_; }; //////////////////////////////////////////////////////////////////////////////// diff --git a/yt/yt/library/profiling/sensor.cpp b/yt/yt/library/profiling/sensor.cpp index cec63b40ea..f04791b3cf 100644 --- a/yt/yt/library/profiling/sensor.cpp +++ b/yt/yt/library/profiling/sensor.cpp @@ -261,8 +261,8 @@ bool TSensorOptions::IsCompatibleWith(const TSensorOptions& other) const TProfiler::TProfiler( const IRegistryImplPtr& impl, - const TString& prefix, - const TString& _namespace) + const std::string& prefix, + const std::string& _namespace) : Enabled_(true) , Prefix_(prefix) , Namespace_(_namespace) @@ -270,8 +270,8 @@ TProfiler::TProfiler( { } TProfiler::TProfiler( - const TString& prefix, - const TString& _namespace, + const std::string& prefix, + const std::string& _namespace, const TTagSet& tags, const IRegistryImplPtr& impl, TSensorOptions options) @@ -283,7 +283,7 @@ TProfiler::TProfiler( , Impl_(impl ? impl : GetGlobalRegistry()) { } -TProfiler TProfiler::WithPrefix(const TString& prefix) const +TProfiler TProfiler::WithPrefix(const std::string& prefix) const { if (!Enabled_) { return {}; @@ -292,7 +292,7 @@ TProfiler TProfiler::WithPrefix(const TString& prefix) const return TProfiler(Prefix_ + prefix, Namespace_, Tags_, Impl_, Options_); } -TProfiler TProfiler::WithTag(const TString& name, const TString& value, int parent) const +TProfiler TProfiler::WithTag(const std::string& name, const std::string& value, int parent) const { if (!Enabled_) { return {}; @@ -303,7 +303,7 @@ TProfiler TProfiler::WithTag(const TString& name, const TString& value, int pare return TProfiler(Prefix_, Namespace_, allTags, Impl_, Options_); } -void TProfiler::RenameDynamicTag(const TDynamicTagPtr& tag, const TString& name, const TString& value) const +void TProfiler::RenameDynamicTag(const TDynamicTagPtr& tag, const std::string& name, const std::string& value) const { if (!Impl_) { return; @@ -312,7 +312,7 @@ void TProfiler::RenameDynamicTag(const TDynamicTagPtr& tag, const TString& name, Impl_->RenameDynamicTag(tag, name, value); } -TProfiler TProfiler::WithRequiredTag(const TString& name, const TString& value, int parent) const +TProfiler TProfiler::WithRequiredTag(const std::string& name, const std::string& value, int parent) const { if (!Enabled_) { return {}; @@ -323,7 +323,7 @@ TProfiler TProfiler::WithRequiredTag(const TString& name, const TString& value, return TProfiler(Prefix_, Namespace_, allTags, Impl_, Options_); } -TProfiler TProfiler::WithExcludedTag(const TString& name, const TString& value, int parent) const +TProfiler TProfiler::WithExcludedTag(const std::string& name, const std::string& value, int parent) const { if (!Enabled_) { return {}; @@ -334,7 +334,7 @@ TProfiler TProfiler::WithExcludedTag(const TString& name, const TString& value, return TProfiler(Prefix_, Namespace_, allTags, Impl_, Options_); } -TProfiler TProfiler::WithAlternativeTag(const TString& name, const TString& value, int alternativeTo, int parent) const +TProfiler TProfiler::WithAlternativeTag(const std::string& name, const std::string& value, int alternativeTo, int parent) const { if (!Enabled_) { return {}; @@ -346,7 +346,7 @@ TProfiler TProfiler::WithAlternativeTag(const TString& name, const TString& valu return TProfiler(Prefix_, Namespace_, allTags, Impl_, Options_); } -TProfiler TProfiler::WithExtensionTag(const TString& name, const TString& value, int extensionOf) const +TProfiler TProfiler::WithExtensionTag(const std::string& name, const std::string& value, int extensionOf) const { if (!Enabled_) { return {}; @@ -461,7 +461,7 @@ TProfiler TProfiler::WithHot(bool value) const return TProfiler(Prefix_, Namespace_, Tags_, Impl_, opts); } -TCounter TProfiler::Counter(const TString& name) const +TCounter TProfiler::Counter(const std::string& name) const { if (!Impl_) { return {}; @@ -472,7 +472,7 @@ TCounter TProfiler::Counter(const TString& name) const return counter; } -TTimeCounter TProfiler::TimeCounter(const TString& name) const +TTimeCounter TProfiler::TimeCounter(const std::string& name) const { if (!Impl_) { return {}; @@ -483,7 +483,7 @@ TTimeCounter TProfiler::TimeCounter(const TString& name) const return counter; } -TGauge TProfiler::Gauge(const TString& name) const +TGauge TProfiler::Gauge(const std::string& name) const { if (!Impl_) { return TGauge(); @@ -494,7 +494,7 @@ TGauge TProfiler::Gauge(const TString& name) const return gauge; } -TTimeGauge TProfiler::TimeGauge(const TString& name) const +TTimeGauge TProfiler::TimeGauge(const std::string& name) const { if (!Impl_) { return TTimeGauge(); @@ -505,7 +505,7 @@ TTimeGauge TProfiler::TimeGauge(const TString& name) const return gauge; } -TSummary TProfiler::Summary(const TString& name, ESummaryPolicy summaryPolicy) const +TSummary TProfiler::Summary(const std::string& name, ESummaryPolicy summaryPolicy) const { if (!Impl_) { return {}; @@ -519,7 +519,7 @@ TSummary TProfiler::Summary(const TString& name, ESummaryPolicy summaryPolicy) c return summary; } -TGauge TProfiler::GaugeSummary(const TString& name, ESummaryPolicy summaryPolicy) const +TGauge TProfiler::GaugeSummary(const std::string& name, ESummaryPolicy summaryPolicy) const { if (!Impl_) { return {}; @@ -533,7 +533,7 @@ TGauge TProfiler::GaugeSummary(const TString& name, ESummaryPolicy summaryPolicy return gauge; } -TTimeGauge TProfiler::TimeGaugeSummary(const TString& name, ESummaryPolicy summaryPolicy) const +TTimeGauge TProfiler::TimeGaugeSummary(const std::string& name, ESummaryPolicy summaryPolicy) const { if (!Impl_) { return {}; @@ -547,7 +547,7 @@ TTimeGauge TProfiler::TimeGaugeSummary(const TString& name, ESummaryPolicy summa return gauge; } -TEventTimer TProfiler::Timer(const TString& name) const +TEventTimer TProfiler::Timer(const std::string& name) const { if (!Impl_) { return {}; @@ -558,7 +558,7 @@ TEventTimer TProfiler::Timer(const TString& name) const return timer; } -TEventTimer TProfiler::TimeHistogram(const TString& name, TDuration min, TDuration max) const +TEventTimer TProfiler::TimeHistogram(const std::string& name, TDuration min, TDuration max) const { if (!Impl_) { return {}; @@ -573,7 +573,7 @@ TEventTimer TProfiler::TimeHistogram(const TString& name, TDuration min, TDurati return timer; } -TEventTimer TProfiler::TimeHistogram(const TString& name, std::vector<TDuration> bounds) const +TEventTimer TProfiler::TimeHistogram(const std::string& name, std::vector<TDuration> bounds) const { if (!Impl_) { return {}; @@ -586,7 +586,7 @@ TEventTimer TProfiler::TimeHistogram(const TString& name, std::vector<TDuration> return timer; } -TGaugeHistogram TProfiler::GaugeHistogram(const TString& name, std::vector<double> buckets) const +TGaugeHistogram TProfiler::GaugeHistogram(const std::string& name, std::vector<double> buckets) const { if (!Impl_) { return {}; @@ -599,7 +599,7 @@ TGaugeHistogram TProfiler::GaugeHistogram(const TString& name, std::vector<doubl return histogram; } -TRateHistogram TProfiler::RateHistogram(const TString& name, std::vector<double> buckets) const +TRateHistogram TProfiler::RateHistogram(const std::string& name, std::vector<double> buckets) const { if (!Impl_) { return {}; @@ -613,7 +613,7 @@ TRateHistogram TProfiler::RateHistogram(const TString& name, std::vector<double> } void TProfiler::AddFuncCounter( - const TString& name, + const std::string& name, const TRefCountedPtr& owner, std::function<i64()> reader) const { @@ -625,7 +625,7 @@ void TProfiler::AddFuncCounter( } void TProfiler::AddFuncGauge( - const TString& name, + const std::string& name, const TRefCountedPtr& owner, std::function<double()> reader) const { @@ -637,7 +637,7 @@ void TProfiler::AddFuncGauge( } void TProfiler::AddProducer( - const TString& prefix, + const std::string& prefix, const ISensorProducerPtr& producer) const { if (!Impl_) { diff --git a/yt/yt/library/profiling/sensor.h b/yt/yt/library/profiling/sensor.h index bd8ff2005c..7a2f32fe10 100644 --- a/yt/yt/library/profiling/sensor.h +++ b/yt/yt/library/profiling/sensor.h @@ -247,17 +247,17 @@ public: TProfiler( const IRegistryImplPtr& impl, - const TString& prefix, - const TString& _namespace = DefaultNamespace); + const std::string& prefix, + const std::string& _namespace = DefaultNamespace); explicit TProfiler( - const TString& prefix, - const TString& _namespace = DefaultNamespace, + const std::string& prefix, + const std::string& _namespace = DefaultNamespace, const TTagSet& tags = {}, const IRegistryImplPtr& impl = nullptr, TSensorOptions options = {}); - TProfiler WithPrefix(const TString& prefix) const; + TProfiler WithPrefix(const std::string& prefix) const; //! Tag settings control local aggregates. /*! @@ -265,18 +265,18 @@ public: * #parent is negative number representing parent tag index. * #alternativeTo is negative number representing alternative tag index. */ - TProfiler WithTag(const TString& name, const TString& value, int parent = NoParent) const; - TProfiler WithRequiredTag(const TString& name, const TString& value, int parent = NoParent) const; - TProfiler WithExcludedTag(const TString& name, const TString& value, int parent = NoParent) const; - TProfiler WithAlternativeTag(const TString& name, const TString& value, int alternativeTo, int parent = NoParent) const; - TProfiler WithExtensionTag(const TString& name, const TString& value, int parent = NoParent) const; + TProfiler WithTag(const std::string& name, const std::string& value, int parent = NoParent) const; + TProfiler WithRequiredTag(const std::string& name, const std::string& value, int parent = NoParent) const; + TProfiler WithExcludedTag(const std::string& name, const std::string& value, int parent = NoParent) const; + TProfiler WithAlternativeTag(const std::string& name, const std::string& value, int alternativeTo, int parent = NoParent) const; + TProfiler WithExtensionTag(const std::string& name, const std::string& value, int parent = NoParent) const; TProfiler WithTags(const TTagSet& tags) const; //! Rename tag in all previously registered sensors. /*! * NOTE: this is O(n) operation. */ - void RenameDynamicTag(const TDynamicTagPtr& tag, const TString& name, const TString& value) const; + void RenameDynamicTag(const TDynamicTagPtr& tag, const std::string& name, const std::string& value) const; //! WithSparse sets sparse flags on all sensors created using returned registry. /*! @@ -328,38 +328,38 @@ public: TProfiler WithHot(bool value = true) const; //! Counter is used to measure rate of events. - TCounter Counter(const TString& name) const; + TCounter Counter(const std::string& name) const; //! Counter is used to measure CPU time consumption. - TTimeCounter TimeCounter(const TString& name) const; + TTimeCounter TimeCounter(const std::string& name) const; //! Gauge is used to measure instant value. - TGauge Gauge(const TString& name) const; + TGauge Gauge(const std::string& name) const; //! TimeGauge is used to measure instant duration. - TTimeGauge TimeGauge(const TString& name) const; + TTimeGauge TimeGauge(const std::string& name) const; //! Summary is used to measure distribution of values. - TSummary Summary(const TString& name, ESummaryPolicy summaryPolicy = ESummaryPolicy::Default) const; + TSummary Summary(const std::string& name, ESummaryPolicy summaryPolicy = ESummaryPolicy::Default) const; //! GaugeSummary is used to aggregate multiple values locally. /*! * Each TGauge tracks single value. Values are aggregated using Summary rules. */ - TGauge GaugeSummary(const TString& name, ESummaryPolicy summaryPolicy = ESummaryPolicy::Default) const; + TGauge GaugeSummary(const std::string& name, ESummaryPolicy summaryPolicy = ESummaryPolicy::Default) const; //! TimeGaugeSummary is used to aggregate multiple values locally. /*! * Each TGauge tracks single value. Values are aggregated using Summary rules. */ - TTimeGauge TimeGaugeSummary(const TString& name, ESummaryPolicy summaryPolicy = ESummaryPolicy::Default) const; + TTimeGauge TimeGaugeSummary(const std::string& name, ESummaryPolicy summaryPolicy = ESummaryPolicy::Default) const; //! Timer is used to measure distribution of event durations. /*! * Currently, max value during 5 second interval is exported to solomon. * Use it, when you need a cheap way to monitor lag spikes. */ - TEventTimer Timer(const TString& name) const; + TEventTimer Timer(const std::string& name) const; //! TimeHistogram is used to measure distribution of event durations. /*! @@ -373,30 +373,30 @@ public: * In terms of time this can be read as: * 1us, 2us, 4us, 8us, ..., 500us, 1ms, 2ms, ..., 500ms, 1s, ... */ - TEventTimer TimeHistogram(const TString& name, TDuration min, TDuration max) const; + TEventTimer TimeHistogram(const std::string& name, TDuration min, TDuration max) const; //! TimeHistogram is used to measure distribution of event durations. /*! * Allows to use custom bounds, bounds should be sorted (maximum 51 elements are allowed). */ - TEventTimer TimeHistogram(const TString& name, std::vector<TDuration> bounds) const; + TEventTimer TimeHistogram(const std::string& name, std::vector<TDuration> bounds) const; //! GaugeHistogram is used to measure distribution of set of samples. - TGaugeHistogram GaugeHistogram(const TString& name, std::vector<double> buckets) const; + TGaugeHistogram GaugeHistogram(const std::string& name, std::vector<double> buckets) const; //! RateHistogram is used to measure distribution of set of samples. /*! * Bucket values at the next point will be calculated as a derivative. */ - TRateHistogram RateHistogram(const TString& name, std::vector<double> buckets) const; + TRateHistogram RateHistogram(const std::string& name, std::vector<double> buckets) const; void AddFuncCounter( - const TString& name, + const std::string& name, const TRefCountedPtr& owner, std::function<i64()> reader) const; void AddFuncGauge( - const TString& name, + const std::string& name, const TRefCountedPtr& owner, std::function<double()> reader) const; @@ -406,7 +406,7 @@ public: * the resulting value registered in the profiler will be a sum of the values reported by each producer. */ void AddProducer( - const TString& prefix, + const std::string& prefix, const ISensorProducerPtr& producer) const; const IRegistryImplPtr& GetRegistry() const; @@ -415,8 +415,8 @@ private: friend struct TTesting; bool Enabled_ = false; - TString Prefix_; - TString Namespace_; + std::string Prefix_; + std::string Namespace_; TTagSet Tags_; TSensorOptions Options_; IRegistryImplPtr Impl_; diff --git a/yt/yt/library/profiling/sensors_owner/sensors_owner.cpp b/yt/yt/library/profiling/sensors_owner/sensors_owner.cpp index 55db938c05..b91cfcdeb1 100644 --- a/yt/yt/library/profiling/sensors_owner/sensors_owner.cpp +++ b/yt/yt/library/profiling/sensors_owner/sensors_owner.cpp @@ -31,12 +31,12 @@ namespace { template <typename TSensor, typename... TArgs> struct TSensorWrapper { - template <TSensor (TProfiler::*Getter)(const TString&, TArgs...) const> + template <TSensor (TProfiler::*Getter)(const std::string&, TArgs...) const> struct TImpl { - using TKey = TString; + using TKey = std::string; - TImpl(const TProfiler& profiler, const TString& key, TArgs... args) + TImpl(const TProfiler& profiler, const std::string& key, TArgs... args) : Sensor((profiler.*Getter)(key, std::move(args)...)) { } @@ -90,35 +90,35 @@ const TSensorsOwner& TSensorsOwner::WithTags(const TTagSet& tags) const return GetWithTags<TChild>(tags).SensorsOwner; } -const TSensorsOwner& TSensorsOwner::WithTag(const TString& name, const TString& value) const +const TSensorsOwner& TSensorsOwner::WithTag(const std::string& name, const std::string& value) const { return WithTags(TTagSet().WithTag({name, value})); } -const TSensorsOwner& TSensorsOwner::WithRequiredTag(const TString& name, const TString& value) const +const TSensorsOwner& TSensorsOwner::WithRequiredTag(const std::string& name, const std::string& value) const { return WithTags(TTagSet().WithRequiredTag({name, value})); } -const TSensorsOwner& TSensorsOwner::WithExcludedTag(const TString& name, const TString& value) const +const TSensorsOwner& TSensorsOwner::WithExcludedTag(const std::string& name, const std::string& value) const { return WithTags(TTagSet().WithExcludedTag({name, value})); } -const TSensorsOwner& TSensorsOwner::WithAlternativeTag(const TString& name, const TString& value, int alternativeTo) const +const TSensorsOwner& TSensorsOwner::WithAlternativeTag(const std::string& name, const std::string& value, int alternativeTo) const { return WithTags(TTagSet().WithAlternativeTag({name, value}, alternativeTo)); } -const TSensorsOwner& TSensorsOwner::WithPrefix(const TString& prefix) const +const TSensorsOwner& TSensorsOwner::WithPrefix(const std::string& prefix) const { struct TChild { - using TKey = TString; + using TKey = std::string; TSensorsOwner SensorsOwner; - TChild(const TProfiler& profiler, const TString& prefix) + TChild(const TProfiler& profiler, const std::string& prefix) : SensorsOwner(profiler.WithPrefix(prefix)) { } }; @@ -140,42 +140,42 @@ const TSensorsOwner& TSensorsOwner::WithGlobal() const return Get<TChild>().SensorsOwner; } -const TCounter& TSensorsOwner::GetCounter(TStringBuf name) const +const TCounter& TSensorsOwner::GetCounter(const std::string& name) const { return Get<TCounterWrapper>(name).Sensor; } -const TGauge& TSensorsOwner::GetGauge(TStringBuf name) const +const TGauge& TSensorsOwner::GetGauge(const std::string& name) const { return Get<TGaugeWrapper>(name).Sensor; } -const TTimeGauge& TSensorsOwner::GetTimeGauge(TStringBuf name) const +const TTimeGauge& TSensorsOwner::GetTimeGauge(const std::string& name) const { return Get<TTimeGaugeWrapper>(name).Sensor; } -const TEventTimer& TSensorsOwner::GetTimeHistogram(TStringBuf name, std::vector<TDuration> bounds) const +const TEventTimer& TSensorsOwner::GetTimeHistogram(const std::string& name, std::vector<TDuration> bounds) const { return Get<TTimeHistogramWrapper<std::vector<TDuration>>>(name, std::move(bounds)).Sensor; } -const TEventTimer& TSensorsOwner::GetTimeHistogram(TStringBuf name, TDuration min, TDuration max) const +const TEventTimer& TSensorsOwner::GetTimeHistogram(const std::string& name, TDuration min, TDuration max) const { return Get<TTimeHistogramWrapper<TDuration, TDuration>>(name, min, max).Sensor; } -const TGaugeHistogram& TSensorsOwner::GetGaugeHistogram(TStringBuf name, std::vector<double> buckets) const +const TGaugeHistogram& TSensorsOwner::GetGaugeHistogram(const std::string& name, std::vector<double> buckets) const { return Get<TGaugeHistogramWrapper<std::vector<double>>>(name, std::move(buckets)).Sensor; } -const TRateHistogram& TSensorsOwner::GetRateHistogram(TStringBuf name, std::vector<double> buckets) const +const TRateHistogram& TSensorsOwner::GetRateHistogram(const std::string& name, std::vector<double> buckets) const { return Get<TRateHistogramWrapper<std::vector<double>>>(name, std::move(buckets)).Sensor; } -void TSensorsOwner::Inc(TStringBuf name, i64 delta) const +void TSensorsOwner::Inc(const std::string& name, i64 delta) const { GetCounter(name).Increment(delta); } diff --git a/yt/yt/library/profiling/sensors_owner/sensors_owner.h b/yt/yt/library/profiling/sensors_owner/sensors_owner.h index 77d4ec3ad4..b3fa6dd1d5 100644 --- a/yt/yt/library/profiling/sensors_owner/sensors_owner.h +++ b/yt/yt/library/profiling/sensors_owner/sensors_owner.h @@ -53,14 +53,14 @@ public: //! Gets owned TSensorsOwner with profiler=Profiler.WithTags(...). //! Result of WithTags(tags) is always the same with fixed *this and tags.Tags(). const TSensorsOwner& WithTags(const TTagSet& tags) const; - const TSensorsOwner& WithTag(const TString& name, const TString& value) const; - const TSensorsOwner& WithRequiredTag(const TString& name, const TString& value) const; - const TSensorsOwner& WithExcludedTag(const TString& name, const TString& value) const; - const TSensorsOwner& WithAlternativeTag(const TString& name, const TString& value, int alternativeTo) const; + const TSensorsOwner& WithTag(const std::string& name, const std::string& value) const; + const TSensorsOwner& WithRequiredTag(const std::string& name, const std::string& value) const; + const TSensorsOwner& WithExcludedTag(const std::string& name, const std::string& value) const; + const TSensorsOwner& WithAlternativeTag(const std::string& name, const std::string& value, int alternativeTo) const; //! Gets owned TSensorsOwner with profiler=Profiler.WithPrefix(...). //! Result of WithPrefix(prefix) is always the same with fixed *this and prefix. - const TSensorsOwner& WithPrefix(const TString& prefix) const; + const TSensorsOwner& WithPrefix(const std::string& prefix) const; const TSensorsOwner& WithGlobal() const; @@ -70,32 +70,32 @@ public: * Note that it is generally better to have a structure storing all the sensors * you need and access it through the Get method. Avoid using methods below * unless you only need a single sensor and lookup by your key is not - * cheaper than by TString, or you don't care about performance. + * cheaper than by std::string, or you don't care about performance. */ //! Gets owned counter with given metric suffix. - const TCounter& GetCounter(TStringBuf name) const; + const TCounter& GetCounter(const std::string& name) const; //! ~ .Counter(str).Increment(delta) - void Inc(TStringBuf name, i64 delta) const; + void Inc(const std::string& name, i64 delta) const; //! Gets owned gauge with given metric suffix. - const TGauge& GetGauge(TStringBuf name) const; + const TGauge& GetGauge(const std::string& name) const; //! Gets owned time gauge with given metric suffix. - const TTimeGauge& GetTimeGauge(TStringBuf name) const; + const TTimeGauge& GetTimeGauge(const std::string& name) const; //! Gets owned TimeHistogram with given metric suffix using bounds as a constructor argument. - const TEventTimer& GetTimeHistogram(TStringBuf name, std::vector<TDuration> bounds) const; + const TEventTimer& GetTimeHistogram(const std::string& name, std::vector<TDuration> bounds) const; //! Gets owned TimeHistogram with given metric suffix using min/max as a constructor arguments. - const TEventTimer& GetTimeHistogram(TStringBuf name, TDuration min, TDuration max) const; + const TEventTimer& GetTimeHistogram(const std::string& name, TDuration min, TDuration max) const; //! Gets owned GaugeHistogram with given metric suffix using buckets as a constructor. - const TGaugeHistogram& GetGaugeHistogram(TStringBuf name, std::vector<double> buckets) const; + const TGaugeHistogram& GetGaugeHistogram(const std::string& name, std::vector<double> buckets) const; //! Gets owned RateHistogram with given metric suffix using buckets as a constructor. - const TRateHistogram& GetRateHistogram(TStringBuf name, std::vector<double> buckets) const; + const TRateHistogram& GetRateHistogram(const std::string& name, std::vector<double> buckets) const; private: struct TState final diff --git a/yt/yt/library/profiling/solomon/cube.cpp b/yt/yt/library/profiling/solomon/cube.cpp index f96c3bc686..2dc4d93438 100644 --- a/yt/yt/library/profiling/solomon/cube.cpp +++ b/yt/yt/library/profiling/solomon/cube.cpp @@ -174,7 +174,7 @@ T TCube<T>::Rollup(const TProjection& window, int index) const template <class T> int TCube<T>::ReadSensors( - const TString& name, + const std::string& name, const TReadOptions& options, TTagWriter* tagWriter, ::NMonitoring::IMetricConsumer* consumer) const @@ -184,13 +184,13 @@ int TCube<T>::ReadSensors( int sensorsEmitted = 0; auto prepareNameLabel = [&] (std::optional<TStringBuf> suffix) { - TString sensorName; + std::string sensorName; sensorName.reserve(name.size() + (suffix ? suffix->size() : 0)); if (options.DisableSensorsRename) { sensorName += name; } else if (options.StripSensorsNamePrefix) { auto delimiterPos = name.find_last_of('/'); - if (TString::npos == delimiterPos) { + if (std::string::npos == delimiterPos) { sensorName.assign(name); } else { sensorName.assign(name, delimiterPos + 1); diff --git a/yt/yt/library/profiling/solomon/cube.h b/yt/yt/library/profiling/solomon/cube.h index 2d4eddfdd9..39c638fcc0 100644 --- a/yt/yt/library/profiling/solomon/cube.h +++ b/yt/yt/library/profiling/solomon/cube.h @@ -21,7 +21,7 @@ struct TReadOptions { TReadWindow Times; - std::function<bool(const TString&)> SensorFilter; + std::function<bool(const std::string&)> SensorFilter; bool ConvertCountersToRateGauge = false; bool RenameConvertedCounters = true; @@ -35,7 +35,7 @@ struct TReadOptions bool MarkAggregates = false; - std::optional<TString> Host; + std::optional<std::string> Host; std::vector<TTag> InstanceTags; @@ -101,7 +101,7 @@ public: T Rollup(const TProjection& window, int index) const; int ReadSensors( - const TString& name, + const std::string& name, const TReadOptions& options, TTagWriter* tagWriter, ::NMonitoring::IMetricConsumer* consumer) const; diff --git a/yt/yt/library/profiling/solomon/exporter.cpp b/yt/yt/library/profiling/solomon/exporter.cpp index ec8d3c8bb7..c543a7d26f 100644 --- a/yt/yt/library/profiling/solomon/exporter.cpp +++ b/yt/yt/library/profiling/solomon/exporter.cpp @@ -154,14 +154,14 @@ void TSolomonExporterConfig::Register(TRegistrar registrar) }); } -TShardConfigPtr TSolomonExporterConfig::MatchShard(const TString& sensorName) +TShardConfigPtr TSolomonExporterConfig::MatchShard(const std::string& sensorName) { TShardConfigPtr matchedShard; int matchSize = -1; for (const auto& [name, config] : Shards) { for (auto prefix : config->Filter) { - if (!sensorName.StartsWith(prefix)) { + if (!sensorName.starts_with(prefix)) { continue; } @@ -224,7 +224,7 @@ TSolomonExporter::TSolomonExporter( Registry_->SetWindowSize(Config_->WindowSize); Registry_->SetProducerCollectionBatchSize(Config_->ProducerCollectionBatchSize); - Registry_->SetGridFactor([config = Config_] (const TString& name) -> int { + Registry_->SetGridFactor([config = Config_] (const std::string& name) -> int { auto shard = config->MatchShard(name); if (!shard) { return 1; @@ -266,12 +266,12 @@ TSolomonExporter::TSolomonExporter( } } -void TSolomonExporter::Register(const TString& prefix, const NYT::NHttp::IServerPtr& server) +void TSolomonExporter::Register(const std::string& prefix, const NYT::NHttp::IServerPtr& server) { Register(prefix, server->GetPathMatcher()); } -void TSolomonExporter::Register(const TString& prefix, const NYT::NHttp::IRequestPathMatcherPtr& handlers) +void TSolomonExporter::Register(const std::string& prefix, const NYT::NHttp::IRequestPathMatcherPtr& handlers) { handlers->Add(prefix + "/", BIND(&TSolomonExporter::HandleIndex, MakeStrong(this), prefix)); handlers->Add(prefix + "/sensors", BIND(&TSolomonExporter::HandleDebugSensors, MakeStrong(this))); @@ -426,7 +426,7 @@ constexpr auto IndexPage = R"EOF( </html> )EOF"; -void TSolomonExporter::HandleIndex(const TString& prefix, const IRequestPtr& req, const IResponseWriterPtr& rsp) +void TSolomonExporter::HandleIndex(const std::string& prefix, const IRequestPtr& req, const IResponseWriterPtr& rsp) { if (req->GetUrl().Path != prefix && req->GetUrl().Path != prefix + "/") { rsp->SetStatus(EStatusCode::NotFound); @@ -451,7 +451,7 @@ void TSolomonExporter::HandleStatus(const IRequestPtr&, const IResponseWriterPtr .ValueOrThrow(); auto sensors = Registry_->ListSensors(); - THashMap<TString, TError> invalidSensors; + THashMap<std::string, TError> invalidSensors; for (const auto& sensor : sensors) { if (sensor.Error.IsOK()) { continue; @@ -520,7 +520,7 @@ void TSolomonExporter::HandleDebugTags(const IRequestPtr&, const IResponseWriter rsp->GetHeaders()->Add("Content-Type", "text/plain; charset=UTF-8"); auto tags = Registry_->GetTags().GetTopByKey(); - std::vector<std::pair<TString, size_t>> tagList{tags.begin(), tags.end()}; + std::vector<std::pair<std::string, size_t>> tagList{tags.begin(), tags.end()}; std::sort(tagList.begin(), tagList.end(), [] (auto a, auto b) { return std::tie(a.second, a.first) > std::tie(b.second, b.first); }); @@ -535,7 +535,7 @@ void TSolomonExporter::HandleDebugTags(const IRequestPtr&, const IResponseWriter .ThrowOnError(); } -std::optional<TString> TSolomonExporter::ReadJson(const TReadOptions& options, std::optional<TString> shard) +std::optional<std::string> TSolomonExporter::ReadJson(const TReadOptions& options, std::optional<std::string> shard) { TStringStream buffer; auto encoder = NMonitoring::BufferedEncoderJson(&buffer); @@ -545,7 +545,7 @@ std::optional<TString> TSolomonExporter::ReadJson(const TReadOptions& options, s return {}; } -std::optional<TString> TSolomonExporter::ReadSpack(const TReadOptions& options, std::optional<TString> shard) +std::optional<std::string> TSolomonExporter::ReadSpack(const TReadOptions& options, std::optional<std::string> shard) { TStringStream buffer; auto encoder = NMonitoring::EncoderSpackV1( @@ -561,7 +561,7 @@ std::optional<TString> TSolomonExporter::ReadSpack(const TReadOptions& options, bool TSolomonExporter::ReadSensors( NMonitoring::IMetricEncoderPtr encoder, const TReadOptions& options, - std::optional<TString> shard) + std::optional<std::string> shard) { auto guard = WaitFor(TAsyncLockReaderGuard::Acquire(&Lock_)) .ValueOrThrow(); @@ -591,11 +591,11 @@ bool TSolomonExporter::ReadSensors( } if (shard) { - readOptions.SensorFilter = [&, name = shard.value()] (const TString& sensorName) { + readOptions.SensorFilter = [&, name = shard.value()] (const std::string& sensorName) { return Config_->MatchShard(sensorName) == Config_->Shards[name]; }; } else { - readOptions.SensorFilter = [this] (const TString& sensorName) { + readOptions.SensorFilter = [this] (const std::string& sensorName) { return FilterDefaultGrid(sensorName); }; } @@ -609,7 +609,7 @@ bool TSolomonExporter::ReadSensors( } void TSolomonExporter::HandleShard( - const std::optional<TString>& name, + const std::optional<std::string>& name, const IRequestPtr& req, const IResponseWriterPtr& rsp) { @@ -622,7 +622,7 @@ void TSolomonExporter::HandleShard( } void TSolomonExporter::DoHandleShard( - const std::optional<TString>& name, + const std::optional<std::string>& name, const IRequestPtr& req, const IResponseWriterPtr& rsp) { @@ -790,11 +790,11 @@ void TSolomonExporter::DoHandleShard( options.LingerWindowSize = Config_->LingerTimeout / gridStep; if (name) { - options.SensorFilter = [&] (const TString& sensorName) { + options.SensorFilter = [&] (const std::string& sensorName) { return Config_->MatchShard(sensorName) == Config_->Shards[*name]; }; } else { - options.SensorFilter = [this] (const TString& sensorName) { + options.SensorFilter = [this] (const std::string& sensorName) { return FilterDefaultGrid(sensorName); }; } @@ -986,7 +986,7 @@ void TSolomonExporter::ValidateSummaryPolicy(ESummaryPolicy policy) } } -bool TSolomonExporter::FilterDefaultGrid(const TString& sensorName) +bool TSolomonExporter::FilterDefaultGrid(const std::string& sensorName) { auto shard = Config_->MatchShard(sensorName); if (shard && shard->GridStep) { diff --git a/yt/yt/library/profiling/solomon/exporter.h b/yt/yt/library/profiling/solomon/exporter.h index a6d25dff9f..d9f01753ea 100644 --- a/yt/yt/library/profiling/solomon/exporter.h +++ b/yt/yt/library/profiling/solomon/exporter.h @@ -26,7 +26,7 @@ namespace NYT::NProfiling { struct TShardConfig : public NYTree::TYsonStruct { - std::vector<TString> Filter; + std::vector<std::string> Filter; std::optional<TDuration> GridStep; @@ -78,17 +78,17 @@ struct TSolomonExporterConfig TDuration ReadDelay; - std::optional<TString> Host; + std::optional<std::string> Host; - THashMap<TString, TString> InstanceTags; + THashMap<std::string, std::string> InstanceTags; - THashMap<TString, TShardConfigPtr> Shards; + THashMap<std::string, TShardConfigPtr> Shards; TDuration UpdateSensorServiceTreePeriod; int ProducerCollectionBatchSize; - TShardConfigPtr MatchShard(const TString& sensorName); + TShardConfigPtr MatchShard(const std::string& sensorName); ESummaryPolicy GetSummaryPolicy() const; @@ -109,19 +109,19 @@ public: TSolomonExporterConfigPtr config, TSolomonRegistryPtr registry = nullptr); - void Register(const TString& prefix, const NYT::NHttp::IServerPtr& server); - void Register(const TString& prefix, const NYT::NHttp::IRequestPathMatcherPtr& handlers); + void Register(const std::string& prefix, const NYT::NHttp::IServerPtr& server); + void Register(const std::string& prefix, const NYT::NHttp::IRequestPathMatcherPtr& handlers); //! Attempts to read registered sensors in JSON format. //! Returns null if exporter is not ready. - std::optional<TString> ReadJson(const TReadOptions& options = {}, std::optional<TString> shard = {}); + std::optional<std::string> ReadJson(const TReadOptions& options = {}, std::optional<std::string> shard = {}); - std::optional<TString> ReadSpack(const TReadOptions& options = {}, std::optional<TString> shard = {}); + std::optional<std::string> ReadSpack(const TReadOptions& options = {}, std::optional<std::string> shard = {}); bool ReadSensors( ::NMonitoring::IMetricEncoderPtr encoder, const TReadOptions& options, - std::optional<TString> shard); + std::optional<std::string> shard); void AttachRemoteProcess(TCallback<TFuture<TSharedRef>()> dumpSensors); @@ -150,11 +150,11 @@ private: TSpinLock StatusLock_; std::optional<TInstant> LastFetch_; - THashMap<TString, std::optional<TInstant>> LastShardFetch_; + THashMap<std::string, std::optional<TInstant>> LastShardFetch_; struct TCacheKey { - std::optional<TString> Shard; + std::optional<std::string> Shard; ::NMonitoring::EFormat Format; ::NMonitoring::ECompression Compression; @@ -192,19 +192,19 @@ private: void DoCollect(); void TransferSensors(); - void HandleIndex(const TString& prefix, const NHttp::IRequestPtr& req, const NHttp::IResponseWriterPtr& rsp); + void HandleIndex(const std::string& prefix, const NHttp::IRequestPtr& req, const NHttp::IResponseWriterPtr& rsp); void HandleStatus(const NHttp::IRequestPtr& req, const NHttp::IResponseWriterPtr& rsp); void HandleDebugSensors(const NHttp::IRequestPtr& req, const NHttp::IResponseWriterPtr& rsp); void HandleDebugTags(const NHttp::IRequestPtr& req, const NHttp::IResponseWriterPtr& rsp); void HandleShard( - const std::optional<TString>& name, + const std::optional<std::string>& name, const NHttp::IRequestPtr& req, const NHttp::IResponseWriterPtr& rsp); void DoHandleShard( - const std::optional<TString>& name, + const std::optional<std::string>& name, const NHttp::IRequestPtr& req, const NHttp::IResponseWriterPtr& rsp); @@ -214,7 +214,7 @@ private: void CleanResponseCache(); - bool FilterDefaultGrid(const TString& sensorName); + bool FilterDefaultGrid(const std::string& sensorName); static void ValidateSummaryPolicy(ESummaryPolicy policy); diff --git a/yt/yt/library/profiling/solomon/helpers.cpp b/yt/yt/library/profiling/solomon/helpers.cpp index 4fe877e672..056daaa330 100644 --- a/yt/yt/library/profiling/solomon/helpers.cpp +++ b/yt/yt/library/profiling/solomon/helpers.cpp @@ -15,8 +15,8 @@ using namespace NHttp; void FillResponseHeaders(const TOutputEncodingContext& outputEncodingContext, const THeadersPtr& headers) { - headers->Set("Content-Type", TString{::NMonitoring::ContentTypeByFormat(outputEncodingContext.Format)}); - headers->Set("Content-Encoding", TString{::NMonitoring::ContentEncodingByCompression(outputEncodingContext.Compression)}); + headers->Set("Content-Type", std::string{::NMonitoring::ContentTypeByFormat(outputEncodingContext.Format)}); + headers->Set("Content-Encoding", std::string{::NMonitoring::ContentEncodingByCompression(outputEncodingContext.Compression)}); } TOutputEncodingContext CreateOutputEncodingContextFromHeaders(const THeadersPtr& headers) diff --git a/yt/yt/library/profiling/solomon/producer.cpp b/yt/yt/library/profiling/solomon/producer.cpp index a6066a09d1..396ed7b36c 100644 --- a/yt/yt/library/profiling/solomon/producer.cpp +++ b/yt/yt/library/profiling/solomon/producer.cpp @@ -24,7 +24,7 @@ static constexpr auto& Logger = SolomonLogger; void TProducerCounters::ClearOutdated(i64 lastIteration) { - std::vector<TString> countersToRemove; + std::vector<std::string> countersToRemove; for (const auto& [name, counter] : Counters) { if (std::get<1>(counter) != lastIteration) { countersToRemove.push_back(name); @@ -34,7 +34,7 @@ void TProducerCounters::ClearOutdated(i64 lastIteration) Counters.erase(name); } - std::vector<TString> gaugesToRemove; + std::vector<std::string> gaugesToRemove; for (const auto& [name, gauge] : Gauges) { if (gauge.second != lastIteration) { gaugesToRemove.push_back(name); @@ -94,7 +94,7 @@ void TCounterWriter::PopTag() Counters_.pop_back(); } -void TCounterWriter::AddGauge(const TString& name, double value) +void TCounterWriter::AddGauge(const std::string& name, double value) { auto& [gauge, iteration] = Counters_.back()->Gauges[name]; iteration = Iteration_; @@ -114,7 +114,7 @@ void TCounterWriter::AddGauge(const TString& name, double value) gauge.Update(value); } -void TCounterWriter::AddCounter(const TString& name, i64 value) +void TCounterWriter::AddCounter(const std::string& name, i64 value) { auto& [counter, iteration, lastValue] = Counters_.back()->Counters[name]; iteration = Iteration_; diff --git a/yt/yt/library/profiling/solomon/producer.h b/yt/yt/library/profiling/solomon/producer.h index 55a4c2cdf7..1787dbe862 100644 --- a/yt/yt/library/profiling/solomon/producer.h +++ b/yt/yt/library/profiling/solomon/producer.h @@ -15,12 +15,12 @@ DECLARE_REFCOUNTED_STRUCT(TProducerCounters) struct TProducerCounters final { - TString Prefix; + std::string Prefix; TTagSet ProducerTags; TSensorOptions Options; - THashMap<TString, std::pair<TGauge, i64>> Gauges; - THashMap<TString, std::tuple<TCounter, i64, i64>> Counters; + THashMap<std::string, std::pair<TGauge, i64>> Gauges; + THashMap<std::string, std::tuple<TCounter, i64, i64>> Counters; THashMap<TTag, std::pair<TProducerCountersPtr, i64>> Tags; void ClearOutdated(i64 lastIteration); @@ -38,8 +38,8 @@ public: void PushTag(TTag tag) override; void PopTag() override; - void AddGauge(const TString& name, double value) override; - void AddCounter(const TString& name, i64 value) override; + void AddGauge(const std::string& name, double value) override; + void AddCounter(const std::string& name, i64 value) override; private: IRegistryImplPtr Registry_; @@ -54,7 +54,7 @@ DECLARE_REFCOUNTED_STRUCT(TProducerState) struct TProducerState final { TProducerState( - const TString& prefix, + const std::string& prefix, const TTagSet& tags, TSensorOptions options, TWeakPtr<ISensorProducer> producer) diff --git a/yt/yt/library/profiling/solomon/registry.cpp b/yt/yt/library/profiling/solomon/registry.cpp index fac1478756..ee3bd9693b 100644 --- a/yt/yt/library/profiling/solomon/registry.cpp +++ b/yt/yt/library/profiling/solomon/registry.cpp @@ -3,7 +3,7 @@ #include "sensor.h" #include "percpu.h" -#include <type_traits> +#include <yt/yt/core/misc/protobuf_helpers.h> #include <yt/yt/core/misc/singleton.h> #include <library/cpp/yt/assert/assert.h> @@ -17,8 +17,7 @@ using namespace NYTree; //////////////////////////////////////////////////////////////////////////////// -TSolomonRegistry::TSolomonRegistry() -{ } +TSolomonRegistry::TSolomonRegistry() = default; template <class TBase, class TSimple, class TPerCpu, class TFn> TIntrusivePtr<TBase> SelectImpl(bool hot, const TFn& fn) @@ -35,7 +34,7 @@ TIntrusivePtr<TBase> SelectImpl(bool hot, const TFn& fn) } ICounterImplPtr TSolomonRegistry::RegisterCounter( - const TString& name, + const std::string& name, const TTagSet& tags, TSensorOptions options) { @@ -52,7 +51,7 @@ ICounterImplPtr TSolomonRegistry::RegisterCounter( } ITimeCounterImplPtr TSolomonRegistry::RegisterTimeCounter( - const TString& name, + const std::string& name, const TTagSet& tags, TSensorOptions options) { @@ -67,7 +66,7 @@ ITimeCounterImplPtr TSolomonRegistry::RegisterTimeCounter( } IGaugeImplPtr TSolomonRegistry::RegisterGauge( - const TString& name, + const std::string& name, const TTagSet& tags, TSensorOptions options) { @@ -88,7 +87,7 @@ IGaugeImplPtr TSolomonRegistry::RegisterGauge( } ITimeGaugeImplPtr TSolomonRegistry::RegisterTimeGauge( - const TString& name, + const std::string& name, const TTagSet& tags, TSensorOptions options) { @@ -107,7 +106,7 @@ ITimeGaugeImplPtr TSolomonRegistry::RegisterTimeGauge( } ISummaryImplPtr TSolomonRegistry::RegisterSummary( - const TString& name, + const std::string& name, const TTagSet& tags, TSensorOptions options) { @@ -120,7 +119,7 @@ ISummaryImplPtr TSolomonRegistry::RegisterSummary( } IGaugeImplPtr TSolomonRegistry::RegisterGaugeSummary( - const TString& name, + const std::string& name, const TTagSet& tags, TSensorOptions options) { @@ -134,7 +133,7 @@ IGaugeImplPtr TSolomonRegistry::RegisterGaugeSummary( } ITimeGaugeImplPtr TSolomonRegistry::RegisterTimeGaugeSummary( - const TString& name, + const std::string& name, const TTagSet& tags, TSensorOptions options) { @@ -148,7 +147,7 @@ ITimeGaugeImplPtr TSolomonRegistry::RegisterTimeGaugeSummary( } ITimerImplPtr TSolomonRegistry::RegisterTimerSummary( - const TString& name, + const std::string& name, const TTagSet& tags, TSensorOptions options) { @@ -163,7 +162,7 @@ ITimerImplPtr TSolomonRegistry::RegisterTimerSummary( } ITimerImplPtr TSolomonRegistry::RegisterTimeHistogram( - const TString& name, + const std::string& name, const TTagSet& tags, TSensorOptions options) { @@ -176,7 +175,7 @@ ITimerImplPtr TSolomonRegistry::RegisterTimeHistogram( } IHistogramImplPtr TSolomonRegistry::RegisterGaugeHistogram( - const TString& name, + const std::string& name, const TTagSet& tags, TSensorOptions options) { @@ -189,7 +188,7 @@ IHistogramImplPtr TSolomonRegistry::RegisterGaugeHistogram( } IHistogramImplPtr TSolomonRegistry::RegisterRateHistogram( - const TString& name, + const std::string& name, const TTagSet& tags, TSensorOptions options) { @@ -202,7 +201,7 @@ IHistogramImplPtr TSolomonRegistry::RegisterRateHistogram( } void TSolomonRegistry::RegisterFuncCounter( - const TString& name, + const std::string& name, const TTagSet& tags, TSensorOptions options, const TRefCountedPtr& owner, @@ -215,7 +214,7 @@ void TSolomonRegistry::RegisterFuncCounter( } void TSolomonRegistry::RegisterFuncGauge( - const TString& name, + const std::string& name, const TTagSet& tags, TSensorOptions options, const TRefCountedPtr& owner, @@ -228,7 +227,7 @@ void TSolomonRegistry::RegisterFuncGauge( } void TSolomonRegistry::RegisterProducer( - const TString& prefix, + const std::string& prefix, const TTagSet& tags, TSensorOptions options, const ISensorProducerPtr& producer) @@ -240,8 +239,8 @@ void TSolomonRegistry::RegisterProducer( void TSolomonRegistry::RenameDynamicTag( const TDynamicTagPtr& tag, - const TString& name, - const TString& value) + const std::string& name, + const std::string& value) { DoRegister([this, tag, name, value] { auto tagId = Tags_.Encode(TTag{name, value}); @@ -262,7 +261,7 @@ i64 TSolomonRegistry::GetNextIteration() const return Iteration_; } -void TSolomonRegistry::SetGridFactor(std::function<int(const TString&)> gridFactor) +void TSolomonRegistry::SetGridFactor(std::function<int(const std::string&)> gridFactor) { GridFactor_ = gridFactor; } @@ -414,7 +413,7 @@ void TSolomonRegistry::ReadSensors( } void TSolomonRegistry::ReadRecentSensorValues( - const TString& name, + const std::string& name, const TTagList& tags, const TReadOptions& options, TFluentAny fluent) const @@ -499,7 +498,7 @@ const TTagRegistry& TSolomonRegistry::GetTags() const return Tags_; } -TSensorSet* TSolomonRegistry::FindSet(const TString& name, const TSensorOptions& options) +TSensorSet* TSolomonRegistry::FindSet(const std::string& name, const TSensorOptions& options) { if (auto it = Sensors_.find(name); it != Sensors_.end()) { it->second.ValidateOptions(options); @@ -534,8 +533,9 @@ NProto::TSensorDump TSolomonRegistry::DumpSensors(std::vector<TTagId> extraTags) continue; } - auto cube = dump.add_cubes(); - cube->set_name(name); + auto* cube = dump.add_cubes(); + cube->set_name(ToProto<TProtobufString>(name)); + set.DumpCube(cube, extraTags); } @@ -547,7 +547,7 @@ NProto::TSensorDump TSolomonRegistry::DumpSensors() return DumpSensors({}); } -NProto::TSensorDump TSolomonRegistry::DumpSensors(const std::optional<TString>& host, const THashMap<TString, TString>& instanceTags) +NProto::TSensorDump TSolomonRegistry::DumpSensors(const std::optional<std::string>& host, const THashMap<std::string, std::string>& instanceTags) { std::vector<TTagId> extraTags; if (host) { diff --git a/yt/yt/library/profiling/solomon/registry.h b/yt/yt/library/profiling/solomon/registry.h index 1d850d3a9b..70e082a463 100644 --- a/yt/yt/library/profiling/solomon/registry.h +++ b/yt/yt/library/profiling/solomon/registry.h @@ -26,7 +26,7 @@ namespace NYT::NProfiling { struct TSensorInfo { - TString Name; + std::string Name; int ObjectCount; int CubeSize; TError Error; @@ -41,84 +41,84 @@ public: explicit TSolomonRegistry(); ICounterImplPtr RegisterCounter( - const TString& name, + const std::string& name, const TTagSet& tags, TSensorOptions options) override; ITimeCounterImplPtr RegisterTimeCounter( - const TString& name, + const std::string& name, const TTagSet& tags, TSensorOptions options) override; IGaugeImplPtr RegisterGauge( - const TString& name, + const std::string& name, const TTagSet& tags, TSensorOptions options) override; ITimeGaugeImplPtr RegisterTimeGauge( - const TString& name, + const std::string& name, const TTagSet& tags, TSensorOptions options) override; ISummaryImplPtr RegisterSummary( - const TString& name, + const std::string& name, const TTagSet& tags, TSensorOptions options) override; IGaugeImplPtr RegisterGaugeSummary( - const TString& name, + const std::string& name, const TTagSet& tags, TSensorOptions options) override; ITimeGaugeImplPtr RegisterTimeGaugeSummary( - const TString& name, + const std::string& name, const TTagSet& tags, TSensorOptions options) override; ITimerImplPtr RegisterTimerSummary( - const TString& name, + const std::string& name, const TTagSet& tags, TSensorOptions options) override; ITimerImplPtr RegisterTimeHistogram( - const TString& name, + const std::string& name, const TTagSet& tags, TSensorOptions options) override; IHistogramImplPtr RegisterGaugeHistogram( - const TString& name, + const std::string& name, const TTagSet& tags, TSensorOptions options) override; IHistogramImplPtr RegisterRateHistogram( - const TString& name, + const std::string& name, const TTagSet& tags, TSensorOptions options) override; void RegisterFuncCounter( - const TString& name, + const std::string& name, const TTagSet& tags, TSensorOptions options, const TRefCountedPtr& owner, std::function<i64()> reader) override; void RegisterFuncGauge( - const TString& name, + const std::string& name, const TTagSet& tags, TSensorOptions options, const TRefCountedPtr& owner, std::function<double()> reader) override; void RegisterProducer( - const TString& prefix, + const std::string& prefix, const TTagSet& tags, TSensorOptions options, const ISensorProducerPtr& owner) override; void RenameDynamicTag( const TDynamicTagPtr& tag, - const TString& name, - const TString& value) override; + const std::string& name, + const std::string& value) override; static TSolomonRegistryPtr Get(); @@ -126,7 +126,7 @@ public: void SetDynamicTags(std::vector<TTag> dynamicTags); std::vector<TTag> GetDynamicTags(); - void SetGridFactor(std::function<int(const TString&)> gridFactor); + void SetGridFactor(std::function<int(const std::string&)> gridFactor); void SetWindowSize(int windowSize); void SetProducerCollectionBatchSize(int batchSize); void ProcessRegistrations(); @@ -136,7 +136,7 @@ public: ::NMonitoring::IMetricConsumer* consumer) const; void ReadRecentSensorValues( - const TString& name, + const std::string& name, const TTagList& tags, const TReadOptions& options, NYTree::TFluentAny fluent) const; @@ -154,12 +154,12 @@ public: NProto::TSensorDump DumpSensors(); NProto::TSensorDump DumpSensors(std::vector<TTagId> extraTags); - NProto::TSensorDump DumpSensors(const std::optional<TString>& host, const THashMap<TString, TString>& instanceTags); + NProto::TSensorDump DumpSensors(const std::optional<std::string>& host, const THashMap<std::string, std::string>& instanceTags); private: i64 Iteration_ = 0; std::optional<int> WindowSize_; - std::function<int(const TString&)> GridFactor_; + std::function<int(const std::string&)> GridFactor_; TProfiler SelfProfiler_; YT_DECLARE_SPIN_LOCK(NThreading::TSpinLock, DynamicTagsLock_); @@ -174,9 +174,9 @@ private: TTagRegistry Tags_; TProducerSet Producers_; - THashMap<TString, TSensorSet> Sensors_; + THashMap<std::string, TSensorSet> Sensors_; - TSensorSet* FindSet(const TString& name, const TSensorOptions& options); + TSensorSet* FindSet(const std::string& name, const TSensorOptions& options); TCounter RegistrationCount_; TEventTimer SensorCollectDuration_, ReadDuration_; diff --git a/yt/yt/library/profiling/solomon/remote.cpp b/yt/yt/library/profiling/solomon/remote.cpp index 4f81145f20..11f50f0906 100644 --- a/yt/yt/library/profiling/solomon/remote.cpp +++ b/yt/yt/library/profiling/solomon/remote.cpp @@ -159,7 +159,7 @@ void TRemoteRegistry::Detach() DoDetach(Sensors_); } -void TRemoteRegistry::DoDetach(const THashMap<TString, TRemoteSensorSet>& sensors) +void TRemoteRegistry::DoDetach(const THashMap<std::string, TRemoteSensorSet>& sensors) { for (const auto& [name, usedTags] : sensors) { auto& sensorSet = Registry_->Sensors_.find(name)->second; diff --git a/yt/yt/library/profiling/solomon/remote.h b/yt/yt/library/profiling/solomon/remote.h index db28348416..fb190eeedf 100644 --- a/yt/yt/library/profiling/solomon/remote.h +++ b/yt/yt/library/profiling/solomon/remote.h @@ -43,10 +43,10 @@ private: THashSet<std::pair<ESensorType, TTagIdList>> UsedTags; }; - THashMap<TString, TRemoteSensorSet> Sensors_; + THashMap<std::string, TRemoteSensorSet> Sensors_; TTagIdList RenameTags(const TTagIdList& tags); - void DoDetach(const THashMap<TString, TRemoteSensorSet>& sensors); + void DoDetach(const THashMap<std::string, TRemoteSensorSet>& sensors); }; //////////////////////////////////////////////////////////////////////////////// diff --git a/yt/yt/library/profiling/solomon/sensor_service.cpp b/yt/yt/library/profiling/solomon/sensor_service.cpp index a5bb35f357..ce25c41673 100644 --- a/yt/yt/library/profiling/solomon/sensor_service.cpp +++ b/yt/yt/library/profiling/solomon/sensor_service.cpp @@ -29,7 +29,7 @@ class TSensorServiceImpl { public: TSensorServiceImpl( - TString name, + std::string name, TSolomonRegistry* registry, TAsyncReaderWriterLock* const exporterLock) : Name_(std::move(name)) @@ -38,15 +38,15 @@ public: { } private: - using TTagMap = THashMap<TString, TString>; + using TTagMap = THashMap<std::string, std::string>; - const TString Name_; + const std::string Name_; TSolomonRegistry* const Registry_; TAsyncReaderWriterLock* const ExporterLock_; struct TGetSensorOptions { - std::optional<TString> Name; + std::optional<std::string> Name; TTagMap TagMap; bool ReadAllProjections = false; bool ExportSummaryAsMax = true; @@ -60,7 +60,7 @@ private: TGetSensorOptions options; // Set default value depending on whether we are in the sensor service root. bool defaultReadAllProjections; - if (Name_) { + if (!Name_.empty()) { THROW_ERROR_EXCEPTION_IF(requestOptions->Contains("name"), "Specifying \"name\" option is allowed only in requests to sensor service root"); @@ -68,7 +68,7 @@ private: options.Name = Name_; } else { defaultReadAllProjections = false; - options.Name = requestOptions->Find<TString>("name"); + options.Name = requestOptions->Find<std::string>("name"); } options.ReadAllProjections = requestOptions->Get<bool>("read_all_projections", /*defaultValue*/ defaultReadAllProjections); @@ -134,7 +134,7 @@ public: : Config_(std::move(config)) , Registry_(std::move(registry)) , Exporter_(std::move(exporter)) - , RootSensorServiceImpl_(New<TSensorServiceImpl>(/*name*/ TString(), Registry_.Get(), &Exporter_->Lock_)) + , RootSensorServiceImpl_(New<TSensorServiceImpl>(/*name*/ std::string(), Registry_.Get(), &Exporter_->Lock_)) , Root_(GetEphemeralNodeFactory(/*shouldHideAttributes*/ true)->CreateMap()) , SensorTreeUpdateDuration_(Registry_->GetSelfProfiler().Timer("/sensor_service_tree_update_duration")) { @@ -152,7 +152,7 @@ private: const TSensorServiceImplPtr RootSensorServiceImpl_; const IMapNodePtr Root_; - THashMap<TString, TSensorServiceImplPtr> NameToSensorServiceImpl_; + THashMap<std::string, TSensorServiceImplPtr> NameToSensorServiceImpl_; TEventTimer SensorTreeUpdateDuration_; TPeriodicExecutorPtr UpdateSensorTreeExecutor_; @@ -177,8 +177,8 @@ private: EmplaceOrCrash(NameToSensorServiceImpl_, name, sensorServiceImpl); auto node = CreateVirtualNode(std::move(sensorServiceImpl)); - auto path = "/" + name; try { + auto path = "/" + NYPath::ToYPathLiteral(name); ForceYPath(Root_, path); SetNodeByYPath(Root_, path, node); } catch (const std::exception& ex) { @@ -232,7 +232,7 @@ private: auto guard = WaitFor(TAsyncLockReaderGuard::Acquire(&Exporter_->Lock_)) .ValueOrThrow(); - auto attributeKeys = NYT::FromProto<THashSet<TString>>(request->attributes().keys()); + auto attributeKeys = NYT::FromProto<THashSet<std::string>>(request->attributes().keys()); context->SetRequestInfo("AttributeKeys: %v", attributeKeys); response->set_value(BuildYsonStringFluently() diff --git a/yt/yt/library/profiling/solomon/sensor_set.cpp b/yt/yt/library/profiling/solomon/sensor_set.cpp index 756d7b8b30..d64ce4527c 100644 --- a/yt/yt/library/profiling/solomon/sensor_set.cpp +++ b/yt/yt/library/profiling/solomon/sensor_set.cpp @@ -283,7 +283,7 @@ int TSensorSet::Collect() } void TSensorSet::ReadSensors( - const TString& name, + const std::string& name, TReadOptions readOptions, TTagWriter* tagWriter, ::NMonitoring::IMetricConsumer* consumer) const diff --git a/yt/yt/library/profiling/solomon/sensor_set.h b/yt/yt/library/profiling/solomon/sensor_set.h index 7ecdc3d7f4..493de34a20 100644 --- a/yt/yt/library/profiling/solomon/sensor_set.h +++ b/yt/yt/library/profiling/solomon/sensor_set.h @@ -207,7 +207,7 @@ public: int Collect(); void ReadSensors( - const TString& name, + const std::string& name, TReadOptions readOptions, TTagWriter* tagWriter, ::NMonitoring::IMetricConsumer* consumer) const; diff --git a/yt/yt/library/profiling/solomon/tag_registry.cpp b/yt/yt/library/profiling/solomon/tag_registry.cpp index f5413ab6df..c79b7bf96a 100644 --- a/yt/yt/library/profiling/solomon/tag_registry.cpp +++ b/yt/yt/library/profiling/solomon/tag_registry.cpp @@ -2,6 +2,8 @@ #include <yt/yt/core/misc/error.h> +#include <yt/yt/core/misc/protobuf_helpers.h> + #include <library/cpp/yt/assert/assert.h> namespace NYT::NProfiling { @@ -71,9 +73,9 @@ int TTagRegistry::GetSize() const return TagById_.size(); } -THashMap<TString, int> TTagRegistry::GetTopByKey() const +THashMap<std::string, int> TTagRegistry::GetTopByKey() const { - THashMap<TString, int> counts; + THashMap<std::string, int> counts; for (const auto& [key, value] : TagById_) { counts[key]++; } @@ -85,9 +87,9 @@ void TTagRegistry::DumpTags(NProto::TSensorDump* dump) dump->add_tags(); for (int i = 0; i < std::ssize(TagById_); i++) { - auto tag = dump->add_tags(); - tag->set_key(TagById_[i].first); - tag->set_value(TagById_[i].second); + auto* tag = dump->add_tags(); + tag->set_key(ToProto<TProtobufString>(TagById_[i].first)); + tag->set_value(ToProto<TProtobufString>(TagById_[i].second)); } } diff --git a/yt/yt/library/profiling/solomon/tag_registry.h b/yt/yt/library/profiling/solomon/tag_registry.h index 22cbdc64e0..8e76ae1175 100644 --- a/yt/yt/library/profiling/solomon/tag_registry.h +++ b/yt/yt/library/profiling/solomon/tag_registry.h @@ -25,7 +25,7 @@ public: const TTag& Decode(TTagId tagId) const; int GetSize() const; - THashMap<TString, int> GetTopByKey() const; + THashMap<std::string, int> GetTopByKey() const; void DumpTags(NProto::TSensorDump* dump); diff --git a/yt/yt/library/profiling/tag.h b/yt/yt/library/profiling/tag.h index 322b51b06d..37c1c5bb73 100644 --- a/yt/yt/library/profiling/tag.h +++ b/yt/yt/library/profiling/tag.h @@ -20,7 +20,7 @@ constexpr int TypicalTagCount = 6; using TTagIdList = TCompactVector<TTagId, TypicalTagCount>; -using TTag = std::pair<TString, TString>; +using TTag = std::pair<std::string, std::string>; using TTagList = TCompactVector<TTag, TypicalTagCount>; diff --git a/yt/yt/library/profiling/tcmalloc/profiler.cpp b/yt/yt/library/profiling/tcmalloc/profiler.cpp index 621ae9c1e4..834af5b417 100644 --- a/yt/yt/library/profiling/tcmalloc/profiler.cpp +++ b/yt/yt/library/profiling/tcmalloc/profiler.cpp @@ -30,7 +30,7 @@ public: } private: - std::vector<TString> TCMallocStats_ = { + std::vector<std::string> TCMallocStats_ = { "tcmalloc.per_cpu_caches_active", "generic.virtual_memory_used", "generic.physical_memory_used", @@ -50,7 +50,7 @@ private: "tcmalloc.transfer_cache_free", "tcmalloc.hard_usage_limit_bytes", "tcmalloc.desired_usage_limit_bytes", - "tcmalloc.required_bytes" + "tcmalloc.required_bytes", }; }; diff --git a/yt/yt/library/profiling/unittests/exporter_ut.cpp b/yt/yt/library/profiling/unittests/exporter_ut.cpp index 2b62a504f4..ef654170fb 100644 --- a/yt/yt/library/profiling/unittests/exporter_ut.cpp +++ b/yt/yt/library/profiling/unittests/exporter_ut.cpp @@ -102,8 +102,8 @@ TEST(TSolomonExporter, ReadSensorsFilter) { auto registry = New<TSolomonRegistry>(); - THashMap<TString, NYT::NProfiling::TShardConfigPtr> shards; - auto AddShardConfig = [&shards] (TString shardName) -> void { + THashMap<std::string, NYT::NProfiling::TShardConfigPtr> shards; + auto AddShardConfig = [&shards] (const std::string& shardName) { auto shardConfig = New<TShardConfig>(); shardConfig->GridStep = TDuration::Seconds(1); shardConfig->Filter = {shardName}; @@ -169,8 +169,8 @@ TEST(TSolomonExporter, ReadSensorsStripSensorsOption) { auto registry = New<TSolomonRegistry>(); - THashMap<TString, NYT::NProfiling::TShardConfigPtr> shards; - auto AddShardConfig = [&shards] (TString shardName) -> void { + THashMap<std::string, NYT::NProfiling::TShardConfigPtr> shards; + auto AddShardConfig = [&shards] (const std::string& shardName) { auto shardConfig = New<TShardConfig>(); shardConfig->GridStep = TDuration::Seconds(1); shardConfig->Filter = {shardName}; diff --git a/yt/yt/library/profiling/unittests/solomon_ut.cpp b/yt/yt/library/profiling/unittests/solomon_ut.cpp index ecfc27d6ff..62b871646a 100644 --- a/yt/yt/library/profiling/unittests/solomon_ut.cpp +++ b/yt/yt/library/profiling/unittests/solomon_ut.cpp @@ -48,7 +48,7 @@ struct TTestMetricConsumer if (name == "sensor") { Name = value; } else { - Labels.emplace_back(TString(name) + "=" + value); + Labels.push_back(TString(name) + "=" + value); } } |