Skip to content

Commit

Permalink
Add RDAM metrics
Browse files Browse the repository at this point in the history
Signed-off-by: lou-lan <loulan@loulan.me>
  • Loading branch information
lou-lan committed Oct 8, 2024
1 parent 4a2596e commit 5ef5dc8
Show file tree
Hide file tree
Showing 182 changed files with 4,571 additions and 13,603 deletions.
1 change: 1 addition & 0 deletions charts/spiderpool/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,7 @@ helm install spiderpool spiderpool/spiderpool --wait --namespace kube-system \
| `spiderpoolAgent.healthChecking.readinessProbe.failureThreshold` | the failure threshold of startup probe for spiderpoolAgent health checking | `3` |
| `spiderpoolAgent.healthChecking.readinessProbe.periodSeconds` | the period seconds of startup probe for spiderpoolAgent health checking | `10` |
| `spiderpoolAgent.prometheus.enabled` | enable spiderpool agent to collect metrics | `false` |
| `spiderpoolAgent.prometheus.enabledRdmaMetric` | enable spiderpool agent to collect RDMA metrics | `false` |
| `spiderpoolAgent.prometheus.enabledDebugMetric` | enable spiderpool agent to collect debug level metrics | `false` |
| `spiderpoolAgent.prometheus.port` | the metrics port of spiderpool agent | `5711` |
| `spiderpoolAgent.prometheus.serviceMonitor.install` | install serviceMonitor for spiderpool agent. This requires the prometheus CRDs to be available | `false` |
Expand Down
13 changes: 13 additions & 0 deletions charts/spiderpool/templates/daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,8 @@ spec:
value: {{ .Values.spiderpoolAgent.debug.logLevel | quote }}
- name: SPIDERPOOL_ENABLED_METRIC
value: {{ .Values.spiderpoolAgent.prometheus.enabled | quote }}
- name: SPIDERPOOL_ENABLED_RDMA_METRIC
value: {{ .Values.spiderpoolAgent.prometheus.enabledRdmaMetric | quote }}
- name: SPIDERPOOL_ENABLED_DEBUG_METRIC
value: {{ .Values.spiderpoolAgent.prometheus.enabledDebugMetric | quote }}
- name: SPIDERPOOL_METRIC_HTTP_PORT
Expand Down Expand Up @@ -275,6 +277,11 @@ spec:
mountPropagation: Bidirectional
- name: multus-cfg
mountPath: /tmp/multus-conf
{{- if .Values.spiderpoolAgent.prometheus.enabledDebugMetric }}
- mountPath: /var/run/netns
name: host-ns
mountPropagation: HostToContainer
{{- end }}
{{- if .Values.multus.multusCNI.extraVolumes }}
{{- include "tplvalues.render" ( dict "value" .Values.multus.multusCNI.extraVolumeMounts "context" $ ) | nindent 12 }}
{{- end }}
Expand Down Expand Up @@ -306,6 +313,12 @@ spec:
- key: cni-conf.json
path: 00-multus.conf
{{- end }}
# rdma need netns
{{- if .Values.spiderpoolAgent.prometheus.enabledDebugMetric }}
- name: host-ns
hostPath:
path: /var/run/netns
{{- end }}
{{- if .Values.dra.enabled }}
- name: plugins-registry
hostPath:
Expand Down
3 changes: 3 additions & 0 deletions charts/spiderpool/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,9 @@ spiderpoolAgent:
## @param spiderpoolAgent.prometheus.enabled enable spiderpool agent to collect metrics
enabled: false

## @param spiderpoolAgent.prometheus.enabledRdmaMetric enable spiderpool agent to collect RDMA metrics
enabledRdmaMetric: false

## @param spiderpoolAgent.prometheus.enabledDebugMetric enable spiderpool agent to collect debug level metrics
enabledDebugMetric: false

