Skip to content

Commit 357a5e3

Browse files
authored
Add configuration version in GUI and metrics (#17593)
1 parent f219cc1 commit 357a5e3

File tree

3 files changed

+29
-2
lines changed

3 files changed

+29
-2
lines changed

ydb/core/base/counters.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ LWTRACE_DEFINE_PROVIDER(MONITORING_PROVIDER)
77
namespace NKikimr {
88

99
static const THashSet<TString> DATABASE_SERVICES
10-
= {{ TString("compile"),
10+
= {{
11+
TString("compile"),
12+
TString("config"),
1113
TString("coordinator"),
1214
TString("dsproxy"),
1315
TString("dsproxy_mon"),

ydb/core/cms/console/configs_dispatcher.cpp

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,8 @@ class TConfigsDispatcher : public TActorBootstrapped<TConfigsDispatcher> {
251251
bool StartupConfigProcessDiff = false;
252252
TString StartupConfigInfo;
253253
::NMonitoring::TDynamicCounters::TCounterPtr StartupConfigChanged;
254+
::NMonitoring::TDynamicCounters::TCounterPtr ConfigurationV1;
255+
::NMonitoring::TDynamicCounters::TCounterPtr ConfigurationV2;
254256
const std::optional<TDebugInfo> DebugInfo;
255257
std::shared_ptr<NConfig::TRecordedInitialConfiguratorDeps> RecordedInitialConfiguratorDeps;
256258
std::vector<TString> Args;
@@ -298,8 +300,18 @@ void TConfigsDispatcher::Bootstrap()
298300
}
299301
TIntrusivePtr<NMonitoring::TDynamicCounters> rootCounters = AppData()->Counters;
300302
TIntrusivePtr<NMonitoring::TDynamicCounters> authCounters = GetServiceCounters(rootCounters, "config");
301-
NMonitoring::TDynamicCounterPtr counters = authCounters->GetSubgroup("subsystem", "ConfigsDispatcher");
303+
NMonitoring::TDynamicCounterPtr counters = authCounters->GetSubgroup("subsystem", "configs_dispatcher");
302304
StartupConfigChanged = counters->GetCounter("StartupConfigChanged", true);
305+
ConfigurationV1 = counters->GetCounter("ConfigurationV1", true);
306+
ConfigurationV2 = counters->GetCounter("ConfigurationV2", false);
307+
308+
if (Labels.contains("configuration_version")) {
309+
if (Labels.at("configuration_version") == "v1") {
310+
*ConfigurationV1 = 1;
311+
} else {
312+
*ConfigurationV2 = 1;
313+
}
314+
}
303315

304316
auto commonClient = CreateConfigsSubscriber(
305317
SelfId(),
@@ -522,6 +534,7 @@ void TConfigsDispatcher::Handle(TEvInterconnect::TEvNodesInfo::TPtr &ev)
522534

523535
DIV_CLASS("container") {
524536
DIV_CLASS("navbar navbar-expand-lg navbar-light bg-light") {
537+
str << "<style>.navbar { z-index: 1030; position: relative; }</style>" << Endl;
525538
DIV_CLASS("navbar-collapse") {
526539
UL_CLASS("navbar-nav mr-auto") {
527540
LI_CLASS("nav-item") {
@@ -534,6 +547,17 @@ void TConfigsDispatcher::Handle(TEvInterconnect::TEvNodesInfo::TPtr &ev)
534547
}
535548
}
536549
}
550+
551+
DIV_CLASS("alert alert-info") {
552+
str << "<style>.alert-info { position: relative; z-index: 1020; }</style>" << Endl;
553+
str << "<strong>Configuration version: </strong>";
554+
if (Labels.contains("configuration_version")) {
555+
str << Labels.at("configuration_version");
556+
} else {
557+
str << "unknown";
558+
}
559+
}
560+
537561
DIV_CLASS("tab-left") {
538562
COLLAPSED_REF_CONTENT("node-labels", "Node labels") {
539563
PRE() {

ydb/core/config/init/init_impl.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1402,6 +1402,7 @@ class TInitialConfiguratorImpl
14021402
configsDispatcherInitInfo.StartupConfigYaml = appConfig.GetStartupConfigYaml();
14031403
configsDispatcherInitInfo.ItemsServeRules = std::monostate{},
14041404
configsDispatcherInitInfo.Labels = Labels;
1405+
configsDispatcherInitInfo.Labels["configuration_version"] = appConfig.GetConfigDirPath() ? "v2" : "v1";
14051406
configsDispatcherInitInfo.DebugInfo = TDebugInfo {
14061407
.InitInfo = InitDebug.ConfigTransformInfo,
14071408
};

0 commit comments

Comments
 (0)