Set verbosity after flag definition

(cherry picked from commit 4170184c292024750dbcbc640470fc203b80a168)
This commit is contained in:
jxy_git 2024-09-19 13:54:41 +08:00 committed by openeuler-sync-bot
parent fd71d38ac5
commit 2da38ac208
2 changed files with 45 additions and 4 deletions

View File

@ -0,0 +1,33 @@
From a5141527ab5fd51c1776547ab806a7098f1cc952 Mon Sep 17 00:00:00 2001
From: jiangxinyu <jiangxinyu@kylinos.cn>
Date: Thu, 19 Sep 2024 13:37:57 +0800
Subject: [PATCH] Set verbosity after flag definition
Reference: https://github.com/google/cadvisor/pull/3384/commits/20317bfa449ae54cb2f9135482f08fb70a01c16f
---
cmd/cadvisor.go | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/cmd/cadvisor.go b/cmd/cadvisor.go
index 505d091..b474512 100644
--- a/cmd/cadvisor.go
+++ b/cmd/cadvisor.go
@@ -141,13 +141,13 @@ func (ml *metricSetValue) Set(value string) error {
func init() {
flag.Var(&ignoreMetrics, "disable_metrics", "comma-separated list of `metrics` to be disabled. Options are 'accelerator', 'cpu_topology','disk', 'diskIO', 'network', 'tcp', 'udp', 'percpu', 'sched', 'process', 'hugetlb', 'referenced_memory', 'resctrl'.")
- // Default logging verbosity to V(2)
- flag.Set("v", "2")
}
func main() {
klog.InitFlags(nil)
defer klog.Flush()
+ // Default logging verbosity to V(2)
+ _ = flag.Set("v", "2")
flag.Parse()
if *versionFlag {
--
2.46.0

View File

@ -2,7 +2,7 @@
Name: cadvisor
Version: 0.37.0
Release: 5
Release: 6
Summary: Analyzes resource usage and performance characteristics of running containers.
License: ASL 2.0
URL: https://github.com/google/cadvisor
@ -14,6 +14,7 @@ Source2: sys.tar.gz
Patch0: use_preinstalled_go-bindata.patch
Patch1: add-parameters-to-solve-the-strip.patch
Patch2: Add-loong64-support-for-runc-procfs-and-crc32.patch
Patch3: backport-Set-verbosity-after-flag-definition.patch
Patch1000: 1000-add-riscv64-support-for-crc32-and-procfs.patch
BuildRequires: golang >= 1.13
@ -33,9 +34,10 @@ and network statistics. This data is exported by container and machine-wide.
%prep
%setup -q -T -n %{name}-%{version} -b 0 -b 1
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch 0 -p1
%patch 1 -p1
%patch 2 -p1
%patch 3 -p1
%ifarch loongarch64
rm -rf vendor/golang.org/x/sys
rm -rf cmd/vendor/golang.org/x/sys/
@ -60,6 +62,12 @@ install -D -m 755 cadvisor %{buildroot}%{_bindir}/cadvisor
%changelog
* Thu Sep 19 2024 jiangxinyu <jiangxinyu@kylinos.cn> - 0.37.0-6
- Type:bugfix
- ID:NA
- SUG:NA
- DESC: Set verbosity after flag definition
* Thu Aug 31 2023 misaka00251 <liuxin@iscas.ac.cn> - 0.37.0-5
- Add riscv64 support