Expand Down
2 changes: 2 additions & 0 deletions cmd/spiderpool-agent/cmd/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ var envInfo = []envConf{

{"SPIDERPOOL_LOG_LEVEL", logutils.LogInfoLevelStr, true, &agentContext.Cfg.LogLevel, nil, nil},
{"SPIDERPOOL_ENABLED_METRIC", "false", false, nil, &agentContext.Cfg.EnableMetric, nil},
{"SPIDERPOOL_ENABLED_RDMA_METRIC", "false", false, nil, &agentContext.Cfg.EnableRDMAMetric, nil},
{"SPIDERPOOL_ENABLED_DEBUG_METRIC", "false", false, nil, &agentContext.Cfg.EnableDebugLevelMetric, nil},
{"SPIDERPOOL_POD_NAMESPACE", "", true, &agentContext.Cfg.AgentPodNamespace, nil, nil},
{"SPIDERPOOL_POD_NAME", "", true, &agentContext.Cfg.AgentPodName, nil, nil},
Expand All @@ -79,6 +80,7 @@ type Config struct {
// env
LogLevel string
EnableMetric bool
EnableRDMAMetric bool
EnableDebugLevelMetric bool
AgentPodNamespace string
AgentPodName string
Expand Down
6 changes: 3 additions & 3 deletions cmd/spiderpool-agent/cmd/daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,16 +141,16 @@ func DaemonMain() {
logger.Fatal(err.Error())
}

logger.Info("Begin to initialize spiderpool-agent metrics HTTP server")
initAgentMetricsServer(agentContext.InnerCtx)

logger.Info("Begin to initialize spiderpool-agent runtime manager")
mgr, err := newCRDManager()
if nil != err {
logger.Fatal(err.Error())
}
agentContext.CRDManager = mgr

logger.Info("Begin to initialize spiderpool-agent metrics HTTP server")
initAgentMetricsServer(agentContext.InnerCtx)

// init managers...
initAgentServiceManagers(agentContext.InnerCtx)

Expand Down
9 changes: 6 additions & 3 deletions cmd/spiderpool-agent/cmd/metrics_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,16 @@ import (

// initAgentMetricsServer will start an opentelemetry http server for spiderpool agent.
func initAgentMetricsServer(ctx context.Context) {
metricController, err := metric.InitMetric(ctx, constant.SpiderpoolAgent,
agentContext.Cfg.EnableMetric, agentContext.Cfg.EnableDebugLevelMetric)
metricController, err := metric.InitMetric(ctx,
constant.SpiderpoolAgent,
agentContext.Cfg.EnableMetric,
agentContext.Cfg.EnableDebugLevelMetric,
)
if nil != err {
logger.Fatal(err.Error())
}

err = metric.InitSpiderpoolAgentMetrics(ctx)
err = metric.InitSpiderpoolAgentMetrics(ctx, agentContext.Cfg.EnableRDMAMetric, agentContext.CRDManager.GetClient())
if nil != err {
logger.Fatal(err.Error())
}
Expand Down
17 changes: 8 additions & 9 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,11 @@ require (
github.com/Masterminds/sprig/v3 v3.2.3 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/blang/semver/v4 v4.0.0 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/cilium/proxy v0.0.0-20230623092907-8fddead4e52c // indirect
github.com/coreos/go-iptables v0.7.0 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.3 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/docker/go-units v0.5.0 // indirect
github.com/emicklei/go-restful/v3 v3.11.0 // indirect
github.com/evanphx/json-patch v5.6.0+incompatible // indirect
Expand Down Expand Up @@ -153,13 +153,13 @@ require (
github.com/pelletier/go-toml/v2 v2.0.8 // indirect
github.com/petermattis/goid v0.0.0-20221018141743-354ef7f2fd21 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c // indirect
github.com/projectcalico/api v0.0.0-20220722155641-439a754a988b // indirect
github.com/prometheus/client_model v0.5.0 // indirect
github.com/prometheus/common v0.44.0 // indirect
github.com/prometheus/procfs v0.11.1 // indirect
github.com/rogpeppe/go-internal v1.11.0 // indirect
github.com/rogpeppe/go-internal v1.12.0 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/safchain/ethtool v0.4.0 // indirect
github.com/shirou/gopsutil/v3 v3.23.5 // indirect
Expand All @@ -182,15 +182,14 @@ require (
golang.org/x/crypto v0.24.0 // indirect
golang.org/x/exp v0.0.0-20230522175609-2e198f4a06a1 // indirect
golang.org/x/mod v0.17.0 // indirect
golang.org/x/oauth2 v0.16.0 // indirect
golang.org/x/oauth2 v0.20.0 // indirect
golang.org/x/term v0.21.0 // indirect
golang.org/x/text v0.16.0 // indirect
golang.org/x/time v0.3.0 // indirect
gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect
google.golang.org/appengine v1.6.8 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240123012728-ef4313101c80 // indirect
google.golang.org/grpc v1.62.0 // indirect
google.golang.org/protobuf v1.33.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240701130421-f6361c86f094 // indirect
google.golang.org/grpc v1.65.0 // indirect
google.golang.org/protobuf v1.34.2 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
k8s.io/gengo/v2 v2.0.0-20240228010128-51d4e06bde70 // indirect
Expand Down
Loading

0 comments on commit 5ef5dc8

Please sign in to comment.