Skip to content

Commit dd9864d

Browse files
authored
Implement self-monitoring for BanyanDB via OAP Server and UI. (#211)
1 parent 73d1461 commit dd9864d

File tree

10 files changed

+144
-8
lines changed

10 files changed

+144
-8
lines changed

deploy/platform/docker/Makefile.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@
1717
#
1818

1919
.EXPORT_ALL_VARIABLES:
20-
FEATURE_FLAGS ?= agent,cluster,so11y,vm-monitor,event,mysql-monitor,nginx-monitor,apisix-monitor,grafana,elasticsearch-monitor,pulsar-monitor,activemq-monitor
20+
FEATURE_FLAGS ?= agent,cluster,so11y,vm-monitor,event,mysql-monitor,nginx-monitor,apisix-monitor,grafana,elasticsearch-monitor,pulsar-monitor,activemq-monitor,banyandb-monitor
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one or more
2+
# contributor license agreements. See the NOTICE file distributed with
3+
# this work for additional information regarding copyright ownership.
4+
# The ASF licenses this file to You under the Apache License, Version 2.0
5+
# (the "License"); you may not use this file except in compliance with
6+
# the License. You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
receivers:
17+
prometheus:
18+
config:
19+
scrape_configs:
20+
- job_name: "banyandb-monitoring"
21+
scrape_interval: 10s
22+
static_configs:
23+
- targets: ["banyandb:2121"]
24+
labels:
25+
host_name: root[root]
26+
27+
processors:
28+
batch:
29+
30+
exporters:
31+
otlp:
32+
endpoint: "oap:11800"
33+
tls:
34+
insecure: true
35+
debug:
36+
verbosity: detailed
37+
38+
service:
39+
pipelines:
40+
metrics:
41+
receivers:
42+
- prometheus
43+
processors:
44+
- batch
45+
exporters:
46+
- otlp
47+
48+
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
#
18+
19+
version: '2.1'
20+
21+
services:
22+
otel-collector:
23+
image: ${OTEL_COLLECTOR_IMAGE}:${OTEL_COLLECTOR_IMAGE_TAG}
24+
networks:
25+
- sw
26+
command: [ "--config=/etc/otel-collector-config.yaml" ]
27+
volumes:
28+
- ./config/otel-collector-config-banyandb.yaml:/etc/otel-collector-config.yaml
29+
expose:
30+
- 55678
31+
depends_on:
32+
oap:
33+
condition: service_healthy
34+
networks:
35+
sw:
36+

deploy/platform/docker/docker-compose.single-node.yaml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,11 @@ services:
2323
networks: [ sw ]
2424
expose:
2525
- 17912
26+
- 2121
2627
ports:
2728
- "17913:17913"
28-
command: standalone --observability-modes=native
29+
- "2121:2121"
30+
command: standalone
2931
healthcheck:
3032
test: ["CMD", "nc", "-z", "127.0.0.1", "17913"]
3133
interval: 30s
@@ -35,10 +37,15 @@ services:
3537
oap:
3638
image: ${SW_OAP_IMAGE}:${SW_OAP_IMAGE_TAG}
3739
networks: [ sw ]
40+
expose:
41+
- 11800
42+
ports:
43+
- "11800:11800"
44+
- "12800:12800"
3845
environment:
3946
SW_HEALTH_CHECKER: default # @feature: health-check;
4047
SW_OTEL_RECEIVER: default # @feature: vm; enable the OC receiver that receives the VM metrics
41-
SW_OTEL_RECEIVER_ENABLED_OTEL_METRICS_RULES: vm,mysql/*,postgresql/*,elasticsearch/*,rabbitmq/*,mongodb/*,rocketmq/*,pulsar/*,activemq/*,flink/* # @feature: vm,mysql,postgresql,elasticsearch; enable the OC rules that analyse the metrics
48+
SW_OTEL_RECEIVER_ENABLED_OTEL_METRICS_RULES: banyandb,vm,mysql/*,postgresql/*,elasticsearch/*,rabbitmq/*,mongodb/*,rocketmq/*,pulsar/*,activemq/*,flink/* # @feature: vm,mysql,postgresql,elasticsearch; enable the OC rules that analyse the metrics
4249
SW_STORAGE: banyandb
4350
SW_STORAGE_BANYANDB_TARGETS: banyandb:17912
4451
SW_TELEMETRY: prometheus # @feature: so11y; expose the metrics of self o11y through prometheus
@@ -55,7 +62,7 @@ services:
5562
condition: service_healthy
5663

5764
ui:
58-
image: ${SW_UI_IMAGE}
65+
image: ${SW_UI_IMAGE}:${SW_UI_IMAGE_TAG}
5966
networks: [ sw ]
6067
ports:
6168
- "9999:8080"

deploy/platform/kubernetes/Makefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,11 @@ feature-mysql-monitor:
148148
$(eval HELM_OPTIONS := $(HELM_OPTIONS) --set features.mysqlMonitor.enabled=true)
149149
$(eval HELM_OPTIONS := $(HELM_OPTIONS) --set opentelemetry.enabled=true)
150150

151+
.PHONY: feature-banyandb-monitor
152+
feature-banyandb-monitor:
153+
$(eval HELM_OPTIONS := $(HELM_OPTIONS) --set features.banyandbMonitor.enabled=true)
154+
$(eval HELM_OPTIONS := $(HELM_OPTIONS) --set opentelemetry.enabled=true)
155+
151156
.PHONY: feature-postgresql-monitor
152157
feature-postgresql-monitor:
153158
$(eval HELM_OPTIONS := $(HELM_OPTIONS) --set features.postgresqlMonitor.enabled=true)

deploy/platform/kubernetes/Makefile.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,4 @@ RELEASE ?= demo
2525
AGENTLESS ?= false
2626
SCALLER_ENABLE ?= false
2727

28-
FEATURE_FLAGS ?= java-agent-injector,cluster,banyandb,kubernetes-monitor,so11y,vm-monitor,als,event,istiod-monitor,satellite,rover,trace-profiling,mysql-monitor,postgresql-monitor,nginx-monitor,apisix-monitor,grafana,rabbitmq-monitor,mongodb-monitor,r3,rocketmq-monitor,pulsar-monitor,activemq-monitor,flink-monitor
28+
FEATURE_FLAGS ?= banyandb-monitor,java-agent-injector,cluster,banyandb,kubernetes-monitor,so11y,vm-monitor,als,event,istiod-monitor,satellite,rover,trace-profiling,mysql-monitor,postgresql-monitor,nginx-monitor,apisix-monitor,grafana,rabbitmq-monitor,mongodb-monitor,r3,rocketmq-monitor,pulsar-monitor,activemq-monitor,flink-monitor
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one or more
2+
# contributor license agreements. See the NOTICE file distributed with
3+
# this work for additional information regarding copyright ownership.
4+
# The ASF licenses this file to You under the Apache License, Version 2.0
5+
# (the "License"); you may not use this file except in compliance with
6+
# the License. You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
{{- define "opentelemetry-config-banyandb-monitor" }}
17+
{{- if .Values.features.banyandbMonitor.enabled }}
18+
19+
# @feature: banyandb-monitor; set OpenTelemetry config to scrape the banyandb metrics
20+
- job_name: 'banyandb-monitoring'
21+
metrics_path: '/metrics'
22+
kubernetes_sd_configs:
23+
- role: pod
24+
relabel_configs:
25+
- source_labels: [ __meta_kubernetes_pod_name, __meta_kubernetes_pod_container_port_name ]
26+
action: keep
27+
regex: .+banyandb.+;observability
28+
- source_labels: [ ]
29+
target_label: host_name
30+
replacement: banyandb.{{ .Release.Namespace }}
31+
- source_labels: [ __meta_kubernetes_pod_name ]
32+
target_label: service_instance_id
33+
regex: (.+)
34+
replacement: $$1
35+
{{- end }}
36+
{{- end }}

deploy/platform/kubernetes/templates/otel-collector-config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
"opentelemetry-config-pulsar-monitor"
3333
"opentelemetry-config-activemq-monitor"
3434
"opentelemetry-config-flink-monitor"
35+
"opentelemetry-config-banyandb-monitor"
3536
}}
3637
---
3738
apiVersion: v1

deploy/platform/kubernetes/values.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ skywalking:
4040
# @feature: istiod-monitor; enable rules to analyze Istio control plane metrics
4141
# @feature: mysql; enable mysql rules to analyze MySQL metrics
4242
# @feature: apisix-monitor; enable APISIX rules to analyze APISIX metrics
43-
SW_OTEL_RECEIVER_ENABLED_OTEL_METRICS_RULES: vm,oap,k8s/*,istio-controlplane,mysql/*,postgresql/*,apisix,elasticsearch/*,rabbitmq/*,mongodb/*,nginx/*,rocketmq/*,pulsar/*,activemq/*,flink/*
43+
SW_OTEL_RECEIVER_ENABLED_OTEL_METRICS_RULES: vm,oap,k8s/*,istio-controlplane,mysql/*,postgresql/*,apisix,elasticsearch/*,rabbitmq/*,mongodb/*,nginx/*,rocketmq/*,pulsar/*,activemq/*,flink/*,banyandb/*
4444
SW_TELEMETRY: prometheus # @feature: so11y; expose the metrics of self o11y through prometheus
4545
SW_ENVOY_METRIC_ALS_HTTP_ANALYSIS: "mx-mesh,persistence" # @feature: als; enable mesh analyzer (mx-mesh) to analyze ALS logs
4646
K8S_SERVICE_NAME_RULE: "mesh-svr::${service.metadata.name}.${service.metadata.namespace}"
@@ -626,3 +626,6 @@ features:
626626

627627
flinkMonitor:
628628
enabled: false
629+
630+
banyandbMonitor:
631+
enabled: false

docs/readme.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,8 @@ Currently, the features supported are:
117117
| `activemq-monitor` | Deploy OpenTelemetry and export [ActiveMQ classic](https://activemq.apache.org/components/classic/) monitoring metrics to SkyWalking for analysis and display on UI. | |
118118
| `cilium` | Deploy Cilium and showcase services in a separate namespace, SkyWalking fetch Cilium Services Traffic to analysis and display on UI. | Only support deployment in the Kubernetes environment, docker is not supported. |
119119
| `baseline` | Deploy [SkyPredictor](https://github.com/SkyAPM/SkyPredictor) as baseline calculator to predict metrics. | Only support deployment in the Kubernetes environment, docker is not supported. |
120-
| `flink-monitor` | Deploy OpenTelemetry and export Flink monitoring metrics to SkyWalking for analysis and display on UI.
121-
120+
| `flink-monitor` | Deploy OpenTelemetry and export Flink monitoring metrics to SkyWalking for analysis and display on UI.
121+
| `banyandb-monitor` | Deploy OpenTelemetry and export BanyanDB monitoring metrics to SkyWalking for analysis and display on UI. | |
122122
### Kubernetes
123123

124124
To deploy the example application in Kubernetes, please make sure that you have `kubectl` command available, and it can

0 commit comments

Comments
 (0)