From 7f17f5b602ec07bcd10a6fabb17ca4e02c7699fd Mon Sep 17 00:00:00 2001 From: Vitaly Isaev Date: Mon, 9 Dec 2024 20:08:29 +0300 Subject: [PATCH] Logging: minor changes (#219) --- app/server/datasource/rdbms/logging/resolver.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/app/server/datasource/rdbms/logging/resolver.go b/app/server/datasource/rdbms/logging/resolver.go index 98f5dedd..a01ccf65 100644 --- a/app/server/datasource/rdbms/logging/resolver.go +++ b/app/server/datasource/rdbms/logging/resolver.go @@ -44,21 +44,26 @@ type staticResolver struct { func (r *staticResolver) resolve( request *resolveParams, ) (*resolveResponse, error) { + if len(r.cfg.Databases) == 0 { + return nil, fmt.Errorf("no YDB endpoints provided") + } + // get random YDB endpoint from provided list ix := rand.Intn(len(r.cfg.Databases)) + endpoint := r.cfg.Databases[ix].Endpoint databaseName := r.cfg.Databases[ix].Name // pick a preconfigured folder folder, exists := r.cfg.Folders[request.folderId] if !exists { - return nil, fmt.Errorf("folder_id %s is missing", request.folderId) + return nil, fmt.Errorf("folder_id '%s' is missing", request.folderId) } // resolve log group name into log group id logGroupId, exists := folder.LogGroups[request.logGroupName] if !exists { - return nil, fmt.Errorf("log group %s is missing", request.logGroupName) + return nil, fmt.Errorf("log group '%s' is missing", request.logGroupName) } tableName := fmt.Sprintf("logs/origin/yc.logs.cloud/%s/%s", request.folderId, logGroupId)