diff options
| author | ydynnikov <[email protected]> | 2026-02-27 11:19:31 +0300 |
|---|---|---|
| committer | ydynnikov <[email protected]> | 2026-02-27 11:46:39 +0300 |
| commit | dd6207e99ab45fa85073d60ca22fdd9c7527f8ff (patch) | |
| tree | ac65137f797eec8d29a0d8db4c889164ce3e2cee /library/cpp/monlib/encode | |
| parent | 46878746325da24b281589e6f63bc256be0652d7 (diff) | |
Enhance library/cpp/monlib exception verbosity for debugging
Этот эксепшн ронял YDB RU PRESTABLE минимум дважды:
\- 2025-09-10 <https://nda.ya.ru/t/VerKgHXk7VTLyV>
\- 2026-02-19 <https://nda.ya.ru/t/uhTY2yqK7UtBen>
Патч призван упростить отладку падений и поиски руткоза
commit_hash:72d859bae3ab265a2807e566c763bfb70a92a61a
Diffstat (limited to 'library/cpp/monlib/encode')
| -rw-r--r-- | library/cpp/monlib/encode/json/json_encoder.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/library/cpp/monlib/encode/json/json_encoder.cpp b/library/cpp/monlib/encode/json/json_encoder.cpp index 2af058155a8..4394685512c 100644 --- a/library/cpp/monlib/encode/json/json_encoder.cpp +++ b/library/cpp/monlib/encode/json/json_encoder.cpp @@ -11,6 +11,7 @@ #include <util/charset/utf8.h> #include <util/generic/algorithm.h> +#include <util/string/escape.h> namespace NMonitoring { namespace { @@ -174,8 +175,12 @@ namespace NMonitoring { } void WriteLabel(TStringBuf name, TStringBuf value) { - Y_ENSURE(IsUtf(name), "label name is not valid UTF-8 string"); - Y_ENSURE(IsUtf(value), "label value is not valid UTF-8 string"); + if (!IsUtf(name)) { + ythrow yexception() << "label name is not valid UTF-8 string: '" << EscapeC(name.SubStr(0, 100)) << "'"; + } else if (!IsUtf(value)) { + ythrow yexception() << "label value is not valid UTF-8 string, name: '" << name << "', value: '" << EscapeC(value.SubStr(0, 100)) << "'"; + } + if (Style_ == EJsonStyle::Cloud && name == MetricNameLabel_) { CurrentMetricName_ = value; } else { |
