From 26a8dd3c245fb8c86c9d4c968f0911005dcddcb4 Mon Sep 17 00:00:00 2001 From: chengjoey <30427474+chengjoey@users.noreply.github.com> Date: Fri, 18 Oct 2024 14:45:40 +0800 Subject: [PATCH] fix redis cpu(sys,user,children) percent (#6454) --- cmd/monitor/collector/bootstrap-agent.yaml | 43 ++++++++++++++++------ cmd/monitor/collector/bootstrap.yaml | 43 ++++++++++++++++------ 2 files changed, 62 insertions(+), 24 deletions(-) diff --git a/cmd/monitor/collector/bootstrap-agent.yaml b/cmd/monitor/collector/bootstrap-agent.yaml index 32c78471c20..4ce8193b9aa 100644 --- a/cmd/monitor/collector/bootstrap-agent.yaml +++ b/cmd/monitor/collector/bootstrap-agent.yaml @@ -24,6 +24,7 @@ erda.oap.collector.core: - "erda.oap.collector.processor.modifier@docker_container_summary" - "erda.oap.collector.processor.modifier@mysql" - "erda.oap.collector.processor.modifier@redis" + - "erda.oap.collector.processor.aggregator@redis" - "erda.oap.collector.processor.aggregator@cpu-usage" - "erda.oap.collector.processor.aggregator@mem-percent" exporters: @@ -358,18 +359,36 @@ erda.oap.collector.processor.modifier@redis: - action: rename key: fields.redis_memory_used_lua_bytes value: fields.used_memory_lua - - action: rename - key: fields.redis_cpu_sys_seconds_total - value: fields.used_cpu_sys - - action: rename - key: fields.redis_cpu_user_seconds_total - value: fields.used_cpu_user - - action: rename - key: fields.redis_cpu_sys_children_seconds_total - value: fields.used_cpu_sys_children - - action: rename - key: fields.redis_cpu_user_children_seconds_total - value: fields.used_cpu_user_children + +erda.oap.collector.processor.aggregator@redis: + keypass: + name: [ "redis" ] + + rules: + - func: "rate" + args: [ "redis_cpu_sys_seconds_total" ] + target_key: "used_cpu_sys" + - func: "*" + args: [ "used_cpu_sys", 100 ] + target_key: "used_cpu_sys" + - func: "rate" + args: [ "redis_cpu_user_seconds_total" ] + target_key: "used_cpu_user" + - func: "*" + args: [ "used_cpu_user", 100 ] + target_key: "used_cpu_user" + - func: "rate" + args: [ "redis_cpu_sys_children_seconds_total" ] + target_key: "used_cpu_sys_children" + - func: "*" + args: [ "used_cpu_sys_children", 100 ] + target_key: "used_cpu_sys_children" + - func: "rate" + args: [ "redis_cpu_user_children_seconds_total" ] + target_key: "used_cpu_user_children" + - func: "*" + args: [ "used_cpu_user_children", 100 ] + target_key: "used_cpu_user_children" erda.oap.collector.processor.aggregator@cpu-usage: diff --git a/cmd/monitor/collector/bootstrap.yaml b/cmd/monitor/collector/bootstrap.yaml index c488a01a870..15b46185283 100644 --- a/cmd/monitor/collector/bootstrap.yaml +++ b/cmd/monitor/collector/bootstrap.yaml @@ -40,6 +40,7 @@ erda.oap.collector.core: - "erda.oap.collector.processor.modifier@docker_container_summary" - "erda.oap.collector.processor.modifier@mysql" - "erda.oap.collector.processor.modifier@redis" + - "erda.oap.collector.processor.aggregator@redis" - "erda.oap.collector.processor.aggregator@cpu-usage" - "erda.oap.collector.processor.aggregator@mem-percent" - "erda.oap.collector.processor.aggregator@rx_bytes_usage" @@ -383,18 +384,36 @@ erda.oap.collector.processor.modifier@redis: - action: rename key: fields.redis_memory_used_lua_bytes value: fields.used_memory_lua - - action: rename - key: fields.redis_cpu_sys_seconds_total - value: fields.used_cpu_sys - - action: rename - key: fields.redis_cpu_user_seconds_total - value: fields.used_cpu_user - - action: rename - key: fields.redis_cpu_sys_children_seconds_total - value: fields.used_cpu_sys_children - - action: rename - key: fields.redis_cpu_user_children_seconds_total - value: fields.used_cpu_user_children + +erda.oap.collector.processor.aggregator@redis: + keypass: + name: [ "redis" ] + + rules: + - func: "rate" + args: [ "redis_cpu_sys_seconds_total" ] + target_key: "used_cpu_sys" + - func: "*" + args: [ "used_cpu_sys", 100 ] + target_key: "used_cpu_sys" + - func: "rate" + args: [ "redis_cpu_user_seconds_total" ] + target_key: "used_cpu_user" + - func: "*" + args: [ "used_cpu_user", 100 ] + target_key: "used_cpu_user" + - func: "rate" + args: [ "redis_cpu_sys_children_seconds_total" ] + target_key: "used_cpu_sys_children" + - func: "*" + args: [ "used_cpu_sys_children", 100 ] + target_key: "used_cpu_sys_children" + - func: "rate" + args: [ "redis_cpu_user_children_seconds_total" ] + target_key: "used_cpu_user_children" + - func: "*" + args: [ "used_cpu_user_children", 100 ] + target_key: "used_cpu_user_children" erda.oap.collector.processor.aggregator@cpu-usage: