From a092df1cf99fd57c9ca11a70ee3a14796e2a07cc Mon Sep 17 00:00:00 2001 From: kezhenxu94 Date: Tue, 3 Sep 2024 19:42:59 +0800 Subject: [PATCH] Split pipelines for each monitoring feature (#184) --- .../templates/otel-collector-config.yaml | 47 ++++++++++++------- 1 file changed, 30 insertions(+), 17 deletions(-) diff --git a/deploy/platform/kubernetes/templates/otel-collector-config.yaml b/deploy/platform/kubernetes/templates/otel-collector-config.yaml index 9d163aa..33a9f37 100644 --- a/deploy/platform/kubernetes/templates/otel-collector-config.yaml +++ b/deploy/platform/kubernetes/templates/otel-collector-config.yaml @@ -16,7 +16,22 @@ # under the License. # {{- if .Values.opentelemetry.enabled }} - +{{- $configs := list + "opentelemetry-config-nginx" + "opentelemetry-config-apisix" + "opentelemetry-config-istiod-monitor" + "opentelemetry-config-kubernetes-monitor" + "opentelemetry-config-mysql-monitor" + "opentelemetry-config-postgresql-monitor" + "opentelemetry-config-so11y" + "opentelemetry-config-vm" + "opentelemetry-config-elasticsearch-monitor" + "opentelemetry-config-rabbitmq-monitor" + "opentelemetry-config-mongodb-monitor" + "opentelemetry-config-rocketmq-monitor" + "opentelemetry-config-pulsar-monitor" + "opentelemetry-config-activemq-monitor" +}} --- apiVersion: v1 kind: ConfigMap @@ -25,23 +40,15 @@ metadata: data: config.yaml: | receivers: - prometheus: + {{- $root := . -}} + {{- range $idx, $config := $configs -}} + {{- if not (include $config $root | trim | empty) }} + prometheus/{{ $idx }}: config: scrape_configs: - {{- include "opentelemetry-config-nginx" . | indent 12 }} - {{- include "opentelemetry-config-apisix" . | indent 12 }} - {{- include "opentelemetry-config-istiod-monitor" . | indent 12 }} - {{- include "opentelemetry-config-kubernetes-monitor" . | indent 12 }} - {{- include "opentelemetry-config-mysql-monitor" . | indent 12 }} - {{- include "opentelemetry-config-postgresql-monitor" . | indent 12 }} - {{- include "opentelemetry-config-so11y" . | indent 12 }} - {{- include "opentelemetry-config-vm" . | indent 12 }} - {{- include "opentelemetry-config-elasticsearch-monitor" . | indent 12 }} - {{- include "opentelemetry-config-rabbitmq-monitor" . | indent 12 }} - {{- include "opentelemetry-config-mongodb-monitor" . | indent 12 }} - {{- include "opentelemetry-config-rocketmq-monitor" . | indent 12 }} - {{- include "opentelemetry-config-pulsar-monitor" . | indent 12 }} - {{- include "opentelemetry-config-activemq-monitor" . | indent 12 }} + {{- include $config $root | indent 12 }} + {{- end }} + {{- end }} exporters: otlp: @@ -60,7 +67,13 @@ data: service: pipelines: metrics: - receivers: [ prometheus ] + receivers: + {{- $root := . }} + {{- range $idx, $config := $configs }} + {{- if not (include $config $root | trim | empty) }} + - prometheus/{{ $idx }} + {{- end }} + {{- end }} exporters: [ otlp,logging ] extensions: - health_check