config: only one Blacklist for tracing and metrics

Signed-off-by: fanzu8 <tuzengbing@gmail.com>
This commit is contained in:
fanzu8 2025-07-16 17:08:51 +08:00
parent 81265ad8a4
commit 5c8a6333b2
3 changed files with 13 additions and 18 deletions

View File

@ -82,13 +82,13 @@ func mainAction(ctx *cli.Context) error {
return fmt.Errorf("init pod cgroup metadata: %w", err)
}
blackListed := conf.Get().Tracing.BlackList
prom, err := InitMetricsCollector(blackListed, conf.Region)
blacklisted := conf.Get().Blacklist
prom, err := InitMetricsCollector(blacklisted, conf.Region)
if err != nil {
return fmt.Errorf("InitMetricsCollector: %w", err)
}
mgr, err := tracing.NewMgrTracingEvent(blackListed)
mgr, err := tracing.NewMgrTracingEvent(blacklisted)
if err != nil {
return err
}
@ -164,7 +164,7 @@ func main() {
},
&cli.StringSliceFlag{
Name: "disable-tracing",
Usage: "disable tracing. This is related to TracerConfig.BlackList in config, and complement each other",
Usage: "disable tracing. This is related to Blacklist in config, and complement each other",
},
&cli.BoolFlag{
Name: "log-debug",
@ -200,11 +200,11 @@ func main() {
// tracer
disabledTracing := ctx.StringSlice("disable-tracing")
if len(disabledTracing) > 0 {
definedTracers := conf.Get().Tracing.BlackList
definedTracers := conf.Get().Blacklist
definedTracers = append(definedTracers, disabledTracing...)
conf.Set("TracerConfig.BlackList", definedTracers)
log.Infof("The tracer black list by cli: %v", conf.Get().Tracing.BlackList)
conf.Set("Blacklist", definedTracers)
log.Infof("The tracer black list by cli: %v", conf.Get().Blacklist)
}
if ctx.Bool("log-debug") {

View File

@ -3,6 +3,9 @@ LogLevel = "Info"
# logging filepath
# LogFile = ""
# the blacklist for tracing and metrics
Blacklist = ["softlockup", "ethtool"]
[RuntimeCgroup]
LimitInitCPU = 0.5
LimitCPU = 2.0
@ -28,8 +31,6 @@ LogLevel = "Info"
MaxRotation = 10
[Tracing]
# blacklist
BlackList = ["softlockup"]
[Tracing.Cpuidle]
CgUserth = 75 #75%
CgDeltaUserth = 30 #30%
@ -113,9 +114,6 @@ LogLevel = "Info"
# Collector Configurations.
[MetricCollector]
# blacklist
BlackList = ["ethtool"]
# Netdev Configurations.
[MetricCollector.Netdev]
# Use `netlink` instead of `procfs net/dev` to get netdev statistic.

View File

@ -32,6 +32,9 @@ type CommonConf struct {
LogLevel string `default:"Info"`
LogFile string
// Blacklist for tracing and metrics
Blacklist []string
// APIServer addr
APIServer struct {
TCPAddr string `default:":19704"`
@ -79,9 +82,6 @@ type CommonConf struct {
}
Tracing struct {
// backlist
BlackList []string
// Cpuidle for cpuidle configuration
Cpuidle struct {
CgUserth uint64
@ -176,9 +176,6 @@ type CommonConf struct {
}
MetricCollector struct {
// backlist
BlackList []string
Netdev struct {
// Use `netlink` instead of `procfs net/dev` to get netdev statistic.
// Only support the host environment to use `netlink` now!