Skip to content

Commit

Permalink
YT_DEFINE_GLOBAL for profilers
Browse files Browse the repository at this point in the history
commit_hash:c9f0f790039ceeef149366a14c9063025fbb1e0c
  • Loading branch information
maxim-babenko committed Nov 22, 2024
1 parent ad90fa2 commit f081c80
Show file tree
Hide file tree
Showing 12 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion yt/yt/core/bus/private.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace NYT::NBus {
////////////////////////////////////////////////////////////////////////////////

YT_DEFINE_GLOBAL(const NLogging::TLogger, BusLogger, "Bus");
inline const NProfiling::TProfiler BusProfiler("/bus");
YT_DEFINE_GLOBAL(const NProfiling::TProfiler, BusProfiler, "/bus");

using TConnectionId = TGuid;
using TPacketId = TGuid;
Expand Down
2 changes: 1 addition & 1 deletion yt/yt/core/bus/tcp/dispatcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace NYT::NBus {
TTcpDispatcher::TTcpDispatcher()
: Impl_(New<TImpl>())
{
BusProfiler.WithSparse().AddProducer("", Impl_);
BusProfiler().WithSparse().AddProducer("", Impl_);
}

TTcpDispatcher* TTcpDispatcher::Get()
Expand Down
8 changes: 4 additions & 4 deletions yt/yt/core/concurrency/delayed_executor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -239,10 +239,10 @@ class TDelayedExecutorImpl
TActionQueuePtr DelayedQueue_;
IInvokerPtr DelayedInvoker_;

NProfiling::TGauge ScheduledCallbacksGauge_ = ConcurrencyProfiler.Gauge("/delayed_executor/scheduled_callbacks");
NProfiling::TCounter SubmittedCallbacksCounter_ = ConcurrencyProfiler.Counter("/delayed_executor/submitted_callbacks");
NProfiling::TCounter CanceledCallbacksCounter_ = ConcurrencyProfiler.Counter("/delayed_executor/canceled_callbacks");
NProfiling::TCounter StaleCallbacksCounter_ = ConcurrencyProfiler.Counter("/delayed_executor/stale_callbacks");
NProfiling::TGauge ScheduledCallbacksGauge_ = ConcurrencyProfiler().Gauge("/delayed_executor/scheduled_callbacks");
NProfiling::TCounter SubmittedCallbacksCounter_ = ConcurrencyProfiler().Counter("/delayed_executor/submitted_callbacks");
NProfiling::TCounter CanceledCallbacksCounter_ = ConcurrencyProfiler().Counter("/delayed_executor/canceled_callbacks");
NProfiling::TCounter StaleCallbacksCounter_ = ConcurrencyProfiler().Counter("/delayed_executor/stale_callbacks");

class TCallbackGuard
{
Expand Down
2 changes: 1 addition & 1 deletion yt/yt/core/concurrency/private.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ DECLARE_REFCOUNTED_STRUCT(IFairShareCallbackQueue)
////////////////////////////////////////////////////////////////////////////////

YT_DEFINE_GLOBAL(const NLogging::TLogger, ConcurrencyLogger, "Concurrency");
inline const NProfiling::TProfiler ConcurrencyProfiler("/concurrency");
YT_DEFINE_GLOBAL(const NProfiling::TProfiler, ConcurrencyProfiler, "/concurrency");

////////////////////////////////////////////////////////////////////////////////

Expand Down
2 changes: 1 addition & 1 deletion yt/yt/core/dns/ares_dns_resolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ class TAresDnsResolver
private:
const TAresDnsResolverConfigPtr Config_;

const NProfiling::TProfiler Profiler_ = DnsProfiler.WithPrefix("/ares_resolver");
const NProfiling::TProfiler Profiler_ = DnsProfiler().WithPrefix("/ares_resolver");
const NProfiling::TCounter RequestCounter_ = Profiler_.Counter("/request_count");
const NProfiling::TCounter FailureCounter_ = Profiler_.Counter("/failure_count");
const NProfiling::TCounter TimeoutCounter_ = Profiler_.Counter("/timeout_count");
Expand Down
2 changes: 1 addition & 1 deletion yt/yt/core/dns/private.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace NYT::NDns {
////////////////////////////////////////////////////////////////////////////////

YT_DEFINE_GLOBAL(const NLogging::TLogger, DnsLogger, "Dns");
inline const NProfiling::TProfiler DnsProfiler("/dns");
YT_DEFINE_GLOBAL(const NProfiling::TProfiler, DnsProfiler, "/dns");

////////////////////////////////////////////////////////////////////////////////

Expand Down
2 changes: 1 addition & 1 deletion yt/yt/core/net/address.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -987,7 +987,7 @@ class TAddressResolver::TImpl
: TAsyncExpiringCache(
config,
/*logger*/ {},
DnsProfiler.WithPrefix("/resolve_cache"))
DnsProfiler().WithPrefix("/resolve_cache"))
{
Configure(std::move(config));
}
Expand Down
2 changes: 1 addition & 1 deletion yt/yt/core/rpc/channel_detail.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ auto TClientRequestPerformanceProfiler::GetPerformanceCounters(
using TCountersMap = NConcurrency::TSyncMap<std::pair<std::string, std::string>, TPerformanceCounters>;

auto [counter, _] = LeakySingleton<TCountersMap>()->FindOrInsert(std::pair(service, method), [&] {
auto profiler = RpcClientProfiler
auto profiler = RpcClientProfiler()
.WithHot()
.WithTag("yt_service", service)
.WithTag("method", method, -1);
Expand Down
2 changes: 1 addition & 1 deletion yt/yt/core/rpc/grpc/private.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ namespace NYT::NRpc::NGrpc {

////////////////////////////////////////////////////////////////////////////////

inline const NProfiling::TProfiler GrpcServerProfiler("/grpc/server");
YT_DEFINE_GLOBAL(const NProfiling::TProfiler, GrpcServerProfiler, "/grpc/server");

////////////////////////////////////////////////////////////////////////////////

Expand Down
2 changes: 1 addition & 1 deletion yt/yt/core/rpc/grpc/server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class TServer
BIND_NO_PROPAGATE(&TServer::Shutdown, MakeWeak(this), /*graceful*/ true),
/*priority*/ GrpcServerShutdownPriority))
, LibraryLock_(TDispatcher::Get()->GetLibraryLock())
, Profiler_(GrpcServerProfiler.WithTag("name", Config_->ProfilingName))
, Profiler_(GrpcServerProfiler().WithTag("name", Config_->ProfilingName))
, CompletionQueue_(TDispatcher::Get()->PickRandomGuardedCompletionQueue()->UnwrapUnsafe())
{
Profiler_.AddFuncGauge("/call_handler_count", MakeStrong(this), [this] {
Expand Down
4 changes: 2 additions & 2 deletions yt/yt/core/rpc/private.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ namespace NYT::NRpc {
YT_DEFINE_GLOBAL(const NLogging::TLogger, RpcServerLogger, "RpcServer");
YT_DEFINE_GLOBAL(const NLogging::TLogger, RpcClientLogger, "RpcClient");

inline const NProfiling::TProfiler RpcServerProfiler("/rpc/server");
inline const NProfiling::TProfiler RpcClientProfiler("/rpc/client");
YT_DEFINE_GLOBAL(const NProfiling::TProfiler, RpcServerProfiler, "/rpc/server");
YT_DEFINE_GLOBAL(const NProfiling::TProfiler, RpcClientProfiler, "/rpc/client");

////////////////////////////////////////////////////////////////////////////////

Expand Down
4 changes: 2 additions & 2 deletions yt/yt/core/rpc/service_detail.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1689,15 +1689,15 @@ TServiceBase::TServiceBase(
, ServiceDescriptor_(descriptor)
, ServiceId_(descriptor.FullServiceName, options.RealmId)
, MemoryUsageTracker_(std::move(options.MemoryUsageTracker))
, Profiler_(RpcServerProfiler
, Profiler_(RpcServerProfiler()
.WithHot(options.UseHotProfiler)
.WithTag("yt_service", ServiceId_.ServiceName))
, AuthenticationTimer_(Profiler_.Timer("/authentication_time"))
, ServiceLivenessChecker_(New<TPeriodicExecutor>(
TDispatcher::Get()->GetLightInvoker(),
BIND(&TServiceBase::OnServiceLivenessCheck, MakeWeak(this)),
ServiceLivenessCheckPeriod))
, PerformanceCounters_(New<TServiceBase::TPerformanceCounters>(RpcServerProfiler))
, PerformanceCounters_(New<TServiceBase::TPerformanceCounters>(RpcServerProfiler()))
, UnknownMethodPerformanceCounters_(CreateUnknownMethodPerformanceCounters())
{
RegisterMethod(RPC_SERVICE_METHOD_DESC(Discover)
Expand Down

0 comments on commit f081c80

Please sign in to comment.