From 2b781a55e08887576fc2469fe3249cf5acda3d95 Mon Sep 17 00:00:00 2001 From: Takuka0311 <1914426213@qq.com> Date: Fri, 27 Sep 2024 09:56:30 +0800 Subject: [PATCH] delete unused metrics --- core/monitor/MetricConstants.h | 11 ----------- core/monitor/MetricExportor.cpp | 4 ---- core/monitor/Monitor.cpp | 7 ------- core/monitor/metric_constants/AgentMetrics.cpp | 8 ++------ core/monitor/metric_constants/PluginMetrics.cpp | 7 ------- pkg/helper/self_metrics_constants.go | 4 +--- pluginmanager/metric_export.go | 2 -- 7 files changed, 3 insertions(+), 40 deletions(-) diff --git a/core/monitor/MetricConstants.h b/core/monitor/MetricConstants.h index 99d58e92f2..06ca0abd0b 100644 --- a/core/monitor/MetricConstants.h +++ b/core/monitor/MetricConstants.h @@ -50,11 +50,7 @@ extern const std::string METRIC_LABEL_UUID; extern const std::string METRIC_LABEL_VERSION; // metric keys -extern const std::string METRIC_AGENT_CONSOLE_PIPELINE_CONFIG_TOTAL; extern const std::string METRIC_AGENT_CPU; -extern const std::string METRIC_AGENT_CPU_GO; -extern const std::string METRIC_AGENT_CRD_PIPELINE_CONFIG_TOTAL; -extern const std::string METRIC_AGENT_ENV_PIPELINE_CONFIG_TOTAL; extern const std::string METRIC_AGENT_GO_ROUTINES_TOTAL; extern const std::string METRIC_AGENT_INSTANCE_CONFIG_TOTAL; extern const std::string METRIC_AGENT_MEMORY; @@ -144,13 +140,6 @@ extern const std::string METRIC_PLUGIN_MERGE_MULTILINE_LOG_UNMATCHED_RECORDS_TOT extern const std::string METRIC_PLUGIN_PARSE_STDERR_TOTAL; extern const std::string METRIC_PLUGIN_PARSE_STDOUT_TOTAL; -/********************************************************** -* flusher_sls -**********************************************************/ -extern const std::string METRIC_PLUGIN_NETWORK_ERROR_TOTAL; -extern const std::string METRIC_PLUGIN_QUOTA_ERROR_TOTAL; -extern const std::string METRIC_PLUGIN_RETRIES_TOTAL; - ////////////////////////////////////////////////////////////////////////// // component ////////////////////////////////////////////////////////////////////////// diff --git a/core/monitor/MetricExportor.cpp b/core/monitor/MetricExportor.cpp index e8198d8150..f82a2bbb70 100644 --- a/core/monitor/MetricExportor.cpp +++ b/core/monitor/MetricExportor.cpp @@ -38,7 +38,6 @@ const std::string METRIC_EXPORT_TYPE_GO = "direct"; const std::string METRIC_EXPORT_TYPE_CPP = "cpp_provided"; MetricExportor::MetricExportor() : mSendInterval(60), mLastSendTime(time(NULL) - (rand() % (mSendInterval / 10)) * 10) { - // mAgentCpuGo = LoongCollectorMonitor::GetInstance()->GetDoubleGauge(METRIC_AGENT_CPU_GO); mAgentMemGo = LoongCollectorMonitor::GetInstance()->GetIntGauge(METRIC_AGENT_MEMORY_GO); mAgentGoRoutines = LoongCollectorMonitor::GetInstance()->GetIntGauge(METRIC_AGENT_GO_ROUTINES_TOTAL); } @@ -173,9 +172,6 @@ void MetricExportor::PushGoCppProvidedMetrics(std::vectorSet(std::stod(metric.second)); - // } if (metric.first == METRIC_AGENT_MEMORY_GO) { mAgentMemGo->Set(std::stoi(metric.second)); } diff --git a/core/monitor/Monitor.cpp b/core/monitor/Monitor.cpp index 2888af75e5..801dfbc614 100644 --- a/core/monitor/Monitor.cpp +++ b/core/monitor/Monitor.cpp @@ -723,7 +723,6 @@ void LoongCollectorMonitor::Init() { mMetricsRecordRef, std::move(labels), std::move(dynamicLabels)); // init value mDoubleGauges[METRIC_AGENT_CPU] = mMetricsRecordRef.CreateDoubleGauge(METRIC_AGENT_CPU); - // mDoubleGauges[METRIC_AGENT_CPU_GO] = mMetricsRecordRef.CreateDoubleGauge(METRIC_AGENT_CPU_GO); mIntGauges[METRIC_AGENT_MEMORY] = mMetricsRecordRef.CreateIntGauge(METRIC_AGENT_MEMORY); mIntGauges[METRIC_AGENT_MEMORY_GO] = mMetricsRecordRef.CreateIntGauge(METRIC_AGENT_MEMORY_GO); mIntGauges[METRIC_AGENT_GO_ROUTINES_TOTAL] = mMetricsRecordRef.CreateIntGauge(METRIC_AGENT_GO_ROUTINES_TOTAL); @@ -732,12 +731,6 @@ void LoongCollectorMonitor::Init() { // mMetricsRecordRef.CreateIntGauge(METRIC_AGENT_INSTANCE_CONFIG_TOTAL); mIntGauges[METRIC_AGENT_PIPELINE_CONFIG_TOTAL] = mMetricsRecordRef.CreateIntGauge(METRIC_AGENT_PIPELINE_CONFIG_TOTAL); - // mIntGauges[METRIC_AGENT_ENV_PIPELINE_CONFIG_TOTAL] = - // mMetricsRecordRef.CreateIntGauge(METRIC_AGENT_ENV_PIPELINE_CONFIG_TOTAL); - // mIntGauges[METRIC_AGENT_CRD_PIPELINE_CONFIG_TOTAL] = - // mMetricsRecordRef.CreateIntGauge(METRIC_AGENT_CRD_PIPELINE_CONFIG_TOTAL); - // mIntGauges[METRIC_AGENT_CONSOLE_PIPELINE_CONFIG_TOTAL] - // = mMetricsRecordRef.CreateIntGauge(METRIC_AGENT_CONSOLE_PIPELINE_CONFIG_TOTAL); // mIntGauges[METRIC_AGENT_PLUGIN_TOTAL] = mMetricsRecordRef.CreateIntGauge(METRIC_AGENT_PLUGIN_TOTAL); LOG_INFO(sLogger, ("LoongCollectorMonitor", "started")); } diff --git a/core/monitor/metric_constants/AgentMetrics.cpp b/core/monitor/metric_constants/AgentMetrics.cpp index d92ac5838d..d759489d89 100644 --- a/core/monitor/metric_constants/AgentMetrics.cpp +++ b/core/monitor/metric_constants/AgentMetrics.cpp @@ -27,17 +27,13 @@ const std::string METRIC_LABEL_UUID = "uuid"; const std::string METRIC_LABEL_VERSION = "version"; // metric keys -const std::string METRIC_AGENT_CONSOLE_PIPELINE_CONFIG_TOTAL = "agent_console_pipeline_config_total"; const std::string METRIC_AGENT_CPU = "agent_cpu_percent"; -const std::string METRIC_AGENT_CPU_GO = "agent_go_cpu_percent"; -const std::string METRIC_AGENT_CRD_PIPELINE_CONFIG_TOTAL = "agent_crd_pipeline_config_total"; -const std::string METRIC_AGENT_ENV_PIPELINE_CONFIG_TOTAL = "agent_env_pipeline_config_total"; const std::string METRIC_AGENT_GO_ROUTINES_TOTAL = "agent_go_routines_total"; -const std::string METRIC_AGENT_INSTANCE_CONFIG_TOTAL = "agent_instance_config_total"; +const std::string METRIC_AGENT_INSTANCE_CONFIG_TOTAL = "agent_instance_config_total"; // Not Implemented const std::string METRIC_AGENT_MEMORY = "agent_memory_used_mb"; const std::string METRIC_AGENT_MEMORY_GO = "agent_go_memory_used_mb"; const std::string METRIC_AGENT_OPEN_FD_TOTAL = "agent_open_fd_total"; const std::string METRIC_AGENT_PIPELINE_CONFIG_TOTAL = "agent_pipeline_config_total"; -const std::string METRIC_AGENT_PLUGIN_TOTAL = "agent_plugin_total"; +const std::string METRIC_AGENT_PLUGIN_TOTAL = "agent_plugin_total"; // Not Implemented } \ No newline at end of file diff --git a/core/monitor/metric_constants/PluginMetrics.cpp b/core/monitor/metric_constants/PluginMetrics.cpp index e5535e11fa..0fbfe61eae 100644 --- a/core/monitor/metric_constants/PluginMetrics.cpp +++ b/core/monitor/metric_constants/PluginMetrics.cpp @@ -82,11 +82,4 @@ const std::string METRIC_PLUGIN_MERGE_MULTILINE_LOG_UNMATCHED_RECORDS_TOTAL const std::string METRIC_PLUGIN_PARSE_STDERR_TOTAL = "plugin_parse_stderr_total"; const std::string METRIC_PLUGIN_PARSE_STDOUT_TOTAL = "plugin_parse_stdout_total"; -/********************************************************** -* flusher_sls -**********************************************************/ -const std::string METRIC_PLUGIN_NETWORK_ERROR_TOTAL = "plugin_network_error_total"; -const std::string METRIC_PLUGIN_QUOTA_ERROR_TOTAL = "plugin_quota_error_total"; -const std::string METRIC_PLUGIN_RETRIES_TOTAL = "plugin_retries_total"; - } \ No newline at end of file diff --git a/pkg/helper/self_metrics_constants.go b/pkg/helper/self_metrics_constants.go index 0222b61713..5ba49209ba 100644 --- a/pkg/helper/self_metrics_constants.go +++ b/pkg/helper/self_metrics_constants.go @@ -31,7 +31,6 @@ const MetricLabelProject = "project" // metric keys const ( - MetricAgentCPUGo = "agent_go_cpu_percent" MetricAgentMemoryGo = "agent_go_memory_used_mb" MetricAgentGoRoutinesTotal = "agent_go_routines_total" ) @@ -90,10 +89,9 @@ const ( /********************************************************** * service_mysql +* service_rdb **********************************************************/ const ( - MetricLabelDriver = "driver" - MetricPluginCollectAvgCostTimeMs = "plugin_collect_avg_cost_time_ms" MetricPluginCollectTotal = "plugin_collect_total" ) diff --git a/pluginmanager/metric_export.go b/pluginmanager/metric_export.go index 9574d94a12..8df3f8a45b 100644 --- a/pluginmanager/metric_export.go +++ b/pluginmanager/metric_export.go @@ -85,8 +85,6 @@ func GetAgentStat() []map[string]string { metric := map[string]string{} // key is the metric key in runtime/metrics, value is agent's metric key metricNames := map[string]string{ - // cpu - // "": helper.MetricAgentCPUGo, // mem. All memory mapped by the Go runtime into the current process as read-write. Note that this does not include memory mapped by code called via cgo or via the syscall package. Sum of all metrics in /memory/classes. "/memory/classes/total:bytes": helper.MetricAgentMemoryGo, // go routines cnt. Count of live goroutines.