Skip to content

Commit

Permalink
issue-1444: move netlink helpers to core/libs/netlink (#2471)
Browse files Browse the repository at this point in the history
  • Loading branch information
antonmyagkov committed Nov 15, 2024
1 parent 98d2c20 commit 50f14dd
Show file tree
Hide file tree
Showing 46 changed files with 743 additions and 303 deletions.
12 changes: 12 additions & 0 deletions cloud/blockstore/config/diagnostics.proto
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,15 @@ message TMonitoringUrlData
optional string MonitoringNBSTVDashboard = 7;
};

////////////////////////////////////////////////////////////////////////////////
// StatsFetcher type

enum EStatsFetcherType
{
CGROUP = 0;
KERNEL_TASK_DELAYACCT = 1;
};

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

message TDiagnosticsConfig
Expand Down Expand Up @@ -216,4 +225,7 @@ message TDiagnosticsConfig

// Performance measurements coefficients for local HDD disks.
optional TVolumePerfSettings LocalHDDPerfSettings = 51;

// Type of fetching CPU stats
optional EStatsFetcherType StatsFetcherType = 52;
}
4 changes: 2 additions & 2 deletions cloud/blockstore/libs/daemon/common/bootstrap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -861,7 +861,7 @@ void TBootstrapBase::Start()
START_KIKIMR_COMPONENT(NotifyService);
START_COMMON_COMPONENT(Monitoring);
START_COMMON_COMPONENT(ProfileLog);
START_KIKIMR_COMPONENT(CgroupStatsFetcher);
START_KIKIMR_COMPONENT(StatsFetcher);
START_COMMON_COMPONENT(DiscoveryService);
START_COMMON_COMPONENT(TraceProcessor);
START_KIKIMR_COMPONENT(TraceSerializer);
Expand Down Expand Up @@ -957,7 +957,7 @@ void TBootstrapBase::Stop()
STOP_KIKIMR_COMPONENT(TraceSerializer);
STOP_COMMON_COMPONENT(TraceProcessor);
STOP_COMMON_COMPONENT(DiscoveryService);
STOP_KIKIMR_COMPONENT(CgroupStatsFetcher);
STOP_KIKIMR_COMPONENT(StatsFetcher);
STOP_COMMON_COMPONENT(ProfileLog);
STOP_COMMON_COMPONENT(Monitoring);
STOP_KIKIMR_COMPONENT(LogbrokerService);
Expand Down
2 changes: 1 addition & 1 deletion cloud/blockstore/libs/daemon/common/bootstrap.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ class TBootstrapBase
virtual IStartable* GetTraceSerializer() = 0;
virtual IStartable* GetLogbrokerService() = 0;
virtual IStartable* GetNotifyService() = 0;
virtual IStartable* GetCgroupStatsFetcher() = 0;
virtual IStartable* GetStatsFetcher() = 0;
virtual IStartable* GetIamTokenClient() = 0;
virtual IStartable* GetComputeClient() = 0;
virtual IStartable* GetKmsClient() = 0;
Expand Down
2 changes: 1 addition & 1 deletion cloud/blockstore/libs/daemon/local/bootstrap.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class TBootstrapLocal final
IStartable* GetTraceSerializer() override { return nullptr; }
IStartable* GetLogbrokerService() override { return nullptr; }
IStartable* GetNotifyService() override { return nullptr; }
IStartable* GetCgroupStatsFetcher() override { return nullptr; }
IStartable* GetStatsFetcher() override { return nullptr; }
IStartable* GetIamTokenClient() override { return nullptr; }
IStartable* GetComputeClient() override { return nullptr; }
IStartable* GetKmsClient() override { return nullptr; }
Expand Down
54 changes: 49 additions & 5 deletions cloud/blockstore/libs/daemon/ydb/bootstrap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,48 @@ NRdma::TClientConfigPtr CreateRdmaClientConfig(
return std::make_shared<NRdma::TClientConfig>(config->GetClient());
}

// One can use either a service name and have the stats file inferred from it,
// or provide the stats file explicitly.
NCloud::NStorage::IStatsFetcherPtr BuildStatsFetcher(
NProto::EStatsFetcherType statsFetcherType,
const TString& cpuWaitServiceName,
const TString& cpuWaitFilename,
const TLog& log,
ILoggingServicePtr logging,
IMonitoringServicePtr monitoring,
TCgroupStatsFetcherMonitoringSettings cgroupStatsFetcherMonitoringSettings)
{
switch (statsFetcherType) {
case NProto::EStatsFetcherType::CGROUP: {
if (cpuWaitServiceName.Empty() && cpuWaitFilename.Empty()) {
const auto& Log = log;
STORAGE_INFO(
"CpuWaitServiceName and CpuWaitFilename are empty, can't "
"build "
"CgroupStatsFetcher");
return CreateStatsFetcherStub();
}
TString statsFile =
cpuWaitFilename.Empty()
? NCloud::NStorage::BuildCpuWaitStatsFilename(
cpuWaitServiceName)
: cpuWaitFilename;

return CreateCgroupStatsFetcher(
"FILESTORE_CGROUPS",
std::move(logging),
std::move(monitoring),
statsFile,
std::move(cgroupStatsFetcherMonitoringSettings));
}
case NProto::EStatsFetcherType::KERNEL_TASK_DELAYACCT:
return CreateKernelTaskDelayAcctStatsFetcher(
"FILESTORE_KERNEL_TASK_DELAYACCT",
std::move(logging),
std::move(monitoring));
}
};

} // namespace

