Skip to content

[NBS] Open different YDB graphs depending on the channel kind #3540

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

Georg-0001
Copy link

This request solves point 4 from [NBS] monitoring pages issues #3504.

Now, Graphs button leads to different pages depending on Channel type.
For all types of channel a histograms with handle classes: GetFast and PutUserData is constructed.

For Log type additionally constructed histogram with handle class: PutTabletLog.

For Merged and Mixed types additionally constructed histograms with handle classes:
GetAsync and PutAsyncBlob.

Copy link
Contributor

Hi! Thank you for contributing!
The tests on this PR will run after a maintainer adds an ok-to-test label to this PR manually. Thank you for your patience!

@Georg-0001
Copy link
Author

Georg-0001 commented May 20, 2025

Извиняюсь, не увидел комментарии по предыдущему pull request
(не включил git config core.hooksPath.githooks и снова лишний файл settings.json)

@Georg-0001 Georg-0001 force-pushed the Graph-button-Monitoring-pages-issues-3504 branch from f4863a6 to 291ed19 Compare May 20, 2025 09:32
@Georg-0001
Copy link
Author

убрал settings.json

@komarevtsev-d komarevtsev-d self-requested a review May 21, 2025 05:29
@komarevtsev-d komarevtsev-d added ok-to-test Label to approve test launch for external members blockstore Add this label to run only cloud/blockstore build and tests on PR labels May 21, 2025
@github-actions github-actions bot removed the ok-to-test Label to approve test launch for external members label May 21, 2025
Copy link
Contributor

github-actions bot commented May 21, 2025

Note

This is an automated comment that will be appended during run.

🔴 linux-x86_64-relwithdebinfo: some tests FAILED for commit 291ed19.

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
4942 4941 0 1 0 0

🔴 linux-x86_64-relwithdebinfo: some tests FAILED for commit 291ed19.

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
4942 4941 0 1 0 0

🔴 linux-x86_64-relwithdebinfo: some tests FAILED for commit 291ed19.

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
4942 4941 0 1 0 0

@komarevtsev-d komarevtsev-d added large-tests Launch large tests for PR ok-to-test Label to approve test launch for external members labels May 21, 2025
@github-actions github-actions bot removed the ok-to-test Label to approve test launch for external members label May 21, 2025
R"(", host="*", service="vdisks", subsystem="latency_histo", handleclass="PutTabletLog"})&q.2.name=C)";
constexpr TStringBuf GetAsync =
R"(q.2.s=histogram_percentile(100, {project="kikimr", cluster="*", storagePool="%s", group="%)" PRIu32
R"(", host="*", service="vdisks", subsystem="latency_histo", handleclass="GetAsync"})&q.2.name=C)";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

name=D

R"(", host="*", service="vdisks", subsystem="latency_histo", handleclass="GetAsync"})&q.2.name=C)";
constexpr TStringBuf PutAsyncBlob =
R"(q.3.s=histogram_percentile(100, {project="kikimr", cluster="*", storagePool="%s", group="%)" PRIu32
R"(", host="*", service="vdisks", subsystem="latency_histo", handleclass="PutAsyncBlob"})&q.3.name=D)";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

name=E

@@ -118,23 +118,54 @@ TString GetMonitoringNBSOverviewToTVUrl(const TDiagnosticsConfig& config)
TString GetMonitoringYDBGroupUrl(
const TDiagnosticsConfig& config,
ui32 groupId,
const TString& storagePool)
const TString& storagePool,
const TString& dataKind)
{
constexpr TStringBuf GetFast =
R"(q.0.s=histogram_percentile(100, {project="kikimr", cluster="*", storagePool="%s", group="%)" PRIu32
R"(", host="*", service="vdisks", subsystem="latency_histo", handleclass="GetFast"})&q.0.name=A)";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Внутри всех этих строк повторяется весь текст, кроме handleclass.
Давай сделаем один шаблон, а в него будем подставлять нужный handleclass.

Предлагаю сделать функцию, которая принимает строку dataKind (например "Mixed"), а возвращает уже нужную строку с queries.
Внутри функции у тебя один шаблон

constexpr TStringBuf GetFast =
        R"(q.0.s=histogram_percentile(100, {project="kikimr", cluster="*", storagePool="%s", group="%)" PRIu32
        R"(", host="*", service="vdisks", subsystem="latency_histo", handleclass="%s"})&q.0.name=%s)";

Ты его заполняешь через Sprintf и добавляешь у результату.
Только учти что name должен быть везде разные, но это не должно стать проблемой.

Для каждого dataKind сделай constexpr array тех handleclass которые ты хочешь видеть

Copy link
Collaborator

@komarevtsev-d komarevtsev-d left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

поправить

Copy link
Contributor

Note

This is an automated comment that will be appended during run.

🟢 linux-x86_64-relwithdebinfo: all tests PASSED for commit 8ee1c58.

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
5359 5359 0 0 0 0

@komarevtsev-d komarevtsev-d added the ok-to-test Label to approve test launch for external members label May 23, 2025
@github-actions github-actions bot removed the ok-to-test Label to approve test launch for external members label May 23, 2025
Copy link
Contributor

Note

This is an automated comment that will be appended during run.

🟢 linux-x86_64-relwithdebinfo: all tests PASSED for commit a5cae67.

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
5359 5359 0 0 0 0

@Georg-0001 Georg-0001 requested a review from komarevtsev-d May 27, 2025 08:59
constexpr std::array<TStringBuf, 4> MergedAndMixedHandleclasses(
{"GetFast", "PutUserData", "GetAsync", "PutAsyncBlob"});

constexpr std::array<TStringBuf, 4> QueryNames({"A", "B", "C", "D"});
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Можно просто на месте

char queryName = 'A';
++queryName;

constexpr std::array<TStringBuf, 3> LogHandleclasses(
{"GetFast", "PutUserData", "PutTabletLog"});
constexpr std::array<TStringBuf, 4> MergedAndMixedHandleclasses(
{"GetFast", "PutUserData", "GetAsync", "PutAsyncBlob"});
Copy link
Collaborator

@komarevtsev-d komarevtsev-d May 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Функция в анонимном namespace

[[nodiscard]] std::span<const TStringBuf> GetHandleClasses(const TString& dataKind)
{
    constexpr std::array<TStringBuf, 2> DefaultHandleclasses(
        {"GetFast", "PutUserData"});
    constexpr std::array<TStringBuf, 3> LogHandleclasses(
        {"GetFast", "PutUserData", "PutTabletLog"});
    constexpr std::array<TStringBuf, 4> MergedAndMixedHandleclasses(
        {"GetFast", "PutUserData", "GetAsync", "PutAsyncBlob"});

    if (dataKind == "Log") {
        return LogHandleclasses;
    } else if (dataKind == "Merged" || dataKind == "Mixed") {
        return MergedAndMixedHandleclasses;
    }

    return DefaultHandleclasses;
}

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

А дальше у тебя один цикл вместо N циклов

@Georg-0001 Georg-0001 requested a review from komarevtsev-d May 28, 2025 07:34
Copy link
Contributor

Note

This is an automated comment that will be appended during run.

🟢 linux-x86_64-relwithdebinfo: all tests PASSED for commit 382b61b.

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
5359 5359 0 0 0 0

@@ -5,13 +5,22 @@
#include <util/generic/string.h>
#include <util/string/builder.h>
#include <util/system/hostname.h>
#include <array>
#include <span>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-format

constexpr std::array<const char*, 3> LogHandleClasses(
{"GetFast", "PutUserData", "PutTabletLog"});
constexpr std::array<const char*, 4> MergedAndMixedHandleClasses(
{"GetFast", "PutUserData", "GetAsync", "PutAsyncBlob"});
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Они в одной функции же только используются? Можно было прям там внутри и оставить

Copy link
Author

@Georg-0001 Georg-0001 May 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Там мы из функции возвращаем std::span, поэтому если внтури функции их объявить, то
указатель на строку протухнет и будет ошибка (вначале сделал так и не работало).

{"GetFast", "PutUserData"});
constexpr std::array<const char*, 3> LogHandleClasses(
{"GetFast", "PutUserData", "PutTabletLog"});
constexpr std::array<const char*, 4> MergedAndMixedHandleClasses(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

А куда TStringBuf подевался?

++queryName;
}

return queries.c_str();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return queries;

@@ -77,11 +77,15 @@ void DumpDownGroups(
for (const TTabletChannelInfo& channelInfo:
matchedInfos)
{
TString dataKind = TStringBuilder()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Давай по всему ПРу переименуем channelDataKind в channelKind
  2. А зачем ты тут преобразуешь в строку, если можно использовать EChannelDataKind? И возможность switch написать появится

@Georg-0001 Georg-0001 requested a review from komarevtsev-d May 29, 2025 11:15
Copy link
Contributor

Note

This is an automated comment that will be appended during run.

🟢 linux-x86_64-relwithdebinfo: all tests PASSED for commit 2a14694.

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
5359 5359 0 0 0 0

@komarevtsev-d komarevtsev-d changed the title [NBS] monitoring pages issues #3504 (Updated Graphs button) [NBS] Open different YDB graphs depending on the channel kind Jun 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blockstore Add this label to run only cloud/blockstore build and tests on PR large-tests Launch large tests for PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants