aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortesseract <tesseract@yandex-team.com>2023-09-10 23:07:25 +0300
committertesseract <tesseract@yandex-team.com>2023-09-10 23:21:40 +0300
commit940b5064c5938f159c71a8b517a0aeb0fd67ba5c (patch)
treec3745e399cc8e1338a3910a8ab8856c40b6ddd12
parent3d61b02a6ceff7d08b0d9d71f6a38e9babfad500 (diff)
downloadydb-940b5064c5938f159c71a8b517a0aeb0fd67ba5c.tar.gz
fix use not uninitialized value
-rw-r--r--ydb/core/kafka_proxy/kafka_metrics.cpp22
1 files changed, 18 insertions, 4 deletions
diff --git a/ydb/core/kafka_proxy/kafka_metrics.cpp b/ydb/core/kafka_proxy/kafka_metrics.cpp
index 758f128d7bc..c09a9790299 100644
--- a/ydb/core/kafka_proxy/kafka_metrics.cpp
+++ b/ydb/core/kafka_proxy/kafka_metrics.cpp
@@ -4,10 +4,24 @@
namespace NKafka {
TVector<std::pair<TString, TString>> BuildLabels(const NKafka::TContext::TPtr context, const TString& method, const TString& topic, const TString& name, const TString& errorCode) {
- return {{"counters", context->IsServerless ? "datastreams_serverless" : "datastreams"},
- {"database", context->DatabasePath}, {"method", method}, {"cloud_id", context->CloudId},
- {"folder_id", context->FolderId}, {"database_id", context->DatabaseId},
- {"topic", topic}, {"error_code", errorCode}, {"name", name}};
+ if (context->Authenticated()) {
+ return {{"counters", context->IsServerless ? "datastreams_serverless" : "datastreams"},
+ {"database", context->DatabasePath},
+ {"method", method},
+ {"cloud_id", context->CloudId},
+ {"folder_id", context->FolderId},
+ {"database_id", context->DatabaseId},
+ {"topic", topic},
+ {"error_code", errorCode},
+ {"name", name}};
+ } else {
+ return {{"counters", "datastreams"},
+ {"method", method},
+ {"topic", topic},
+ {"error_code", errorCode},
+ {"name", name}};
+
+ }
}
TActorId MakeKafkaMetricsServiceID() {