Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion ydb/core/cms/console/configs_dispatcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,13 @@ void TConfigsDispatcher::Bootstrap()
CurrentConfig,
0,
true,
1);
1,
{},
{},
TNodeInfo{
.Tenant = Labels.contains("tenant") ? Labels.at("tenant") : TString(""),
.NodeType = Labels.contains("node_type") ? Labels.at("node_type") : TString(""),
});
CommonSubscriptionClient = RegisterWithSameMailbox(commonClient);

Become(&TThis::StateInit);
Expand Down
32 changes: 28 additions & 4 deletions ydb/core/cms/console/console_configs_subscriber.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ class TConfigsSubscriber : public TActorBootstrapped<TConfigsSubscriber> {
bool processYaml,
ui64 version,
const TString &yamlConfig,
const TMap<ui64, TString> &volatileYamlConfigs)
const TMap<ui64, TString> &volatileYamlConfigs,
const std::optional<TNodeInfo> explicitNodeInfo)
: OwnerId(ownerId)
, Cookie(cookie)
, Kinds(kinds)
Expand All @@ -67,6 +68,15 @@ class TConfigsSubscriber : public TActorBootstrapped<TConfigsSubscriber> {
VolatileYamlConfigHashes[id] = THash<TString>()(config);
}
}

if (explicitNodeInfo) {
if (explicitNodeInfo->Tenant) {
Tenant = explicitNodeInfo->Tenant;
} else {
Tenant = "<none>";
}
NodeType = explicitNodeInfo->NodeType;
}
}

static constexpr NKikimrServices::TActivity::EType ActorActivityType() {
Expand All @@ -82,7 +92,11 @@ class TConfigsSubscriber : public TActorBootstrapped<TConfigsSubscriber> {
return;
}

SendPoolStatusRequest(ctx);
if (!Tenant) {
SendPoolStatusRequest(ctx);
} else {
Subscribe(ctx);
}
Become(&TThis::StateWork);
}

Expand Down Expand Up @@ -417,9 +431,19 @@ IActor *CreateConfigsSubscriber(
bool processYaml,
ui64 version,
const TString &yamlConfig,
const TMap<ui64, TString> &volatileYamlConfigs)
const TMap<ui64, TString> &volatileYamlConfigs,
const std::optional<TNodeInfo> explicitNodeInfo)
{
return new TConfigsSubscriber(ownerId, cookie, kinds, currentConfig, processYaml, version, yamlConfig, volatileYamlConfigs);
return new TConfigsSubscriber(
ownerId,
cookie,
kinds,
currentConfig,
processYaml,
version,
yamlConfig,
volatileYamlConfigs,
explicitNodeInfo);
}

} // namespace NKikimr::NConsole
10 changes: 9 additions & 1 deletion ydb/core/cms/console/console_configs_subscriber.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,15 @@

#include <ydb/library/actors/core/actor.h>

#include <optional>

namespace NKikimr::NConsole {

struct TNodeInfo {
TString Tenant;
TString NodeType;
};

IActor *CreateConfigsSubscriber(
const TActorId &ownerId,
const TVector<ui32> &kinds,
Expand All @@ -16,6 +23,7 @@ IActor *CreateConfigsSubscriber(
bool processYaml = false,
ui64 version = 0,
const TString &yamlConfig = {},
const TMap<ui64, TString> &volatileYamlConfigs = {});
const TMap<ui64, TString> &volatileYamlConfigs = {},
const std::optional<TNodeInfo> explicitNodeInfo = std::nullopt);

} // namespace NKikimr::NConsole
12 changes: 10 additions & 2 deletions ydb/core/cms/console/log_settings_configurator_ut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,11 @@ Y_UNIT_TEST_SUITE(TLogSettingsConfiguratorTests)

Y_UNIT_TEST(TestRemoveComponentEntries)
{
TTenantTestRuntime runtime(DefaultConsoleTestConfig());
NKikimrConfig::TAppConfig ext;
auto& label = *ext.AddLabels();
label.SetName("tenant");
label.SetValue(TENANT1_1_NAME);
TTenantTestRuntime runtime(DefaultConsoleTestConfig(), ext);
auto settings = InitLogSettingsConfigurator(runtime);
WaitForUpdate(runtime); // initial update

Expand Down Expand Up @@ -292,7 +296,11 @@ Y_UNIT_TEST_SUITE(TLogSettingsConfiguratorTests)

Y_UNIT_TEST(TestChangeDefaults)
{
TTenantTestRuntime runtime(DefaultConsoleTestConfig());
NKikimrConfig::TAppConfig ext;
auto& label = *ext.AddLabels();
label.SetName("tenant");
label.SetValue(TENANT1_1_NAME);
TTenantTestRuntime runtime(DefaultConsoleTestConfig(), ext);
auto settings = InitLogSettingsConfigurator(runtime);
WaitForUpdate(runtime); // initial update

Expand Down
Loading