Skip to content

Commit f997089

Browse files
authored
fix clusterName and node_type in UA meta session (#11240)
1 parent bd4a911 commit f997089

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

ydb/core/log_backend/log_backend.cpp

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,18 +49,20 @@ TAutoPtr<TLogBackend> CreateLogBackendWithUnifiedAgent(
4949
{
5050
if (runConfig.AppConfig.HasLogConfig()) {
5151
const auto& logConfig = runConfig.AppConfig.GetLogConfig();
52+
const auto& dnConfig = runConfig.AppConfig.GetDynamicNameserviceConfig();
5253
TAutoPtr<TLogBackend> logBackend = TLogBackendBuildHelper::CreateLogBackendFromLogConfig(logConfig);
5354
if (logConfig.HasUAClientConfig()) {
5455
const auto& uaClientConfig = logConfig.GetUAClientConfig();
5556
auto uaCounters = GetServiceCounters(counters, "utils")->GetSubgroup("subsystem", "ua_client");
5657
auto logName = uaClientConfig.GetLogName();
58+
auto maxStaticNodeId = dnConfig.GetMaxStaticNodeId();
5759
TAutoPtr<TLogBackend> uaLogBackend = TLogBackendBuildHelper::CreateLogBackendFromUAClientConfig(
5860
uaClientConfig,
5961
uaCounters,
6062
logName,
61-
runConfig.TenantName == "" ? "static" : "slot",
63+
runConfig.NodeId <= maxStaticNodeId ? "static" : "slot",
6264
runConfig.TenantName,
63-
runConfig.ClusterName
65+
logConfig.HasClusterName() ? logConfig.GetClusterName() : ""
6466
);
6567
logBackend = logBackend ? NActors::CreateCompositeLogBackend({logBackend, uaLogBackend}) : uaLogBackend;
6668
}
@@ -93,18 +95,20 @@ TAutoPtr<TLogBackend> CreateMeteringLogBackendWithUnifiedAgent(
9395

9496
if (meteringConfig.GetUnifiedAgentEnable() && runConfig.AppConfig.HasLogConfig() && runConfig.AppConfig.GetLogConfig().HasUAClientConfig()) {
9597
const auto& logConfig = runConfig.AppConfig.GetLogConfig();
98+
const auto& dnConfig = runConfig.AppConfig.GetDynamicNameserviceConfig();
9699
const auto& uaClientConfig = logConfig.GetUAClientConfig();
97100
auto uaCounters = GetServiceCounters(counters, "utils")->GetSubgroup("subsystem", "ua_client");
98101
auto logName = meteringConfig.HasLogName()
99102
? meteringConfig.GetLogName()
100103
: uaClientConfig.GetLogName();
104+
auto maxStaticNodeId = dnConfig.GetMaxStaticNodeId();
101105
TAutoPtr<TLogBackend> uaLogBackend = TLogBackendBuildHelper::CreateLogBackendFromUAClientConfig(
102106
uaClientConfig,
103107
uaCounters,
104108
logName,
105-
runConfig.TenantName == "" ? "static" : "slot",
109+
runConfig.NodeId <= maxStaticNodeId ? "static" : "slot",
106110
runConfig.TenantName,
107-
runConfig.ClusterName
111+
logConfig.HasClusterName() ? logConfig.GetClusterName() : ""
108112
);
109113
logBackend = logBackend ? NActors::CreateCompositeLogBackend({logBackend, uaLogBackend}) : uaLogBackend;
110114
}
@@ -148,18 +152,20 @@ TAutoPtr<TLogBackend> CreateAuditLogUnifiedAgentBackend(
148152
const auto& auditConfig = runConfig.AppConfig.GetAuditConfig();
149153
if (auditConfig.HasUnifiedAgentBackend() && runConfig.AppConfig.HasLogConfig() && runConfig.AppConfig.GetLogConfig().HasUAClientConfig()) {
150154
const auto& logConfig = runConfig.AppConfig.GetLogConfig();
155+
const auto& dnConfig = runConfig.AppConfig.GetDynamicNameserviceConfig();
151156
const auto& uaClientConfig = logConfig.GetUAClientConfig();
152157
auto uaCounters = GetServiceCounters(counters, "utils")->GetSubgroup("subsystem", "ua_client");
153158
auto logName = runConfig.AppConfig.GetAuditConfig().GetUnifiedAgentBackend().HasLogName()
154159
? runConfig.AppConfig.GetAuditConfig().GetUnifiedAgentBackend().GetLogName()
155160
: uaClientConfig.GetLogName();
161+
auto maxStaticNodeId = dnConfig.GetMaxStaticNodeId();
156162
logBackend = TLogBackendBuildHelper::CreateLogBackendFromUAClientConfig(
157163
uaClientConfig,
158164
uaCounters,
159165
logName,
160-
runConfig.TenantName == "" ? "static" : "slot",
166+
runConfig.NodeId <= maxStaticNodeId ? "static" : "slot",
161167
runConfig.TenantName,
162-
runConfig.ClusterName
168+
logConfig.HasClusterName() ? logConfig.GetClusterName() : ""
163169
);
164170
}
165171

0 commit comments

Comments
 (0)