diff --git a/Documentation/cmdref/cilium-agent.md b/Documentation/cmdref/cilium-agent.md index a7de937a2aee4..41247a6c477d1 100644 --- a/Documentation/cmdref/cilium-agent.md +++ b/Documentation/cmdref/cilium-agent.md @@ -270,7 +270,7 @@ cilium-agent [flags] --mesh-auth-rotated-identities-queue-size int The size of the queue for signaling rotated identities. (default 1024) --mesh-auth-spiffe-trust-domain string The trust domain for the SPIFFE identity. (default "spiffe.cilium") --mesh-auth-spire-admin-socket string The path for the SPIRE admin agent Unix socket. - --metrics strings Metrics that should be enabled or disabled from the default metric list. (+metric_foo to enable metric_foo, -metric_bar to disable metric_bar) + --metrics strings Comma separated list of metrics that should be enabled or disabled from the default metric list. (+metric_foo to enable metric_foo, -metric_bar to disable metric_bar) --monitor-aggregation string Level of monitor aggregation for traces from the datapath (default "None") --monitor-aggregation-flags strings TCP flags that trigger monitor reports when monitor aggregation is enabled (default [syn,fin,rst]) --monitor-aggregation-interval duration Monitor report interval when monitor aggregation is enabled (default 5s) diff --git a/Documentation/cmdref/cilium-agent_hive.md b/Documentation/cmdref/cilium-agent_hive.md index 1aaf6709ab948..dd4faa3445988 100644 --- a/Documentation/cmdref/cilium-agent_hive.md +++ b/Documentation/cmdref/cilium-agent_hive.md @@ -52,7 +52,7 @@ cilium-agent hive [flags] --mesh-auth-rotated-identities-queue-size int The size of the queue for signaling rotated identities. (default 1024) --mesh-auth-spiffe-trust-domain string The trust domain for the SPIFFE identity. (default "spiffe.cilium") --mesh-auth-spire-admin-socket string The path for the SPIRE admin agent Unix socket. - --metrics strings Metrics that should be enabled or disabled from the default metric list. (+metric_foo to enable metric_foo, -metric_bar to disable metric_bar) + --metrics strings Comma separated list of metrics that should be enabled or disabled from the default metric list. (+metric_foo to enable metric_foo, -metric_bar to disable metric_bar) --monitor-queue-size int Size of the event queue when reading monitor events --pprof Enable serving pprof debugging API --pprof-address string Address that pprof listens on (default "localhost") diff --git a/Documentation/cmdref/cilium-agent_hive_dot-graph.md b/Documentation/cmdref/cilium-agent_hive_dot-graph.md index e5d5f28ae9864..78236670ce89b 100644 --- a/Documentation/cmdref/cilium-agent_hive_dot-graph.md +++ b/Documentation/cmdref/cilium-agent_hive_dot-graph.md @@ -57,7 +57,7 @@ cilium-agent hive dot-graph [flags] --mesh-auth-rotated-identities-queue-size int The size of the queue for signaling rotated identities. (default 1024) --mesh-auth-spiffe-trust-domain string The trust domain for the SPIFFE identity. (default "spiffe.cilium") --mesh-auth-spire-admin-socket string The path for the SPIRE admin agent Unix socket. - --metrics strings Metrics that should be enabled or disabled from the default metric list. (+metric_foo to enable metric_foo, -metric_bar to disable metric_bar) + --metrics strings Comma separated list of metrics that should be enabled or disabled from the default metric list. (+metric_foo to enable metric_foo, -metric_bar to disable metric_bar) --monitor-queue-size int Size of the event queue when reading monitor events --pprof Enable serving pprof debugging API --pprof-address string Address that pprof listens on (default "localhost") diff --git a/Documentation/helm-values.rst b/Documentation/helm-values.rst index e4bb4653667ef..48f4b270210ff 100644 --- a/Documentation/helm-values.rst +++ b/Documentation/helm-values.rst @@ -2665,7 +2665,7 @@ - list - ``["write-cni-file","sync-host-ips","sync-lb-maps-with-k8s-services"]`` * - :spelling:ignore:`prometheus.metrics` - - Metrics that should be enabled or disabled from the default metric list. The list is expected to be separated by a space. (+metric_foo to enable metric_foo , -metric_bar to disable metric_bar). ref: https://docs.cilium.io/en/stable/observability/metrics/ + - Metrics that should be enabled or disabled from the default metric list. (+metric_foo to enable metric_foo , -metric_bar to disable metric_bar). ref: https://docs.cilium.io/en/stable/observability/metrics/ - string - ``nil`` * - :spelling:ignore:`prometheus.serviceMonitor.annotations` diff --git a/Documentation/observability/metrics.rst b/Documentation/observability/metrics.rst index 58b1a1e1f64d4..91b74a7877913 100644 --- a/Documentation/observability/metrics.rst +++ b/Documentation/observability/metrics.rst @@ -251,14 +251,14 @@ passing an empty IP (e.g. ``:9962``) will bind the server to all available interfaces (there is usually only one in a container). To customize ``cilium-agent`` metrics, configure the ``--metrics`` option with -``"+metric_a -metric_b -metric_c"``, where ``+/-`` means to enable/disable +``"+metric_a,-metric_b,-metric_c"``, where ``+/-`` means to enable/disable the metric. For example, for really large clusters, users may consider to disable the following two metrics as they generate too much data: - ``cilium_node_connectivity_status`` - ``cilium_node_connectivity_latency_seconds`` -You can then configure the agent with ``--metrics="-cilium_node_connectivity_status -cilium_node_connectivity_latency_seconds"``. +You can then configure the agent with ``--metrics="-cilium_node_connectivity_status,-cilium_node_connectivity_latency_seconds"``. Exported Metrics ^^^^^^^^^^^^^^^^ diff --git a/install/kubernetes/cilium/README.md b/install/kubernetes/cilium/README.md index aa3afb803ecff..ff4d0bdff4758 100644 --- a/install/kubernetes/cilium/README.md +++ b/install/kubernetes/cilium/README.md @@ -716,7 +716,7 @@ contributors across the globe, there is almost always someone available to help. | priorityClassName | string | `""` | The priority class to use for cilium-agent. | | prometheus | object | `{"controllerGroupMetrics":["write-cni-file","sync-host-ips","sync-lb-maps-with-k8s-services"],"enabled":false,"metrics":null,"port":9962,"serviceMonitor":{"annotations":{},"enabled":false,"interval":"10s","jobLabel":"","labels":{},"metricRelabelings":null,"relabelings":[{"replacement":"${1}","sourceLabels":["__meta_kubernetes_pod_node_name"],"targetLabel":"node"}],"trustCRDsExist":false}}` | Configure prometheus metrics on the configured port at /metrics | | prometheus.controllerGroupMetrics | list | `["write-cni-file","sync-host-ips","sync-lb-maps-with-k8s-services"]` | - Enable controller group metrics for monitoring specific Cilium subsystems. The list is a list of controller group names. The special values of "all" and "none" are supported. The set of controller group names is not guaranteed to be stable between Cilium versions. | -| prometheus.metrics | string | `nil` | Metrics that should be enabled or disabled from the default metric list. The list is expected to be separated by a space. (+metric_foo to enable metric_foo , -metric_bar to disable metric_bar). ref: https://docs.cilium.io/en/stable/observability/metrics/ | +| prometheus.metrics | string | `nil` | Metrics that should be enabled or disabled from the default metric list. (+metric_foo to enable metric_foo , -metric_bar to disable metric_bar). ref: https://docs.cilium.io/en/stable/observability/metrics/ | | prometheus.serviceMonitor.annotations | object | `{}` | Annotations to add to ServiceMonitor cilium-agent | | prometheus.serviceMonitor.enabled | bool | `false` | Enable service monitors. This requires the prometheus CRDs to be available (see https://github.com/prometheus-operator/prometheus-operator/blob/main/example/prometheus-operator-crd/monitoring.coreos.com_servicemonitors.yaml) | | prometheus.serviceMonitor.interval | string | `"10s"` | Interval for scrape metrics. | diff --git a/install/kubernetes/cilium/templates/cilium-configmap.yaml b/install/kubernetes/cilium/templates/cilium-configmap.yaml index 6f1e42cb136ae..944a4a16ee5b5 100644 --- a/install/kubernetes/cilium/templates/cilium-configmap.yaml +++ b/install/kubernetes/cilium/templates/cilium-configmap.yaml @@ -206,16 +206,12 @@ data: # Metrics that should be enabled or disabled from the default metric # list. (+metric_foo to enable metric_foo , -metric_bar to disable # metric_bar). - metrics: {{- range .Values.prometheus.metrics }} - {{ . }} - {{- end }} + metrics: {{ .Values.prometheus.metrics | join "," | quote }} {{- end }} {{- if .Values.prometheus.controllerGroupMetrics }} - # A space-separated list of controller groups for which to enable metrics. + # A comma-separated list of controller groups for which to enable metrics. # The special values of "all" and "none" are supported. - controller-group-metrics: {{- range .Values.prometheus.controllerGroupMetrics }} - {{ . }} - {{- end }} + controller-group-metrics: {{ .Values.prometheus.controllerGroupMetrics | join "," | quote }} {{- end }} {{- end }} diff --git a/install/kubernetes/cilium/values.yaml b/install/kubernetes/cilium/values.yaml index 47f096ddc6514..41e12823e1bb2 100644 --- a/install/kubernetes/cilium/values.yaml +++ b/install/kubernetes/cilium/values.yaml @@ -1929,8 +1929,7 @@ prometheus: trustCRDsExist: false # -- Metrics that should be enabled or disabled from the default metric list. - # The list is expected to be separated by a space. (+metric_foo to enable - # metric_foo , -metric_bar to disable metric_bar). + # (+metric_foo to enable metric_foo , -metric_bar to disable metric_bar). # ref: https://docs.cilium.io/en/stable/observability/metrics/ metrics: ~ diff --git a/install/kubernetes/cilium/values.yaml.tmpl b/install/kubernetes/cilium/values.yaml.tmpl index bb22548c89841..a298297dc79f4 100644 --- a/install/kubernetes/cilium/values.yaml.tmpl +++ b/install/kubernetes/cilium/values.yaml.tmpl @@ -1926,8 +1926,7 @@ prometheus: trustCRDsExist: false # -- Metrics that should be enabled or disabled from the default metric list. - # The list is expected to be separated by a space. (+metric_foo to enable - # metric_foo , -metric_bar to disable metric_bar). + # (+metric_foo to enable metric_foo , -metric_bar to disable metric_bar). # ref: https://docs.cilium.io/en/stable/observability/metrics/ metrics: ~ diff --git a/pkg/metrics/registry.go b/pkg/metrics/registry.go index a5a4af4ba23f2..f029fe1881b18 100644 --- a/pkg/metrics/registry.go +++ b/pkg/metrics/registry.go @@ -36,7 +36,7 @@ type RegistryConfig struct { func (rc RegistryConfig) Flags(flags *pflag.FlagSet) { flags.String("prometheus-serve-addr", rc.PrometheusServeAddr, "IP:Port on which to serve prometheus metrics (pass \":Port\" to bind on all interfaces, \"\" is off)") - flags.StringSlice("metrics", rc.Metrics, "Metrics that should be enabled or disabled from the default metric list. (+metric_foo to enable metric_foo, -metric_bar to disable metric_bar)") + flags.StringSlice("metrics", rc.Metrics, "Comma separated list of metrics that should be enabled or disabled from the default metric list. (+metric_foo to enable metric_foo, -metric_bar to disable metric_bar)") } // RegistryParams are the parameters needed to construct a Registry