Skip to content

Commit

Permalink
NBSNEBIUS-86: rendering raw volume config (pretty-printed proto) on v…
Browse files Browse the repository at this point in the history
…olume monpage (#220)

* NBSNEBIUS-86: rendering raw volume config (pretty-printed proto) on volume monpage

* NBSNEBIUS-86: rendering raw volume config (pretty-printed proto) on volume monpage
  • Loading branch information
qkrorlqr authored Jan 24, 2024
1 parent b3e0004 commit 6698b18
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
1 change: 1 addition & 0 deletions cloud/blockstore/libs/storage/volume/volume_actor.h
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,7 @@ class TVolumeActor final
void RenderCheckpoints(IOutputStream& out) const;
void RenderTraces(IOutputStream& out) const;
void RenderStorageConfig(IOutputStream& out) const;
void RenderRawVolumeConfig(IOutputStream& out) const;
void RenderCommonButtons(IOutputStream& out) const;

void OnDetach(const NActors::TActorContext& ctx) override;
Expand Down
29 changes: 29 additions & 0 deletions cloud/blockstore/libs/storage/volume/volume_actor_monitoring.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,7 @@ void TVolumeActor::HandleHttpInfo_Default(
const char* checkpointsTabName = "Checkpoints";
const char* tracesTabName = "Traces";
const char* storageConfigTabName = "StorageConfig";
const char* rawVolumeConfigTabName = "RawVolumeConfig";

const char* activeTab = "tab-pane active";
const char* inactiveTab = "tab-pane";
Expand All @@ -457,6 +458,7 @@ void TVolumeActor::HandleHttpInfo_Default(
const char* checkpointsTab = inactiveTab;
const char* tracesTab = inactiveTab;
const char* storageConfigTab = inactiveTab;
const char* rawVolumeConfigTab = inactiveTab;

if (tabName.Empty() || tabName == overviewTabName) {
overviewTab = activeTab;
Expand All @@ -468,6 +470,8 @@ void TVolumeActor::HandleHttpInfo_Default(
tracesTab = activeTab;
} else if (tabName == storageConfigTabName) {
storageConfigTab = activeTab;
} else if (tabName == rawVolumeConfigTabName) {
rawVolumeConfigTab = activeTab;
}

TStringStream out;
Expand Down Expand Up @@ -497,6 +501,10 @@ void TVolumeActor::HandleHttpInfo_Default(
DIV_CLASS_ID(storageConfigTab, storageConfigTabName) {
RenderStorageConfig(out);
}

DIV_CLASS_ID(rawVolumeConfigTab, rawVolumeConfigTabName) {
RenderRawVolumeConfig(out);
}
}
}
}
Expand Down Expand Up @@ -777,6 +785,27 @@ void TVolumeActor::RenderStorageConfig(IOutputStream& out) const
}
}

void TVolumeActor::RenderRawVolumeConfig(IOutputStream& out) const
{
if (!State) {
return;
}

const auto& volumeConfig = State->GetMeta().GetVolumeConfig();

HTML(out) {
DIV_CLASS("row") {
TAG(TH3) {
out << "RawVolumeConfig";
}

PRE() {
SerializeToTextFormatPretty(volumeConfig, out);
}
}
}
}

void TVolumeActor::RenderHtmlInfo(IOutputStream& out, TInstant now) const
{
using namespace NMonitoringUtils;
Expand Down

0 comments on commit 6698b18

Please sign in to comment.