diff options
author | robot-piglet <robot-piglet@yandex-team.com> | 2024-06-05 16:25:54 +0300 |
---|---|---|
committer | robot-piglet <robot-piglet@yandex-team.com> | 2024-06-05 16:47:12 +0300 |
commit | 6e1f57ea06d70691f706f16934e65b8d2928f9a1 (patch) | |
tree | c30a08df977b34c8f6249e77d13b278d7ba042b9 | |
parent | d326be16a597333b4f2311062043e51250ec29c5 (diff) | |
download | ydb-6e1f57ea06d70691f706f16934e65b8d2928f9a1.tar.gz |
Intermediate changes
-rw-r--r-- | yt/yt/library/tracing/jaeger/sampler.cpp | 6 | ||||
-rw-r--r-- | yt/yt/library/tracing/jaeger/tracer.cpp | 23 |
2 files changed, 15 insertions, 14 deletions
diff --git a/yt/yt/library/tracing/jaeger/sampler.cpp b/yt/yt/library/tracing/jaeger/sampler.cpp index 62f0cb9d507..f9e137d91a6 100644 --- a/yt/yt/library/tracing/jaeger/sampler.cpp +++ b/yt/yt/library/tracing/jaeger/sampler.cpp @@ -7,7 +7,7 @@ using namespace NProfiling; //////////////////////////////////////////////////////////////////////////////// -static const NProfiling::TProfiler Profiler{"/jaeger"}; +YT_DEFINE_GLOBAL(const NProfiling::TProfiler, Profiler, "/jaeger"); //////////////////////////////////////////////////////////////////////////////// @@ -49,7 +49,7 @@ bool TSampler::TUserState::TrySampleByMinCount(ui64 minCount, TCpuDuration perio TSampler::TSampler() : Config_(New<TSamplerConfig>()) - , TracesSampled_(Profiler.WithHot().Counter("/traces_sampled")) + , TracesSampled_(Profiler().WithHot().Counter("/traces_sampled")) { } TSampler::TSampler(const TSamplerConfigPtr& config) @@ -63,7 +63,7 @@ void TSampler::SampleTraceContext(const TString& user, const TTraceContextPtr& t auto [userState, inserted] = Users_.FindOrInsert(user, [&user] { auto state = New<TUserState>(); - auto profiler = Profiler.WithSparse().WithHot().WithTag("user", user); + auto profiler = Profiler().WithSparse().WithHot().WithTag("user", user); state->TracesSampledByUser = profiler.WithSparse().Counter("/traces_sampled_by_user"); state->TracesSampledByProbability = profiler.WithSparse().Counter("/traces_sampled_by_probability"); diff --git a/yt/yt/library/tracing/jaeger/tracer.cpp b/yt/yt/library/tracing/jaeger/tracer.cpp index 3e9d7ad1d49..477cc69ad41 100644 --- a/yt/yt/library/tracing/jaeger/tracer.cpp +++ b/yt/yt/library/tracing/jaeger/tracer.cpp @@ -37,8 +37,9 @@ using namespace NAuth; //////////////////////////////////////////////////////////////////////////////// -static const NLogging::TLogger Logger{"Jaeger"}; -static const NProfiling::TProfiler Profiler{"/tracing"}; +YT_DEFINE_GLOBAL(const NLogging::TLogger, Logger, "Jaeger"); +YT_DEFINE_GLOBAL(const NProfiling::TProfiler, Profiler, "/tracing"); + static const TString ServiceTicketMetadataName = "x-ya-service-ticket"; static const TString TracingServiceAlias = "tracing"; @@ -229,10 +230,10 @@ TBatchInfo::TBatchInfo() { } TBatchInfo::TBatchInfo(const TString& endpoint) - : TracesDequeued_(Profiler.WithTag("endpoint", endpoint).Counter("/traces_dequeued")) - , TracesDropped_(Profiler.WithTag("endpoint", endpoint).Counter("/traces_dropped")) - , MemoryUsage_(Profiler.WithTag("endpoint", endpoint).Gauge("/memory_usage")) - , TraceQueueSize_(Profiler.WithTag("endpoint", endpoint).Gauge("/queue_size")) + : TracesDequeued_(Profiler().WithTag("endpoint", endpoint).Counter("/traces_dequeued")) + , TracesDropped_(Profiler().WithTag("endpoint", endpoint).Counter("/traces_dropped")) + , MemoryUsage_(Profiler().WithTag("endpoint", endpoint).Gauge("/memory_usage")) + , TraceQueueSize_(Profiler().WithTag("endpoint", endpoint).Gauge("/queue_size")) { } void TBatchInfo::PopFront() @@ -312,10 +313,10 @@ TJaegerChannelManager::TJaegerChannelManager( , Endpoint_(endpoint) , ReopenTime_(TInstant::Now() + config->ReconnectPeriod + RandomDuration(config->ReconnectPeriod)) , RpcTimeout_(config->RpcTimeout) - , PushedBytes_(Profiler.WithTag("endpoint", endpoint).Counter("/pushed_bytes")) - , PushErrors_(Profiler.WithTag("endpoint", endpoint).Counter("/push_errors")) - , PayloadSize_(Profiler.WithTag("endpoint", endpoint).Summary("/payload_size")) - , PushDuration_(Profiler.WithTag("endpoint", endpoint).Timer("/push_duration")) + , PushedBytes_(Profiler().WithTag("endpoint", endpoint).Counter("/pushed_bytes")) + , PushErrors_(Profiler().WithTag("endpoint", endpoint).Counter("/push_errors")) + , PayloadSize_(Profiler().WithTag("endpoint", endpoint).Summary("/payload_size")) + , PushDuration_(Profiler().WithTag("endpoint", endpoint).Timer("/push_duration")) { auto channelEndpointConfig = CloneYsonStruct(config->CollectorChannelConfig); channelEndpointConfig->Address = endpoint; @@ -388,7 +389,7 @@ TJaegerTracer::TJaegerTracer( , Config_(config) , TvmService_(config->TvmService ? CreateTvmService(config->TvmService) : nullptr) { - Profiler.AddFuncGauge("/enabled", MakeStrong(this), [this] { + Profiler().AddFuncGauge("/enabled", MakeStrong(this), [this] { return Config_.Acquire()->IsEnabled(); }); |