fix metric_total_size may be negative or float

This commit is contained in:
hlp_00667687 2024-04-17 15:40:36 +08:00
parent 05d78463ce
commit 39872da8e2
2 changed files with 132 additions and 2 deletions

View File

@ -28,7 +28,7 @@
Summary: Intelligent ops toolkit for openEuler
Name: gala-gopher
Version: 2.0.0
Release: 5
Release: 6
License: Mulan PSL v2
URL: https://gitee.com/openeuler/gala-gopher
Source: %{name}-%{version}.tar.gz
@ -96,6 +96,7 @@ Requires: jsoncpp conntrack-tools
Requires: lsof
%endif
Patch1: metric_total_size-may-be-a-float.patch
%description
gala-gopher is a low-overhead eBPF-based probes framework
@ -181,6 +182,9 @@ fi
%attr(0550,root,root) /usr/libexec/gala-gopher/init_probes.sh
%changelog
* Mon Apr 15 2024 Liping Hu <huliping10@huawei.com> - 2.0.0-6
- metric_total_size may be negative or float
* Mon Apr 8 2024 Tangxin Xie <xietangxin@huawei.com> - 2.0.0-5
- Update tarball to latest dev of upstream
@ -237,4 +241,3 @@ fi
* Mon Nov 14 2022 Zhen Chen <chenzhen126@huawei.com> - 1.0.0-1
- Package init

View File

@ -0,0 +1,127 @@
From 1cc0b1dd266ed0792e8ef096bcdeadd26050cc16 Mon Sep 17 00:00:00 2001
From: hlp_00667687 <huliping10@huawei.com>
Date: Mon, 15 Apr 2024 20:10:19 +0800
Subject: [PATCH] metric_total_size may be a float
---
src/lib/config/config.c | 28 ++++++++++++++--------------
1 file changed, 14 insertions(+), 14 deletions(-)
diff --git a/src/lib/config/config.c b/src/lib/config/config.c
index de74602..4a8795f 100644
--- a/src/lib/config/config.c
+++ b/src/lib/config/config.c
@@ -216,7 +216,7 @@ static int ConfigMgrLoadKafkaConfig(void *config, config_setting_t *settings)
KafkaConfig *kafkaConfig = (KafkaConfig *)config;
uint32_t ret = 0;
const char *strVal = NULL;
- uint32_t intVal = 0;
+ int intVal = 0;
ret = config_setting_lookup_string(settings, "kafka_broker", &strVal);
if (ret == 0) {
@@ -226,7 +226,7 @@ static int ConfigMgrLoadKafkaConfig(void *config, config_setting_t *settings)
(void)snprintf(kafkaConfig->broker, sizeof(kafkaConfig->broker), "%s", strVal);
ret = config_setting_lookup_int(settings, "batch_num_messages", &intVal);
- if (ret == 0) {
+ if (ret == 0 || intVal <= 0) {
ERROR("[CONFIG] load config for batch.num.messages failed.\n");
return -1;
}
@@ -240,21 +240,21 @@ static int ConfigMgrLoadKafkaConfig(void *config, config_setting_t *settings)
(void)snprintf(kafkaConfig->compressionCodec, sizeof(kafkaConfig->compressionCodec), "%s", strVal);
ret = config_setting_lookup_int(settings, "queue_buffering_max_messages", &intVal);
- if (ret == 0) {
+ if (ret == 0 || intVal <= 0) {
ERROR("[CONFIG] load config for queue.buffering.max.messages failed.\n");
return -1;
}
kafkaConfig->queueBufferingMaxMessages = intVal;
ret = config_setting_lookup_int(settings, "queue_buffering_max_kbytes", &intVal);
- if (ret == 0) {
+ if (ret == 0 || intVal <= 0) {
ERROR("[CONFIG] load config for queue.buffering.max.kbytes failed.\n");
return -1;
}
kafkaConfig->queueBufferingMaxKbytes = intVal;
ret = config_setting_lookup_int(settings, "queue_buffering_max_ms", &intVal);
- if (ret == 0) {
+ if (ret == 0 || intVal <= 0) {
ERROR("[CONFIG] load config for queue.buffering.max.ms failed.\n");
return -1;
}
@@ -267,31 +267,31 @@ static int ConfigMgrLoadIMDBConfig(void *config, config_setting_t *settings)
{
IMDBConfig *imdbConfig = (IMDBConfig *)config;
uint32_t ret = 0;
- uint32_t intVal = 0;
+ int intVal = 0;
ret = config_setting_lookup_int(settings, "max_tables_num", &intVal);
- if (ret == 0) {
+ if (ret == 0 || intVal <= 0) {
ERROR("[CONFIG] load config for imdbConfig max_tables_num failed.\n");
return -1;
}
imdbConfig->maxTablesNum = intVal;
ret = config_setting_lookup_int(settings, "max_records_num", &intVal);
- if (ret == 0) {
+ if (ret == 0 || intVal <= 0) {
ERROR("[CONFIG] load config for imdbConfig max_records_num failed.\n");
return -1;
}
imdbConfig->maxRecordsNum = intVal;
ret = config_setting_lookup_int(settings, "max_metrics_num", &intVal);
- if (ret == 0) {
+ if (ret == 0 || intVal <= 0) {
ERROR("[CONFIG] load config for imdbConfig max_metrics_num failed.\n");
return -1;
}
imdbConfig->maxMetricsNum = intVal;
ret = config_setting_lookup_int(settings, "record_timeout", &intVal);
- if (ret == 0) {
+ if (ret == 0 || intVal <= 0) {
ERROR("[CONFIG] load config for imdbConfig record_timeout failed, use default setting instead.\n");
} else {
imdbConfig->recordTimeout = intVal;
@@ -308,7 +308,7 @@ static int ConfigMgrLoadWebServerConfig(void *config, config_setting_t *settings
int intVal = 0;
ret = config_setting_lookup_int(settings, "port", &intVal);
- if (ret == 0) {
+ if (ret == 0 || intVal <= 0) {
ERROR("[CONFIG] load config for webServerConfig port failed.\n");
return -1;
}
@@ -370,7 +370,7 @@ static int ConfigMgrLoadRestServerConfig(void *config, config_setting_t *setting
(void)snprintf(restServerConfig->bindAddr, sizeof(restServerConfig->bindAddr), "%s", strVal);
ret = config_setting_lookup_int(settings, "port", &intVal);
- if (ret == 0) {
+ if (ret == 0 || intVal <= 0) {
ERROR("[CONFIG] load config for restServerConfig port failed.\n");
return -1;
}
@@ -414,10 +414,10 @@ static int ConfigMgrLoadLogsConfig(void *config, config_setting_t *settings)
LogsConfig *logsConfig = (LogsConfig *)config;
uint32_t ret = 0;
const char *strVal = NULL;
- uint32_t intVal = 0;
+ int intVal = 0;
ret = config_setting_lookup_int(settings, "metric_total_size", &intVal);
- if (ret == 0) {
+ if (ret == 0 || intVal <= 0) {
ERROR("[CONFIG] load config for metric_total_size failed.\n");
return -1;
}
--
2.28.0.windows.1