Skip to content

Commit

Permalink
fix: only enable dcgm supports in daemonset mode
Browse files Browse the repository at this point in the history
  • Loading branch information
xzchaoo committed Nov 24, 2023
1 parent d7b770f commit 201dc1b
Showing 1 changed file with 20 additions and 16 deletions.
36 changes: 20 additions & 16 deletions pkg/openmetric/openmetric.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ import (
"fmt"
"github.com/prometheus/common/model"
"github.com/prometheus/prometheus/pkg/relabel"
"github.com/traas-stack/holoinsight-agent/pkg/appconfig"
"github.com/traas-stack/holoinsight-agent/pkg/collecttask"
"github.com/traas-stack/holoinsight-agent/pkg/core"
"github.com/traas-stack/holoinsight-agent/pkg/cri/impl/netproxy"
"go.uber.org/zap"
"strings"
Expand Down Expand Up @@ -194,22 +196,24 @@ func (m *Manager) Start() {
changed = true
}

m.jobs["dcgm"] = &config.ScrapeConfig{
JobName: "dcgm",
HonorLabels: true,
HonorTimestamps: false,
Params: nil,
ScrapeInterval: model.Duration(5 * time.Second),
ScrapeTimeout: model.Duration(5 * time.Second),
MetricsPath: "/metrics",
Scheme: "http",
SampleLimit: 0,
TargetLimit: 0,
ServiceDiscoveryConfigs: discovery.Configs{
&dcgmConfig{},
},
RelabelConfigs: []*relabel.Config{},
MetricRelabelConfigs: nil,
if appconfig.StdAgentConfig.Mode == core.AgentModeDaemonset {
m.jobs["dcgm"] = &config.ScrapeConfig{
JobName: "dcgm",
HonorLabels: true,
HonorTimestamps: false,
Params: nil,
ScrapeInterval: model.Duration(5 * time.Second),
ScrapeTimeout: model.Duration(5 * time.Second),
MetricsPath: "/metrics",
Scheme: "http",
SampleLimit: 0,
TargetLimit: 0,
ServiceDiscoveryConfigs: discovery.Configs{
&dcgmConfig{},
},
RelabelConfigs: []*relabel.Config{},
MetricRelabelConfigs: nil,
}
}

changed = true
Expand Down

0 comments on commit 201dc1b

Please sign in to comment.