Skip to content

Commit 3402e32

Browse files
authored
Merge 9808273 into f2a67c6
2 parents f2a67c6 + 9808273 commit 3402e32

File tree

7 files changed

+38
-5
lines changed

7 files changed

+38
-5
lines changed

ydb/core/config/init/init.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ class TDefaultNodeBrokerClient
172172
nodeInfo.SetAddress(node.Address);
173173
nodeInfo.SetExpire(node.Expire);
174174
NConfig::CopyNodeLocation(nodeInfo.MutableLocation(), node.Location);
175+
nodeInfo.SetSlotName(result.GetSlotName());
175176
} else {
176177
auto &info = *nsConfig.AddNode();
177178
info.SetNodeId(node.NodeId);

ydb/core/config/init/init_impl.h

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -593,8 +593,23 @@ struct TCommonAppOptions {
593593
ConfigUpdateTracer.AddUpdate(NKikimrConsole::TConfigItem::TenantPoolConfigItem, TConfigItemInfo::EUpdateKind::UpdateExplicitly);
594594
}
595595

596-
if (TenantName && InterconnectPort != DefaultInterconnectPort) {
597-
appConfig.MutableMonitoringConfig()->SetHostLabelOverride(HostAndICPort(env));
596+
if (TenantName) {
597+
if (appConfig.GetDynamicNodeConfig().GetNodeInfo().HasSlotName()) {
598+
const TString& slotName = appConfig.GetDynamicNodeConfig().GetNodeInfo().GetSlotName();
599+
appConfig.MutableMonitoringConfig()->SetHostLabelOverride(slotName);
600+
ConfigUpdateTracer.AddUpdate(NKikimrConsole::TConfigItem::MonitoringConfigItem, TConfigItemInfo::EUpdateKind::UpdateExplicitly);
601+
} else if (InterconnectPort != DefaultInterconnectPort) {
602+
appConfig.MutableMonitoringConfig()->SetHostLabelOverride(HostAndICPort(env));
603+
ConfigUpdateTracer.AddUpdate(NKikimrConsole::TConfigItem::MonitoringConfigItem, TConfigItemInfo::EUpdateKind::UpdateExplicitly);
604+
}
605+
}
606+
607+
if (TenantName) {
608+
if (InterconnectPort == DefaultInterconnectPort) {
609+
appConfig.MutableMonitoringConfig()->SetProcessLocation(Host(env));
610+
} else {
611+
appConfig.MutableMonitoringConfig()->SetProcessLocation(HostAndICPort(env));
612+
}
598613
ConfigUpdateTracer.AddUpdate(NKikimrConsole::TConfigItem::MonitoringConfigItem, TConfigItemInfo::EUpdateKind::UpdateExplicitly);
599614
}
600615

@@ -682,10 +697,17 @@ struct TCommonAppOptions {
682697
}
683698

684699
TString HostAndICPort(IEnv& env) const {
700+
auto hostname = Host(env);
701+
if (!hostname) {
702+
return "";
703+
}
704+
return TStringBuilder() << hostname << ":" << InterconnectPort;
705+
}
706+
707+
TString Host(IEnv& env) const {
685708
try {
686709
auto hostname = to_lower(env.HostName());
687-
hostname = hostname.substr(0, hostname.find('.'));
688-
return TStringBuilder() << hostname << ":" << InterconnectPort;
710+
return hostname.substr(0, hostname.find('.'));
689711
} catch (TSystemError& error) {
690712
return "";
691713
}

ydb/core/driver_lib/run/kikimr_services_initializers.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2103,7 +2103,7 @@ void TKqpServiceInitializer::InitializeServices(NActors::TActorSystemSetup* setu
21032103

21042104
auto kqpProxySharedResources = std::make_shared<NKqp::TKqpProxySharedResources>();
21052105

2106-
// Crate resource manager
2106+
// Create resource manager
21072107
auto rm = NKqp::CreateKqpResourceManagerActor(Config.GetTableServiceConfig().GetResourceManager(), nullptr,
21082108
{}, kqpProxySharedResources);
21092109
setup->LocalServices.push_back(std::make_pair(

ydb/core/protos/node_broker.proto

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ message TNodeInfo {
2020
optional string Address = 5;
2121
optional NActorsInterconnect.TNodeLocation Location = 6;
2222
optional uint64 Expire = 7;
23+
optional string SlotName = 8;
2324
}
2425

2526
message TEpoch {

ydb/public/api/protos/ydb_discovery.proto

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,8 @@ message NodeRegistrationResult {
103103
repeated NodeInfo nodes = 4;
104104
optional uint64 scope_tablet_id = 5;
105105
optional uint64 scope_path_id = 6;
106+
// A unique name within the tenant generated by the system
107+
optional string slot_name = 7;
106108
}
107109

108110
message NodeRegistrationResponse {

ydb/public/sdk/cpp/client/ydb_discovery/discovery.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ TNodeRegistrationResult::TNodeRegistrationResult(TStatus&& status, const Ydb::Di
8686
, Expire_(proto.expire())
8787
, ScopeTableId_(proto.has_scope_tablet_id() ? std::make_optional(proto.scope_tablet_id()) : std::nullopt)
8888
, ScopePathId_(proto.has_scope_path_id() ? std::make_optional(proto.scope_path_id()) : std::nullopt)
89+
, SlotName_(proto.slot_name())
8990
{
9091
const auto& nodes = proto.nodes();
9192
Nodes_.reserve(nodes.size());
@@ -122,6 +123,10 @@ bool TNodeRegistrationResult::HasScopePathId() const {
122123
return ScopePathId_.value();
123124
}
124125

126+
const TString& TNodeRegistrationResult::GetSlotName() const {
127+
return SlotName_;
128+
}
129+
125130
const TVector<TNodeInfo>& TNodeRegistrationResult::GetNodes() const {
126131
return Nodes_;
127132
}

ydb/public/sdk/cpp/client/ydb_discovery/discovery.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ class TNodeRegistrationResult : public TStatus {
109109
bool HasScopeTabletId() const;
110110
const ui64& GetScopePathId() const;
111111
bool HasScopePathId() const;
112+
const TString& GetSlotName() const;
112113
const TVector<TNodeInfo>& GetNodes() const;
113114

114115
private:
@@ -117,6 +118,7 @@ class TNodeRegistrationResult : public TStatus {
117118
ui64 Expire_;
118119
std::optional<ui64> ScopeTableId_;
119120
std::optional<ui64> ScopePathId_;
121+
TString SlotName_;
120122
TVector<TNodeInfo> Nodes_;
121123
};
122124

0 commit comments

Comments
 (0)