From 1e601f259b7543fb3d02f8a4e4ecc970c018c06c Mon Sep 17 00:00:00 2001 From: Hardy Date: Tue, 18 Feb 2025 20:29:41 +0800 Subject: [PATCH] chore: update agent config with cluster name (#148) * chore: update agent config with cluster name * docs: update release-notes --------- Co-authored-by: hardy --- config/setup/common/data/task_config_tpl.dat | 2 ++ docs/content.en/docs/release-notes/_index.md | 3 +++ docs/content.zh/docs/release-notes/_index.md | 3 +++ modules/agent/api/remote_config.go | 5 ++++- 4 files changed, 12 insertions(+), 1 deletion(-) diff --git a/config/setup/common/data/task_config_tpl.dat b/config/setup/common/data/task_config_tpl.dat index d41d6d91..c12fcb47 100644 --- a/config/setup/common/data/task_config_tpl.dat +++ b/config/setup/common/data/task_config_tpl.dat @@ -34,6 +34,7 @@ pipeline: labels: cluster_id: $[[CLUSTER_ID]] cluster_uuid: $[[CLUSTER_UUID]] + cluster_name: $[[CLUSTER_NAME]] when: cluster_available: ["$[[TASK_ID]]"] @@ -49,6 +50,7 @@ pipeline: labels: cluster_id: $[[CLUSTER_ID]] cluster_uuid: $[[CLUSTER_UUID]] + cluster_name: $[[CLUSTER_NAME]] logs_path: $[[NODE_LOGS_PATH]] queue_name: logs when: diff --git a/docs/content.en/docs/release-notes/_index.md b/docs/content.en/docs/release-notes/_index.md index 95013401..17a9e2a0 100644 --- a/docs/content.en/docs/release-notes/_index.md +++ b/docs/content.en/docs/release-notes/_index.md @@ -6,6 +6,7 @@ title: "Release Notes" # Release Notes Information about release notes of INFINI Console is provided here. + ## Latest (In development) ### Breaking changes @@ -15,7 +16,9 @@ Information about release notes of INFINI Console is provided here. ### Bug fix - Fixed the error when querying empty metric data (#144) - Fixed empty host when setup step finishes (#147) + ### Improvements +- Update agent config with cluster name (#148) ## 1.28.2 (2025-02-15) diff --git a/docs/content.zh/docs/release-notes/_index.md b/docs/content.zh/docs/release-notes/_index.md index 11af2ec1..50e53813 100644 --- a/docs/content.zh/docs/release-notes/_index.md +++ b/docs/content.zh/docs/release-notes/_index.md @@ -6,6 +6,7 @@ title: "版本历史" # 版本发布日志 这里是 INFINI Console 历史版本发布的相关说明。 + ## Latest (In development) ### Breaking changes @@ -15,7 +16,9 @@ title: "版本历史" ### Bug fix - 修复指标数据为空时的查询错误 (#144) - 修复初始化结束步骤中主机显示为错误的问题 (#147) + ### Improvements +- 优化下发给 Agent 的配置,增加集群名称 (#148) ## 1.28.2 (2025-02-15) diff --git a/modules/agent/api/remote_config.go b/modules/agent/api/remote_config.go index b8badf2f..25c6bf48 100644 --- a/modules/agent/api/remote_config.go +++ b/modules/agent/api/remote_config.go @@ -199,11 +199,13 @@ func getAgentIngestConfigs(instance string, items map[string]BindingItem) (strin var password = "" var version = "" var distribution = "" + var clusterName = "" if metadata.Config != nil { version = metadata.Config.Version distribution = metadata.Config.Distribution + clusterName = metadata.Config.Name if metadata.Config.AgentCredentialID != "" { credential, err := common2.GetCredential(metadata.Config.AgentCredentialID) @@ -250,6 +252,7 @@ func getAgentIngestConfigs(instance string, items map[string]BindingItem) (strin "variable:\n "+ "TASK_ID: %v\n "+ "CLUSTER_ID: %v\n "+ + "CLUSTER_NAME: %v\n "+ "CLUSTER_UUID: %v\n "+ "NODE_UUID: %v\n "+ "CLUSTER_VERSION: %v\n "+ @@ -260,7 +263,7 @@ func getAgentIngestConfigs(instance string, items map[string]BindingItem) (strin "CLUSTER_LEVEL_TASKS_ENABLED: %v\n "+ "NODE_LEVEL_TASKS_ENABLED: %v\n "+ "NODE_LOGS_PATH: \"%v\"\n\n\n", taskID, taskID, - v.ClusterID, v.ClusterUUID, v.NodeUUID, version, distribution, nodeEndPoint, username, password, clusterLevelEnabled, nodeLevelEnabled, pathLogs))) + v.ClusterID, clusterName, v.ClusterUUID, v.NodeUUID, version, distribution, nodeEndPoint, username, password, clusterLevelEnabled, nodeLevelEnabled, pathLogs))) } hash := util.MD5digest(buffer.String())