This is an automated email from the ASF dual-hosted git repository. wankai pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/skywalking-showcase.git
The following commit(s) were added to refs/heads/main by this push: new fbebf43 Add rocketmq showcase (#162) fbebf43 is described below commit fbebf43fc3e337e249e048192fa56da2183cd524 Author: peachisai <2581009...@qq.com> AuthorDate: Mon Feb 26 11:12:39 2024 +0800 Add rocketmq showcase (#162) --- Makefile.in | 4 +- .../rocketmq/otel-collector-rocketmq-config.yaml | 45 +++++++ deploy/platform/docker/docker-compose.cluster.yaml | 2 +- .../docker/docker-compose.rocketmq-monitor.yaml | 117 ++++++++++++++++++ .../docker/docker-compose.single-node.yaml | 2 +- deploy/platform/kubernetes/Chart.yaml | 2 +- deploy/platform/kubernetes/Makefile | 5 + deploy/platform/kubernetes/Makefile.in | 2 +- .../feature-rocketmq/opentelemetry-config.yaml} | 26 +++- .../templates/feature-rocketmq/resource.yaml | 137 +++++++++++++++++++++ .../templates/otel-collector-config.yaml | 1 + deploy/platform/kubernetes/values.yaml | 5 +- docs/readme.md | 2 +- 13 files changed, 336 insertions(+), 14 deletions(-) diff --git a/Makefile.in b/Makefile.in index d5edc86..0920998 100644 --- a/Makefile.in +++ b/Makefile.in @@ -29,10 +29,10 @@ ES_IMAGE ?= docker.elastic.co/elasticsearch/elasticsearch-oss ES_IMAGE_TAG ?= 7.10.2 SW_OAP_IMAGE ?= ghcr.io/apache/skywalking/oap -SW_OAP_IMAGE_TAG ?= 78d9e33f10bb6be2a22396fd2d082f1c338952f3 +SW_OAP_IMAGE_TAG ?= 6b49098aed66680025e50b8b18419e2b02423c46 SW_UI_IMAGE ?= ghcr.io/apache/skywalking/ui -SW_UI_IMAGE_TAG ?= 78d9e33f10bb6be2a22396fd2d082f1c338952f3 +SW_UI_IMAGE_TAG ?= 6b49098aed66680025e50b8b18419e2b02423c46 SW_CLI_IMAGE ?= ghcr.io/apache/skywalking-cli/skywalking-cli:0883266bfaa36612927b69e35781b64ea181758d SW_EVENT_EXPORTER_IMAGE ?= ghcr.io/apache/skywalking-kubernetes-event-exporter/skywalking-kubernetes-event-exporter:8a012a3f968cb139f817189afb9b3748841bba22 diff --git a/deploy/platform/docker/config/rocketmq/otel-collector-rocketmq-config.yaml b/deploy/platform/docker/config/rocketmq/otel-collector-rocketmq-config.yaml new file mode 100644 index 0000000..dc7db20 --- /dev/null +++ b/deploy/platform/docker/config/rocketmq/otel-collector-rocketmq-config.yaml @@ -0,0 +1,45 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +receivers: + prometheus: + config: + scrape_configs: + - job_name: "rocketmq-monitoring" + scrape_interval: 30s + static_configs: + - targets: ['rocketmq-exporter:5557'] + relabel_configs: + - source_labels: [ ] + target_label: cluster + replacement: rocketmq-cluster + +exporters: + otlp: + endpoint: oap:11800 + tls: + insecure: true + +processors: + batch: +service: + pipelines: + metrics: + receivers: + - prometheus + processors: + - batch + exporters: + - otlp \ No newline at end of file diff --git a/deploy/platform/docker/docker-compose.cluster.yaml b/deploy/platform/docker/docker-compose.cluster.yaml index bb4d41f..cb0a106 100644 --- a/deploy/platform/docker/docker-compose.cluster.yaml +++ b/deploy/platform/docker/docker-compose.cluster.yaml @@ -53,7 +53,7 @@ services: SW_CLUSTER_ZK_HOST_PORT: zookeeper:2181 # @feature: cluster; set up the cluster coordinator address SW_HEALTH_CHECKER: default # @feature: health-check; SW_OTEL_RECEIVER: default # @feature: vm; enable the OC receiver that receives the VM metrics - SW_OTEL_RECEIVER_ENABLED_OTEL_METRICS_RULES: vm,mysql/*,postgresql/*,apisix,elasticsearch/*,rabbitmq/*,mongodb/* # @feature: vm; enable the OC rules that analyse the VM metrics + SW_OTEL_RECEIVER_ENABLED_OTEL_METRICS_RULES: vm,mysql/*,postgresql/*,apisix,elasticsearch/*,rabbitmq/*,mongodb/*,rocketmq/* # @feature: vm; enable the OC rules that analyse the VM metrics SW_STORAGE: elasticsearch SW_STORAGE_ES_CLUSTER_NODES: elasticsearch:9200 SW_TELEMETRY: prometheus # @feature: so11y; expose the metrics of self o11y through prometheus diff --git a/deploy/platform/docker/docker-compose.rocketmq-monitor.yaml b/deploy/platform/docker/docker-compose.rocketmq-monitor.yaml new file mode 100644 index 0000000..2a5fc52 --- /dev/null +++ b/deploy/platform/docker/docker-compose.rocketmq-monitor.yaml @@ -0,0 +1,117 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +version: "3" + +services: + oap: + extends: + file: ../../script/docker-compose/base-compose.yml + service: oap + ports: + - "12800:12800" + networks: + - e2e + + rocketmq-namesrv-1: + image: apache/rocketmq:4.9.4 + hostname: rocketmq-namesrv-1 + ports: + - "9876:9876" + environment: + TZ: Asia/Shanghai + command: sh mqnamesrv + healthcheck: + test: [ "CMD", "nc", "-nz", "127.0.0.1", "9876" ] + interval: 15s + timeout: 10s + retries: 120 + networks: + - e2e + + rocketmq-broker-1: + image: apache/rocketmq:4.9.4 + hostname: rocketmq-broker-1 + ports: + - "10911:10911" + - "10909:10909" + environment: + TZ: Asia/Shanghai + NAMESRV_ADDR: "rocketmq-namesrv-1:9876" + command: sh mqbroker + healthcheck: + test: [ "CMD", "nc", "-nz", "127.0.0.1", "10911" ] + interval: 15s + timeout: 10s + retries: 120 + depends_on: + rocketmq-namesrv-1: + condition: service_healthy + networks: + - e2e + + rocketmq-producer-perf-test: + image: apache/rocketmq:4.9.4 + hostname: rocketmq-producer-perf-test + environment: + TZ: Asia/Shanghai + NAMESRV_ADDR: "rocketmq-namesrv-1:9876" + command: sh tools.sh org.apache.rocketmq.example.quickstart.Producer + depends_on: + rocketmq-broker-1: + condition: service_healthy + networks: + - e2e + + rocketmq-consumer-perf-test: + image: apache/rocketmq:4.9.4 + hostname: rocketmq-consumer-perf-test + environment: + TZ: Asia/Shanghai + NAMESRV_ADDR: "rocketmq-namesrv-1:9876" + command: sh tools.sh org.apache.rocketmq.example.quickstart.Consumer + depends_on: + - rocketmq-producer-perf-test + networks: + - e2e + + rocketmq-exporter: + image: apache/rocketmq-exporter:0.0.2 + hostname: rocketmq-exporter + ports: + - "5557:5557" + environment: + TZ: Asia/Shanghai + rocketmq.config.namesrvAddr: "rocketmq-namesrv-1:9876" + depends_on: + - rocketmq-consumer-perf-test + networks: + - e2e + + otel-collector: + image: otel/opentelemetry-collector:${OTEL_COLLECTOR_VERSION} + networks: + - e2e + command: [ "--config=/etc/otel-collector-rocketmq-config.yaml" ] + volumes: + - ./config/rocketmq/otel-collector-rocketmq-config.yaml:/etc/otel-collector-config.yaml + expose: + - 55678 + depends_on: + oap: + condition: service_healthy + +networks: + e2e: \ No newline at end of file diff --git a/deploy/platform/docker/docker-compose.single-node.yaml b/deploy/platform/docker/docker-compose.single-node.yaml index 705ca26..e1b3436 100644 --- a/deploy/platform/docker/docker-compose.single-node.yaml +++ b/deploy/platform/docker/docker-compose.single-node.yaml @@ -43,7 +43,7 @@ services: environment: SW_HEALTH_CHECKER: default # @feature: health-check; SW_OTEL_RECEIVER: default # @feature: vm; enable the OC receiver that receives the VM metrics - SW_OTEL_RECEIVER_ENABLED_OTEL_METRICS_RULES: vm,mysql/*,postgresql/*,elasticsearch/*,rabbitmq/*,mongodb/* # @feature: vm,mysql,postgresql,elasticsearch; enable the OC rules that analyse the metrics + SW_OTEL_RECEIVER_ENABLED_OTEL_METRICS_RULES: vm,mysql/*,postgresql/*,elasticsearch/*,rabbitmq/*,mongodb/*,rocketmq/* # @feature: vm,mysql,postgresql,elasticsearch; enable the OC rules that analyse the metrics SW_STORAGE: elasticsearch SW_STORAGE_ES_CLUSTER_NODES: elasticsearch:9200 SW_TELEMETRY: prometheus # @feature: so11y; expose the metrics of self o11y through prometheus diff --git a/deploy/platform/kubernetes/Chart.yaml b/deploy/platform/kubernetes/Chart.yaml index 1aa789f..3d72e74 100644 --- a/deploy/platform/kubernetes/Chart.yaml +++ b/deploy/platform/kubernetes/Chart.yaml @@ -67,4 +67,4 @@ dependencies: - name: opentelemetry-collector version: 0.51.1 repository: https://open-telemetry.github.io/opentelemetry-helm-charts - condition: opentelemetry.enabled + condition: opentelemetry.enabled \ No newline at end of file diff --git a/deploy/platform/kubernetes/Makefile b/deploy/platform/kubernetes/Makefile index 275c94b..ab5589c 100644 --- a/deploy/platform/kubernetes/Makefile +++ b/deploy/platform/kubernetes/Makefile @@ -177,6 +177,11 @@ feature-r3: $(eval HELM_OPTIONS := $(HELM_OPTIONS) --set features.r3.enabled=true) $(eval HELM_OPTIONS := $(HELM_OPTIONS) --set skywalking.oap.env.SW_AI_PIPELINE_URI_RECOGNITION_SERVER_ADDR=r3) +.PHONY: feature-rocketmq-monitor +feature-rocketmq-monitor: + $(eval HELM_OPTIONS := $(HELM_OPTIONS) --set features.rocketmqMonitor.enabled=true) + $(eval HELM_OPTIONS := $(HELM_OPTIONS) --set opentelemetry.enabled=true) + .PHONY: deploy deploy: $(features) helm dep up . diff --git a/deploy/platform/kubernetes/Makefile.in b/deploy/platform/kubernetes/Makefile.in index 5eb6bbe..ac910e6 100644 --- a/deploy/platform/kubernetes/Makefile.in +++ b/deploy/platform/kubernetes/Makefile.in @@ -23,4 +23,4 @@ SAMPLE_SERVICES_NAMESPACE ?= sample-services RELEASE ?= demo AGENTLESS ?= false -FEATURE_FLAGS ?= java-agent-injector,cluster,elasticsearch,kubernetes-monitor,so11y,vm-monitor,als,event,istiod-monitor,satellite,rover,trace-profiling,mysql-monitor,postgresql-monitor,nginx-monitor,apisix-monitor,grafana,elasticsearch-monitor,rabbitmq-monitor,mongodb-monitor,r3 +FEATURE_FLAGS ?= java-agent-injector,cluster,elasticsearch,kubernetes-monitor,so11y,vm-monitor,als,event,istiod-monitor,satellite,rover,trace-profiling,mysql-monitor,postgresql-monitor,nginx-monitor,apisix-monitor,grafana,elasticsearch-monitor,rabbitmq-monitor,mongodb-monitor,r3,rocketmq-monitor diff --git a/deploy/platform/kubernetes/Makefile.in b/deploy/platform/kubernetes/templates/feature-rocketmq/opentelemetry-config.yaml similarity index 53% copy from deploy/platform/kubernetes/Makefile.in copy to deploy/platform/kubernetes/templates/feature-rocketmq/opentelemetry-config.yaml index 5eb6bbe..6dc6dfe 100644 --- a/deploy/platform/kubernetes/Makefile.in +++ b/deploy/platform/kubernetes/templates/feature-rocketmq/opentelemetry-config.yaml @@ -16,11 +16,25 @@ # under the License. # -.EXPORT_ALL_VARIABLES: +{{- define "opentelemetry-config-rocketmq-monitor" }} +{{- if .Values.features.rocketmqMonitor.enabled }} -NAMESPACE ?= skywalking-showcase -SAMPLE_SERVICES_NAMESPACE ?= sample-services -RELEASE ?= demo -AGENTLESS ?= false +- job_name: "rocketmq-monitoring" + scrape_interval: 30s + metrics_path: "/metrics" + kubernetes_sd_configs: + - role: pod + relabel_configs: + - source_labels: [ __meta_kubernetes_pod_container_name, __meta_kubernetes_pod_container_port_name ] + action: keep + regex: rocketmq-exporter;metrics + - source_labels: [ ] + target_label: cluster + replacement: rocketmq.{{ .Release.Namespace }} + - source_labels: [ __meta_kubernetes_pod_name ] + target_label: service_instance_id + regex: (.+) + replacement: $$1 -FEATURE_FLAGS ?= java-agent-injector,cluster,elasticsearch,kubernetes-monitor,so11y,vm-monitor,als,event,istiod-monitor,satellite,rover,trace-profiling,mysql-monitor,postgresql-monitor,nginx-monitor,apisix-monitor,grafana,elasticsearch-monitor,rabbitmq-monitor,mongodb-monitor,r3 +{{- end }} +{{- end }} diff --git a/deploy/platform/kubernetes/templates/feature-rocketmq/resource.yaml b/deploy/platform/kubernetes/templates/feature-rocketmq/resource.yaml new file mode 100644 index 0000000..a74fc19 --- /dev/null +++ b/deploy/platform/kubernetes/templates/feature-rocketmq/resource.yaml @@ -0,0 +1,137 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + +{{- if .Values.features.rocketmqMonitor.enabled }} + +apiVersion: v1 +kind: Service +metadata: + name: rocketmq +spec: + ports: + - protocol: TCP + port: 9876 + targetPort: 9876 + selector: + app: rocketmq + +--- +apiVersion: v1 +kind: Service +metadata: + name: rocketmq-exporter +spec: + ports: + - protocol: TCP + port: 5557 + targetPort: 5557 + selector: + app: rocketmq + +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: rocketmq +spec: + replicas: 1 + selector: + matchLabels: + app: rocketmq + template: + metadata: + labels: + app: rocketmq + annotations: + sidecar.istio.io/inject: "false" + spec: + containers: + - name: mqnamesrv + image: apache/rocketmq:4.9.4 + imagePullPolicy: IfNotPresent + ports: + - containerPort: 9876 + env: + - name: TZ + value: "Asia/Shanghai" + - name: JAVA_OPT_EXT + value: "-Xmx128m -Xms128m" + command: ["sh", "mqnamesrv"] + - name: rocketmq-broker + image: apache/rocketmq:4.9.4 + imagePullPolicy: IfNotPresent + ports: + - containerPort: 10911 + - containerPort: 10909 + env: + - name: TZ + value: "Asia/Shanghai" + - name: NAMESRV_ADDR + value: "localhost:9876" + - name: JAVA_OPT_EXT + value: "-Xmx128m -Xms128m" + command: [ "sh", "mqbroker" ] + - name: rocketmq-consumer-perf-test + image: apache/rocketmq:4.9.4 + imagePullPolicy: IfNotPresent + env: + - name: TZ + value: "Asia/Shanghai" + - name: NAMESRV_ADDR + value: "localhost:9876" + command: ["sh", "tools.sh", "org.apache.rocketmq.example.quickstart.Consumer"] + - name: rocketmq-exporter + image: apache/rocketmq-exporter:0.0.2 + imagePullPolicy: IfNotPresent + ports: + - containerPort: 5557 + name: metrics + env: + - name: TZ + value: "Asia/Shanghai" + - name: rocketmq.config.namesrvAddr + value: "localhost:9876" + +--- +apiVersion: batch/v1 +kind: CronJob +metadata: + name: rocketmq-producer-development +spec: + schedule: "*/10 * * * *" + successfulJobsHistoryLimit: 1 + failedJobsHistoryLimit: 1 + jobTemplate: + spec: + template: + spec: + restartPolicy: Never + containers: + - name: rocketmq-producer-perf-test + image: apache/rocketmq:4.9.4 + imagePullPolicy: IfNotPresent + env: + - name: TZ + value: "Asia/Shanghai" + - name: NAMESRV_ADDR + value: "rocketmq-service:9876" + - name: JAVA_OPT_EXT + value: "-Xmx128m -Xms128m" + command: [ "sh", "tools.sh", "org.apache.rocketmq.example.quickstart.Producer" ] + +{{- end }} \ No newline at end of file diff --git a/deploy/platform/kubernetes/templates/otel-collector-config.yaml b/deploy/platform/kubernetes/templates/otel-collector-config.yaml index ba3a09f..8d5c86d 100644 --- a/deploy/platform/kubernetes/templates/otel-collector-config.yaml +++ b/deploy/platform/kubernetes/templates/otel-collector-config.yaml @@ -39,6 +39,7 @@ data: {{- 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 }} exporters: otlp: diff --git a/deploy/platform/kubernetes/values.yaml b/deploy/platform/kubernetes/values.yaml index 9193f4c..eb4b8b1 100644 --- a/deploy/platform/kubernetes/values.yaml +++ b/deploy/platform/kubernetes/values.yaml @@ -40,7 +40,7 @@ skywalking: # @feature: istiod-monitor; enable rules to analyze Istio control plane metrics # @feature: mysql; enable mysql rules to analyze MySQL metrics # @feature: apisix-monitor; enable APISIX rules to analyze APISIX metrics - SW_OTEL_RECEIVER_ENABLED_OTEL_METRICS_RULES: vm,oap,k8s/*,istio-controlplane,mysql/*,postgresql/*,apisix,elasticsearch/*,rabbitmq/*,mongodb/*,nginx/* + SW_OTEL_RECEIVER_ENABLED_OTEL_METRICS_RULES: vm,oap,k8s/*,istio-controlplane,mysql/*,postgresql/*,apisix,elasticsearch/*,rabbitmq/*,mongodb/*,nginx/*,rocketmq/* SW_TELEMETRY: prometheus # @feature: so11y; expose the metrics of self o11y through prometheus SW_ENVOY_METRIC_ALS_HTTP_ANALYSIS: "mx-mesh,persistence" # @feature: als; enable mesh analyzer (mx-mesh) to analyze ALS logs K8S_SERVICE_NAME_RULE: "mesh-svr::${service.metadata.name}.${service.metadata.namespace}" @@ -352,3 +352,6 @@ features: r3: enabled: false image: ~ + + rocketmqMonitor: + enabled: false diff --git a/docs/readme.md b/docs/readme.md index a3205ed..0b095cd 100644 --- a/docs/readme.md +++ b/docs/readme.md @@ -111,7 +111,7 @@ Currently, the features supported are: | `mesh-with-agent` | Deploy services with java agent in the service mesh environment. | Only support deployment in the Kubernetes environment, docker is not supported. | | `grafana` | Deploy a Grafana to show SkyWalking metrics and logs on the Grafana UI. | Feel free to modify the Grafana config when deploy your own environment. | | `r3` | Deploy [R3](https://github.com/SkyAPM/R3) as RESTful URL recognition service. | | - +| `rocketmq-monitor` | Deploy OpenTelemetry and export RocketMQ monitoring metrics to SkyWalking for analysis and display on UI. | | ### Kubernetes To deploy the example application in Kubernetes, please make sure that you have `kubectl` command available, and it can