Skip to content

Commit

Permalink
delete unused metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
Takuka0311 committed Sep 27, 2024
1 parent 121b468 commit 2b781a5
Show file tree
Hide file tree
Showing 7 changed files with 3 additions and 40 deletions.
11 changes: 0 additions & 11 deletions core/monitor/MetricConstants.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
//////////////////////////////////////////////////////////////////////////
Expand Down
4 changes: 0 additions & 4 deletions core/monitor/MetricExportor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -173,9 +172,6 @@ void MetricExportor::PushGoCppProvidedMetrics(std::vector<std::map<std::string,

for (auto metrics : metricsList) {
for (auto metric : metrics) {
// if (metric.first == METRIC_AGENT_CPU_GO) {
// mAgentCpuGo->Set(std::stod(metric.second));
// }
if (metric.first == METRIC_AGENT_MEMORY_GO) {
mAgentMemGo->Set(std::stoi(metric.second));
}
Expand Down
7 changes: 0 additions & 7 deletions core/monitor/Monitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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"));
}
Expand Down
8 changes: 2 additions & 6 deletions core/monitor/metric_constants/AgentMetrics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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

}
7 changes: 0 additions & 7 deletions core/monitor/metric_constants/PluginMetrics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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";

}
4 changes: 1 addition & 3 deletions pkg/helper/self_metrics_constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down Expand Up @@ -90,10 +89,9 @@ const (

/**********************************************************
* service_mysql
* service_rdb
**********************************************************/
const (
MetricLabelDriver = "driver"

MetricPluginCollectAvgCostTimeMs = "plugin_collect_avg_cost_time_ms"
MetricPluginCollectTotal = "plugin_collect_total"
)
Expand Down
2 changes: 0 additions & 2 deletions pluginmanager/metric_export.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 2b781a5

Please sign in to comment.