////////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -129,7 +171,7 @@ IStartable* TBootstrapYdb::GetYdbStorage() { return YdbStorage.get(); }
IStartable* TBootstrapYdb::GetTraceSerializer() { return TraceSerializer.get(); }
IStartable* TBootstrapYdb::GetLogbrokerService() { return LogbrokerService.get(); }
IStartable* TBootstrapYdb::GetNotifyService() { return NotifyService.get(); }
IStartable* TBootstrapYdb::GetCgroupStatsFetcher() { return CgroupStatsFetcher.get(); }
IStartable* TBootstrapYdb::GetStatsFetcher() { return StatsFetcher.get(); }
IStartable* TBootstrapYdb::GetIamTokenClient() { return IamTokenClient.get(); }
IStartable* TBootstrapYdb::GetComputeClient() { return ComputeClient.get(); }
IStartable* TBootstrapYdb::GetKmsClient() { return KmsClient.get(); }
Expand Down Expand Up @@ -492,11 +534,13 @@ void TBootstrapYdb::InitKikimrService()
.CounterName = "CpuWaitFailure",
};

CgroupStatsFetcher = CreateCgroupStatsFetcher(
"BLOCKSTORE_CGROUPS",
StatsFetcher = BuildStatsFetcher(
Configs->DiagnosticsConfig->GetStatsFetcherType(),
{},
Configs->DiagnosticsConfig->GetCpuWaitFilename(),
Log,
logging,
monitoring,
Configs->DiagnosticsConfig->GetCpuWaitFilename(),
std::move(cgroupStatsFetcherMonitoringSettings));

if (Configs->StorageConfig->GetBlockDigestsEnabled()) {
Expand Down Expand Up @@ -547,7 +591,7 @@ void TBootstrapYdb::InitKikimrService()
args.LogbrokerService = LogbrokerService;
args.NotifyService = NotifyService;
args.VolumeStats = VolumeStats;
args.CgroupStatsFetcher = CgroupStatsFetcher;
args.StatsFetcher = StatsFetcher;
args.RdmaServer = nullptr;
args.RdmaClient = RdmaClient;
args.Logging = logging;
Expand Down
4 changes: 2 additions & 2 deletions cloud/blockstore/libs/daemon/ydb/bootstrap.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ struct TBootstrapYdb final
ITraceSerializerPtr TraceSerializer;
NLogbroker::IServicePtr LogbrokerService;
NNotify::IServicePtr NotifyService;
NCloud::NStorage::ICgroupStatsFetcherPtr CgroupStatsFetcher;
NCloud::NStorage::IStatsFetcherPtr StatsFetcher;
NIamClient::IIamTokenClientPtr IamTokenClient;
IComputeClientPtr ComputeClient;
IKmsClientPtr KmsClient;
Expand All @@ -106,7 +106,7 @@ struct TBootstrapYdb final
IStartable* GetTraceSerializer() override;
IStartable* GetLogbrokerService() override;
IStartable* GetNotifyService() override;
IStartable* GetCgroupStatsFetcher() override;
IStartable* GetStatsFetcher() override;
IStartable* GetIamTokenClient() override;
IStartable* GetComputeClient() override;
IStartable* GetKmsClient() override;
Expand Down
10 changes: 10 additions & 0 deletions cloud/blockstore/libs/diagnostics/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ namespace {
xxx(LocalHDDDowntimeThreshold, TDuration, TDuration::Seconds(15) )\
xxx(ReportHistogramAsMultipleCounters, bool, true )\
xxx(ReportHistogramAsSingleCounter, bool, false )\
xxx(StatsFetcherType, NProto::EStatsFetcherType, NProto::EStatsFetcherType::CGROUP )\
// BLOCKSTORE_DIAGNOSTICS_CONFIG

#define BLOCKSTORE_DIAGNOSTICS_DECLARE_CONFIG(name, type, value) \
Expand Down Expand Up @@ -307,3 +308,12 @@ void Out<NCloud::TRequestThresholds>(
{
OutRequestThresholds(out, value);
}

template <>
void Out<NCloud::NBlockStore::NProto::EStatsFetcherType>(
IOutputStream& out,
NCloud::NBlockStore::NProto::EStatsFetcherType statsFetcherType)
{
out << NCloud::NBlockStore::NProto::EStatsFetcherType_Name(
statsFetcherType);
}
2 changes: 2 additions & 0 deletions cloud/blockstore/libs/diagnostics/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,8 @@ class TDiagnosticsConfig
TRequestThresholds GetRequestThresholds() const;
EHistogramCounterOptions GetHistogramCounterOptions() const;

NProto::EStatsFetcherType GetStatsFetcherType() const;

void Dump(IOutputStream& out) const;
void DumpHtml(IOutputStream& out) const;
};
Expand Down
Loading

0 comments on commit 50f14dd

Please sign in to comment.