This is an automated email from the ASF dual-hosted git repository.

wusheng pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/skywalking.git


The following commit(s) were added to refs/heads/master by this push:
     new 8a82ac885d Support MongoDB monitoring (#11111)
8a82ac885d is described below

commit 8a82ac885d29e0fa4df9c3923edd0dc5830cad2c
Author: weixiang1862 <[email protected]>
AuthorDate: Fri Jul 21 11:18:56 2023 +0800

    Support MongoDB monitoring (#11111)
    
    Co-authored-by: weixiang1862 <[email protected]>
    Co-authored-by: 吴晟 Wu Sheng <[email protected]>
    Co-authored-by: kezhenxu94 <[email protected]>
    Co-authored-by: Harry <[email protected]>
---
 .github/workflows/skywalking.yaml                  |   2 +
 docs/en/changes/changes.md                         |   1 +
 .../en/setup/backend/backend-mongodb-monitoring.md |  79 +++
 docs/menu.yml                                      |   2 +
 .../skywalking/oap/server/core/analysis/Layer.java |   7 +-
 .../ui/template/UITemplateInitializer.java         |   1 +
 .../src/main/resources/application.yml             |   2 +-
 .../otel-rules/mongodb/mongodb-cluster.yaml        |  63 ++
 .../resources/otel-rules/mongodb/mongodb-node.yaml | 108 +++
 .../resources/ui-initialized-templates/menu.yaml   |   5 +
 .../mongodb/mongodb-cluster.json                   | 414 +++++++++++
 .../mongodb/mongodb-node.json                      | 781 +++++++++++++++++++++
 .../mongodb/mongodb-root.json                      |  62 ++
 test/e2e-v2/cases/mongodb/docker-compose.yml       | 100 +++
 test/e2e-v2/cases/mongodb/e2e.yaml                 |  37 +
 test/e2e-v2/cases/mongodb/expected/instance.yml    |  27 +
 .../mongodb/expected/metrics-has-value-label.yml   |  25 +
 .../cases/mongodb/expected/metrics-has-value.yml   |  21 +
 test/e2e-v2/cases/mongodb/expected/service.yml     |  24 +
 test/e2e-v2/cases/mongodb/mongodb-cases.yaml       | 119 ++++
 .../cases/mongodb/otel-collector-config.yaml       |  64 ++
 test/e2e-v2/cases/mongodb/setup.sh                 |  46 ++
 22 files changed, 1988 insertions(+), 2 deletions(-)

diff --git a/.github/workflows/skywalking.yaml 
b/.github/workflows/skywalking.yaml
index 0dc3a975ec..4813372aee 100644
--- a/.github/workflows/skywalking.yaml
+++ b/.github/workflows/skywalking.yaml
@@ -629,6 +629,8 @@ jobs:
             config: test/e2e-v2/cases/redis/redis-exporter/e2e.yaml
           - name: Elasticsearch
             config: test/e2e-v2/cases/elasticsearch/e2e.yaml
+          - name: MongoDB
+            config: test/e2e-v2/cases/mongodb/e2e.yaml
           - name: RabbitMQ
             config: test/e2e-v2/cases/rabbitmq/e2e.yaml
           - name: MQE Service
diff --git a/docs/en/changes/changes.md b/docs/en/changes/changes.md
index ae4dfb6933..35e6f66cc0 100644
--- a/docs/en/changes/changes.md
+++ b/docs/en/changes/changes.md
@@ -50,6 +50,7 @@
 * Apply MQE on Virtual-Cache layer UI-templates
 * Add Echo component ID(5015) language: Golang.
 * Fix `index out of bounds exception` in `aggregate_labels` MQE function.
+* Support MongoDB Server/Cluster monitoring powered by OTEL.
 * Do not print configurations values in logs to avoid sensitive info leaked.
 * Move created the latest index before retrieval indexes by aliases to avoid 
the 404 exception. This just prevents some interference from manual operations.
 * Add more Go VM metrics, as new skywalking-go agent provided since its 0.2 
release.
diff --git a/docs/en/setup/backend/backend-mongodb-monitoring.md 
b/docs/en/setup/backend/backend-mongodb-monitoring.md
new file mode 100644
index 0000000000..d1e1845f53
--- /dev/null
+++ b/docs/en/setup/backend/backend-mongodb-monitoring.md
@@ -0,0 +1,79 @@
+# MongoDB monitoring
+
+SkyWalking leverages mongodb-exporter for collecting metrics data from 
MongoDB. It leverages OpenTelemetry
+Collector to transfer the metrics to
+[OpenTelemetry receiver](opentelemetry-receiver.md) and into the [Meter 
System](./../../concepts-and-designs/meter.md).
+
+## Data flow
+
+1. The `mongodb-exporter` collects metrics data from MongoDB. The exporter 
works side by side with the MongoDB node.
+2. OpenTelemetry Collector fetches metrics from mongodb-exporter via 
Prometheus Receiver and pushes metrics to
+   SkyWalking OAP Server via OpenTelemetry gRPC exporter.
+3. The SkyWalking OAP Server parses the expression with 
[MAL](../../concepts-and-designs/mal.md) to
+   filter/calculate/aggregate and store the results.
+
+## Setup
+
+1. Setup [mongodb-exporter](https://github.com/percona/mongodb_exporter).
+2. Set up [OpenTelemetry 
Collector](https://opentelemetry.io/docs/collector/getting-started/#docker). 
The example for OpenTelemetry Collector configuration, refer
+   to [here](../../../../test/e2e-v2/cases/mongodb/otel-collector-config.yaml).
+3. Config SkyWalking [OpenTelemetry receiver](opentelemetry-receiver.md).
+
+## MongoDB Monitoring
+
+MongoDB monitoring provides multidimensional metrics monitoring of MongoDB 
clusters as `Layer: MONGODB` `Service` in the OAP. In each cluster, the nodes 
are represented as `Instance`.
+
+### MongoDB Cluster Supported Metrics
+
+| Monitoring Panel                  | Unit | Metric Name                       
        | Description                                                         | 
Data Source      |
+|-----------------------------------|------|-------------------------------------------|---------------------------------------------------------------------|------------------|
+| Uptime (day)                      | day  | meter_mongodb_cluster_uptime      
        | Maximum uptime of nodes in the cluster                              | 
mongodb-exporter |
+| Data Size (GB)                    | GB   | meter_mongodb_cluster_data_size   
        | Total data size of the cluster                                      | 
mongodb-exporter |
+| Collection Count                  |      | 
meter_mongodb_cluster_collection_count    | Number of collection of the cluster 
                                | mongodb-exporter |
+| Object Count                      |      | 
meter_mongodb_cluster_object_count        | Number of object of the cluster     
                                | mongodb-exporter |
+| Document Avg QPS                  |      | 
meter_mongodb_cluster_document_avg_qps    | Avg document operations rate of 
nodes                               | mongodb-exporter |
+| Operation Avg QPS                 |      | 
meter_mongodb_cluster_operation_avg_qps   | Avg operations rate of nodes        
                                | mongodb-exporter |
+| Total Connections                 |      | meter_mongodb_cluster_connections 
        | Cluster total connections of nodes                                  | 
mongodb-exporter |
+| Cursor Avg                        |      | meter_mongodb_cluster_cursor_avg  
        | Avg Opened cursor of nodes                                          | 
mongodb-exporter |
+| Replication Lag (ms)              | ms   | meter_mongodb_cluster_repl_lag    
        | Repl set member avg replication lag, this metric works in repl mode | 
mongodb-exporter |
+| DB Avg Data Size Per Shard (GB)   | GB   | 
meter_mongodb_cluster_db_data_size        | Avg data size per shard (replSet) 
of every database                 | mongodb-exporter |
+| DB Avg Index Size Per Shard (GB)  | GB   | 
meter_mongodb_cluster_db_index_size       | Avg index size per shard (replSet) 
of every database                | mongodb-exporter |
+| DB Avg Collection Count Per Shard |      | 
meter_mongodb_cluster_db_collection_count | Avg collection count per shard 
(replSet) of every database          | mongodb-exporter |
+| DB Avg Index Count Per Shard      |      | 
meter_mongodb_cluster_db_index_count      | Avg index count per shard (replSet) 
of every database               | mongodb-exporter |
+
+### MongoDB Node Supported Metrics
+
+| Monitoring Panel             | Unit | Metric Name                            
                                                                               
| Description                                                | Data Source      
|
+|------------------------------|------|-----------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------|------------------|
+| Uptime (day)                 | day  | meter_mongodb_node_uptime              
                                                                               
| Uptime of the node                                         | mongodb-exporter 
|
+| QPS                          |      | meter_mongodb_node_qps                 
                                                                               
| Operations per second of the node                          | mongodb-exporter 
| 
+| Latency                      | µs   | meter_mongodb_node_latency             
                                                                               
| Latency of operations                                      | mongodb-exporter 
|
+| Memory Usage                 | %    | meter_mongodb_node_memory_usage        
                                                                               
| Memory usage percent of RAM                                | mongodb-exporter 
|
+| Version                      |      | meter_mongodb_node_version             
                                                                               
| MongoDB edition and version                                | mongodb-exporter 
|
+| ReplSet State                |      | meter_mongodb_node_rs_state            
                                                                               
| Repl set state of the node, this metric works in repl mode | mongodb-exporter 
|
+| CPU Usage (%)                | %    | 
meter_mongodb_node_cpu_total_percentage                                         
                                      | Cpu usage percent of the node           
                   | mongodb-exporter |
+| Network (KB/s)               | KB/s | 
meter_mongodb_node_network_bytes_in<br/>meter_mongodb_node_network_bytes_out    
                                      | Inbound and outbound network bytes of 
node                 | mongodb-exporter |
+| Memory Free (GB)             | GB   | 
meter_mongodb_node_memory_free_kb<br/>meter_mongodb_node_swap_memory_free_kb    
                                      | Free memory of RAM and swap             
                   | mongodb-exporter |
+| Disk (GB)                    | GB   | 
meter_mongodb_node_fs_used_size<br/>meter_mongodb_node_fs_total_size            
                                      | Used and total size of disk             
                   | mongodb-exporter |
+| Connections                  |      | meter_mongodb_node_connections         
                                                                               
| Connection nums of node                                    | mongodb-exporter 
|
+| Active Client                |      | 
meter_mongodb_node_active_total_num<br/>meter_mongodb_node_active_reader_num<br/>meter_mongodb_node_active_writer_num
 | Count of active reader and writer                          | 
mongodb-exporter |
+| Transactions                 |      | 
meter_mongodb_node_transactions_active<br/>meter_mongodb_node_transactions_inactive
                                   | Count of transactions running on the node  
                | mongodb-exporter |
+| Document QPS                 |      | meter_mongodb_node_document_qps        
                                                                               
| Document operations per second                             | mongodb-exporter 
|
+| Operation QPS                |      | meter_mongodb_node_operation_qps       
                                                                               
| Operations per second                                      | mongodb-exporter 
|
+| Repl Operation QPS           |      | meter_mongodb_node_repl_operation_qps  
                                                                               
| Repl operations per second                                 | mongodb-exporter 
|
+| Operation Latency (µs)       | µs   | meter_mongodb_node_operation_latency   
                                                                               
| Latencies for different operation type                     | mongodb-exporter 
|
+| Cursor                       |      | meter_mongodb_node_cursor              
                                                                               
| Opened cursor of the node                                  | mongodb-exporter 
|
+| Server Status Memory (MB)    | MB   | 
meter_mongodb_node_mem_virtual<br/>meter_mongodb_node_mem_resident              
                                      | Virtual and resident memory of the node 
                   | mongodb-exporter |
+| Asserts                      |      | meter_mongodb_node_asserts             
                                                                               
| The rate of raised assertions                              | mongodb-exporter 
|
+| Repl Buffer Count            |      | meter_mongodb_node_repl_buffer_count   
                                                                               
| The current number of operations in the oplog buffer       | mongodb-exporter 
|
+| Repl Buffer Size (MB)        | MB   | 
meter_mongodb_node_repl_buffer_size<br/>meter_mongodb_node_repl_buffer_size_max 
                                      | The maximum size of the oplog buffer    
                   | mongodb-exporter |
+| Queued Operation             |      | meter_mongodb_node_queued_operation    
                                                                               
| The number of operations queued because of a lock          | mongodb-exporter 
|
+| getLastError Write Num       |      | 
meter_mongodb_node_write_wait_num<br/>meter_mongodb_node_write_wait_timeout_num 
                                      | The number of write concern operation   
                   | mongodb-exporter |
+| getLastError Write Time (ms) | ms   | meter_mongodb_node_write_wait_time     
                                                                               
| The wait time of write concern operation                   | mongodb-exporter 
|
+
+## Customizations
+
+You can customize your own metrics/expression/dashboard panel.
+The metrics definition and expression rules are found
+in `/config/otel-rules/mongodb/mongodb-cluster.yaml, 
/config/otel-rules/mongodb/mongodb-node.yaml`.
+The MongoDB dashboard panel configurations are found in 
`/config/ui-initialized-templates/mongodb`.
diff --git a/docs/menu.yml b/docs/menu.yml
index 6f170f83af..b74905ecdf 100644
--- a/docs/menu.yml
+++ b/docs/menu.yml
@@ -241,6 +241,8 @@ catalog:
                 path: "/en/setup/backend/backend-redis-monitoring"
               - name: "Elasticsearch"
                 path: "/en/setup/backend/backend-elasticsearch-monitoring"
+              - name: "MongoDB"
+                path: "/en/setup/backend/backend-mongodb-monitoring"
           - name: "MQ Monitoring"
             catalog:
               - name: "RabbitMQ"
diff --git 
a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/Layer.java
 
b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/Layer.java
index d6fd2b128d..c41125279f 100644
--- 
a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/Layer.java
+++ 
b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/Layer.java
@@ -183,7 +183,12 @@ public enum Layer {
      * RabbitMQ is one of the most popular open source message brokers. 
RabbitMQ is lightweight and easy to deploy
      * on premises and in the cloud. It supports multiple messaging protocols.
      */
-    RABBITMQ(29, true);
+    RABBITMQ(29, true),
+
+    /**
+     * MongoDB is a document database. It stores data in a type of JSON format 
called BSON.
+     */
+    MONGODB(30, true);
 
     private final int value;
     /**
diff --git 
a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/management/ui/template/UITemplateInitializer.java
 
b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/management/ui/template/UITemplateInitializer.java
index 7519255541..45b165613c 100644
--- 
a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/management/ui/template/UITemplateInitializer.java
+++ 
b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/management/ui/template/UITemplateInitializer.java
@@ -68,6 +68,7 @@ public class UITemplateInitializer {
         Layer.REDIS.name(),
         Layer.ELASTICSEARCH.name(),
         Layer.RABBITMQ.name(),
+        Layer.MONGODB.name(),
         "custom"
     };
     private final UITemplateManagementService uiTemplateManagementService;
diff --git a/oap-server/server-starter/src/main/resources/application.yml 
b/oap-server/server-starter/src/main/resources/application.yml
index be7c466cba..d09e779498 100644
--- a/oap-server/server-starter/src/main/resources/application.yml
+++ b/oap-server/server-starter/src/main/resources/application.yml
@@ -341,7 +341,7 @@ receiver-otel:
   selector: ${SW_OTEL_RECEIVER:default}
   default:
     enabledHandlers: 
${SW_OTEL_RECEIVER_ENABLED_HANDLERS:"otlp-metrics,otlp-logs"}
-    enabledOtelMetricsRules: 
${SW_OTEL_RECEIVER_ENABLED_OTEL_METRICS_RULES:"apisix,k8s/*,istio-controlplane,vm,mysql/*,postgresql/*,oap,aws-eks/*,windows,aws-s3/*,aws-dynamodb/*,aws-gateway/*,redis/*,elasticsearch/*,rabbitmq/*"}
+    enabledOtelMetricsRules: 
${SW_OTEL_RECEIVER_ENABLED_OTEL_METRICS_RULES:"apisix,k8s/*,istio-controlplane,vm,mysql/*,postgresql/*,oap,aws-eks/*,windows,aws-s3/*,aws-dynamodb/*,aws-gateway/*,redis/*,elasticsearch/*,rabbitmq/*,mongodb/*"}
 
 receiver-zipkin:
   selector: ${SW_RECEIVER_ZIPKIN:-}
diff --git 
a/oap-server/server-starter/src/main/resources/otel-rules/mongodb/mongodb-cluster.yaml
 
b/oap-server/server-starter/src/main/resources/otel-rules/mongodb/mongodb-cluster.yaml
new file mode 100644
index 0000000000..365eba0261
--- /dev/null
+++ 
b/oap-server/server-starter/src/main/resources/otel-rules/mongodb/mongodb-cluster.yaml
@@ -0,0 +1,63 @@
+# 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.
+
+# This will parse a textual representation of a duration. The formats
+# accepted are based on the ISO-8601 duration format {@code PnDTnHnMn.nS}
+# with days considered to be exactly 24 hours.
+# <p>
+# Examples:
+# <pre>
+#    "PT20.345S" -- parses as "20.345 seconds"
+#    "PT15M"     -- parses as "15 minutes" (where a minute is 60 seconds)
+#    "PT10H"     -- parses as "10 hours" (where an hour is 3600 seconds)
+#    "P2D"       -- parses as "2 days" (where a day is 24 hours or 86400 
seconds)
+#    "P2DT3H4M"  -- parses as "2 days, 3 hours and 4 minutes"
+#    "P-6H3M"    -- parses as "-6 hours and +3 minutes"
+#    "-P6H3M"    -- parses as "-6 hours and -3 minutes"
+#    "-P-6H+3M"  -- parses as "+6 hours and -3 minutes"
+# </pre>
+filter: "{ tags -> tags.job_name == 'mongodb-monitoring' }" # The 
OpenTelemetry job name
+expSuffix: tag({tags -> tags.cluster = 'mongodb::' + 
tags.cluster}).service(['cluster'], Layer.MONGODB)
+metricPrefix: meter_mongodb_cluster
+metricsRules:
+  - name: uptime
+    exp: mongodb_ss_uptime.max(['cluster','service_instance_id'])
+  - name: data_size
+    exp: 
mongodb_dbstats_dataSize.tagNotEqual('cl_role','mongos').tagNotEqual('database','local').sum(['cluster',
 'rs_nm'])
+  - name: collection_count
+    exp: 
mongodb_dbstats_collections.tagNotEqual('cl_role','mongos').tagNotEqual('database','local').sum(['cluster',
 'rs_nm'])
+  - name: object_count
+    exp: 
mongodb_dbstats_objects.tagNotEqual('cl_role','mongos').tagNotEqual('database','local').sum(['cluster',
 'rs_nm'])
+
+  - name: document_avg_qps
+    exp: 
mongodb_ss_metrics_document.max(['cluster','doc_op_type']).rate('PT1M')
+  - name: operation_avg_qps
+    exp: mongodb_ss_opcounters.max(['cluster','legacy_op_type']).rate('PT1M')
+
+  - name: connections
+    exp: 
mongodb_ss_connections.tagEqual('conn_type','current').max(['cluster','service_instance_id'])
+  - name: cursor_avg
+    exp: mongodb_ss_metrics_cursor_open.max(['cluster',"csr_type"])
+  - name: repl_lag
+    exp: mongodb_mongod_replset_member_replication_lag.tag({tags -> tags.rs_nm 
= tags.set}).avg(['cluster','rs_nm'])
+
+  - name: db_data_size
+    exp: 
mongodb_dbstats_dataSize.tagNotEqual('cl_role','mongos').tagNotEqual('database','local').sum(['cluster',
 'database'])
+  - name: db_index_size
+    exp: 
mongodb_dbstats_indexSize.tagNotEqual('cl_role','mongos').tagNotEqual('database','local').sum(['cluster',
 'database'])
+  - name: db_collection_count
+    exp: 
mongodb_dbstats_collections.tagNotEqual('cl_role','mongos').tagNotEqual('database','local').sum(['cluster',
 'database'])
+  - name: db_index_count
+    exp: 
mongodb_dbstats_indexes.tagNotEqual('cl_role','mongos').tagNotEqual('database','local').sum(['cluster'
 , 'database'])
\ No newline at end of file
diff --git 
a/oap-server/server-starter/src/main/resources/otel-rules/mongodb/mongodb-node.yaml
 
b/oap-server/server-starter/src/main/resources/otel-rules/mongodb/mongodb-node.yaml
new file mode 100644
index 0000000000..781d54114c
--- /dev/null
+++ 
b/oap-server/server-starter/src/main/resources/otel-rules/mongodb/mongodb-node.yaml
@@ -0,0 +1,108 @@
+# 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.
+
+# This will parse a textual representation of a duration. The formats
+# accepted are based on the ISO-8601 duration format {@code PnDTnHnMn.nS}
+# with days considered to be exactly 24 hours.
+# <p>
+# Examples:
+# <pre>
+#    "PT20.345S" -- parses as "20.345 seconds"
+#    "PT15M"     -- parses as "15 minutes" (where a minute is 60 seconds)
+#    "PT10H"     -- parses as "10 hours" (where an hour is 3600 seconds)
+#    "P2D"       -- parses as "2 days" (where a day is 24 hours or 86400 
seconds)
+#    "P2DT3H4M"  -- parses as "2 days, 3 hours and 4 minutes"
+#    "P-6H3M"    -- parses as "-6 hours and +3 minutes"
+#    "-P6H3M"    -- parses as "-6 hours and -3 minutes"
+#    "-P-6H+3M"  -- parses as "+6 hours and -3 minutes"
+# </pre>
+filter: "{ tags -> tags.job_name == 'mongodb-monitoring' }" # The 
OpenTelemetry job name
+expSuffix: tag({tags -> tags.cluster = 'mongodb::' + 
tags.cluster}).service(['cluster'] , Layer.MONGODB).instance(['cluster'], 
['service_instance_id'], Layer.MONGODB)
+metricPrefix: meter_mongodb_node
+metricsRules:
+  - name: uptime
+    exp: mongodb_ss_uptime
+  - name: qps
+    exp: 
mongodb_ss_opcounters.sum(['cluster','service_instance_id']).rate('PT1M')
+  - name: latency
+    exp: 
mongodb_ss_opLatencies_latency.sum(['cluster','service_instance_id']).rate('PT1M')
 / 
mongodb_ss_opLatencies_ops.sum(['cluster','service_instance_id']).rate('PT1M')
+  - name: memory_usage
+    exp: (mongodb_sys_memory_MemTotal_kb - mongodb_sys_memory_MemAvailable_kb) 
/ mongodb_sys_memory_MemTotal_kb * 100
+  - name: version
+    exp: 
mongodb_version_info.max(['cluster','service_instance_id','edition',"mongodb"])
+  - name: rs_state
+    exp: 
mongodb_members_self.max(['cluster','service_instance_id','member_state'])
+
+  - name: cpu_total_percentage
+    exp: ((mongodb_sys_cpu_user_ms + mongodb_sys_cpu_iowait_ms + 
mongodb_sys_cpu_system_ms + mongodb_sys_cpu_irq_ms + mongodb_sys_cpu_softirq_ms 
+ mongodb_sys_cpu_nice_ms + mongodb_sys_cpu_steal_ms) / 10).rate('PT1M')
+  - name: network_bytes_in
+    exp: mongodb_ss_network_bytesIn.irate()
+  - name: network_bytes_out
+    exp: mongodb_ss_network_bytesOut.irate()
+  - name: memory_free_kb
+    exp: mongodb_sys_memory_MemFree_kb
+  - name: swap_memory_free_kb
+    exp: mongodb_sys_memory_SwapFree_kb
+  - name: fs_used_size
+    exp: mongodb_dbstats_fsUsedSize.max(['cluster','service_instance_id'])
+  - name: fs_total_size
+    exp: mongodb_dbstats_fsTotalSize.max(['cluster','service_instance_id'])
+
+  - name: connections
+    exp: 
mongodb_ss_connections.tagEqual('conn_type','current').max(['cluster','service_instance_id'])
+  - name: active_total_num
+    exp: mongodb_ss_globalLock_activeClients_total
+  - name: active_reader_num
+    exp: mongodb_ss_globalLock_activeClients_readers
+  - name: active_writer_num
+    exp: mongodb_ss_globalLock_activeClients_writers
+  - name: transactions_active
+    exp: mongodb_ss_transactions_currentActive
+  - name: transactions_inactive
+    exp: mongodb_ss_transactions_currentInactive
+
+  - name: document_qps
+    exp: 
mongodb_ss_metrics_document.sum(['cluster','service_instance_id','doc_op_type']).rate('PT1M')
+  - name: operation_qps
+    exp: 
mongodb_ss_opcounters.sum(['cluster','service_instance_id','legacy_op_type']).rate('PT1M')
+  - name: repl_operation_qps
+    exp: 
mongodb_ss_opcountersRepl.sum(['cluster','service_instance_id','legacy_op_type']).rate('PT1M')
+
+  - name: operation_latency
+    exp: 
mongodb_ss_opLatencies_latency.max(['cluster','service_instance_id',"op_type"]).rate('PT1M')
 / 
mongodb_ss_opLatencies_ops.max(['cluster','service_instance_id',"op_type"]).rate('PT1M')
+  - name: cursor
+    exp: 
mongodb_ss_metrics_cursor_open.max(['cluster','service_instance_id',"csr_type"])
+  - name: mem_virtual
+    exp: mongodb_ss_mem_virtual
+  - name: mem_resident
+    exp: mongodb_ss_mem_resident
+  - name: asserts
+    exp: 
mongodb_ss_asserts.max(['cluster','service_instance_id',"assert_type"]).increase('PT1M')
+
+  - name: repl_buffer_count
+    exp: mongodb_ss_metrics_repl_buffer_count
+  - name: repl_buffer_size
+    exp: mongodb_ss_metrics_repl_buffer_sizeBytes
+  - name: repl_buffer_size_max
+    exp: mongodb_ss_metrics_repl_buffer_maxSizeBytes
+  - name: queued_operation
+    exp: 
mongodb_ss_globalLock_currentQueue.max(['cluster','service_instance_id',"count_type"])
+
+  - name: write_wait_num
+    exp: mongodb_ss_metrics_getLastError_wtime_num.rate('PT1M')
+  - name: write_wait_timeout_num
+    exp: mongodb_ss_metrics_getLastError_wtimeouts.rate('PT1M')
+  - name: write_wait_time
+    exp: mongodb_ss_metrics_getLastError_wtime_totalMillis.rate('PT1M')
\ No newline at end of file
diff --git 
a/oap-server/server-starter/src/main/resources/ui-initialized-templates/menu.yaml
 
b/oap-server/server-starter/src/main/resources/ui-initialized-templates/menu.yaml
index 6a47975ef3..c0244c3ccd 100644
--- 
a/oap-server/server-starter/src/main/resources/ui-initialized-templates/menu.yaml
+++ 
b/oap-server/server-starter/src/main/resources/ui-initialized-templates/menu.yaml
@@ -183,6 +183,11 @@ menus:
         description: Provide Elasticsearch Server monitoring through 
OpenTelemetry's Prometheus Receiver.
         documentLink: 
https://skywalking.apache.org/docs/main/next/en/setup/backend/backend-elasticsearch-monitoring/
         i18nKey: database_elasticsearch
+      - title: MongoDB
+        layer: MONGODB
+        description: Provide MongoDB monitoring through OpenTelemetry's 
Prometheus Receiver.
+        documentLink: 
https://skywalking.apache.org/docs/main/next/en/setup/backend/backend-mongodb-monitoring/
+        i18nKey: database_mongodb
   - title: Message Queue
     icon: mq
     description: A message queue is a form of asynchronous service-to-service 
communication used in serverless and microservices architectures.
diff --git 
a/oap-server/server-starter/src/main/resources/ui-initialized-templates/mongodb/mongodb-cluster.json
 
b/oap-server/server-starter/src/main/resources/ui-initialized-templates/mongodb/mongodb-cluster.json
new file mode 100644
index 0000000000..0a8948898e
--- /dev/null
+++ 
b/oap-server/server-starter/src/main/resources/ui-initialized-templates/mongodb/mongodb-cluster.json
@@ -0,0 +1,414 @@
+/**
+ * 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.
+ */
+[
+  {
+    "id":"MongoDB-Cluster",
+    "configuration":{
+      "children":[
+        {
+          "x":0,
+          "y":0,
+          "w":24,
+          "h":47,
+          "i":"0",
+          "type":"Tab",
+          "children":[
+            {
+              "name":"Overview",
+              "children":[
+                {
+                  "x":0,
+                  "y":0,
+                  "w":6,
+                  "h":7,
+                  "i":"0",
+                  "type":"Widget",
+                  "metricMode":"Expression",
+                  "expressions":[
+                    
"aggregate_labels(meter_mongodb_cluster_uptime,max)/3600/24"
+                  ],
+                  "typesOfMQE":[
+                    "SINGLE_VALUE"
+                  ],
+                  "graph":{
+                    "type":"Card",
+                    "fontSize":30,
+                    "textAlign":"center",
+                    "showUnit":true
+                  },
+                  "metricConfig":[
+                    {
+                      "unit":"day"
+                    }
+                  ],                  
+                  "widget":{
+                    "title":"Uptime"
+                  }
+                },
+                {
+                  "x":6,
+                  "y":0,
+                  "w":6,
+                  "h":7,
+                  "i":"1",
+                  "type":"Widget",
+                  "metricMode":"Expression",
+                  "expressions":[
+                    
"aggregate_labels(meter_mongodb_cluster_data_size,sum)/1024/1024/1024"
+                  ],
+                  "typesOfMQE":[
+                    "SINGLE_VALUE"
+                  ],
+                  "graph":{
+                    "type":"Card",
+                    "fontSize":30,
+                    "textAlign":"center",
+                    "showUnit":true
+                  },
+                  "metricConfig":[
+                    {
+                      "unit":"GB"
+                    }
+                  ],                  
+                  "widget":{
+                    "title":"Data Size"
+                  }
+                },
+                {
+                  "x":12,
+                  "y":0,
+                  "w":6,
+                  "h":7,
+                  "i":"2",
+                  "type":"Widget",
+                  "metricMode":"Expression",
+                  "expressions":[
+                    
"aggregate_labels(meter_mongodb_cluster_collection_count,sum)"
+                  ],
+                  "typesOfMQE":[
+                    "SINGLE_VALUE"
+                  ],
+                  "graph":{
+                    "type":"Card",
+                    "fontSize":30,
+                    "textAlign":"center",
+                    "showUnit":true
+                  },
+                  "widget":{
+                    "title":"Collection Count"
+                  }
+                },
+                {
+                  "x":18,
+                  "y":0,
+                  "w":6,
+                  "h":7,
+                  "i":"3",
+                  "type":"Widget",
+                  "metricMode":"Expression",
+                  "expressions":[
+                    "aggregate_labels(meter_mongodb_cluster_object_count,sum)"
+                  ],
+                  "typesOfMQE":[
+                    "SINGLE_VALUE"
+                  ],
+                  "graph":{
+                    "type":"Card",
+                    "fontSize":30,
+                    "textAlign":"center",
+                    "showUnit":true
+                  },
+                  "widget":{
+                    "title":"Object Count"
+                  }
+                },
+                {
+                  "x":0,
+                  "y":7,
+                  "w":12,
+                  "h":12,
+                  "i":"4",
+                  "type":"Widget",
+                  "metricMode":"Expression",
+                  "expressions":[
+                    "meter_mongodb_cluster_document_avg_qps"
+                  ],
+                  "typesOfMQE":[
+                    "TIME_SERIES_VALUES"
+                  ],
+                  "graph":{
+                    "type":"Line",
+                    "step":false,
+                    "smooth":false,
+                    "showSymbol":true,
+                    "showXAxis":true,
+                    "showYAxis":true
+                  },
+                  "widget":{
+                    "title":"Document Avg QPS"
+                  }
+                },
+                {
+                  "x":12,
+                  "y":7,
+                  "w":12,
+                  "h":12,
+                  "i":"5",
+                  "type":"Widget",
+                  "metricMode":"Expression",
+                  "expressions":[
+                    "meter_mongodb_cluster_operation_avg_qps"
+                  ],
+                  "graph":{
+                    "type":"Line",
+                    "step":false,
+                    "smooth":false,
+                    "showSymbol":true,
+                    "showXAxis":true,
+                    "showYAxis":true
+                  },
+                  "widget":{
+                    "title":"Operation Avg QPS"
+                  },
+                  "typesOfMQE":[
+                    "TIME_SERIES_VALUES"
+                  ]
+                },
+                {
+                  "x":0,
+                  "y":19,
+                  "w":8,
+                  "h":12,
+                  "i":"6",
+                  "type":"Widget",
+                  "metricMode":"Expression",
+                  "expressions":[
+                    "aggregate_labels(meter_mongodb_cluster_connections,sum)"
+                  ],
+                  "typesOfMQE":[
+                    "TIME_SERIES_VALUES"
+                  ],
+                  "graph":{
+                    "type":"Line",
+                    "step":false,
+                    "smooth":false,
+                    "showSymbol":true,
+                    "showXAxis":true,
+                    "showYAxis":true
+                  },
+                  "widget":{
+                    "title":"Total Connections"
+                  }
+                },
+                {
+                  "x":8,
+                  "y":19,
+                  "w":8,
+                  "h":12,
+                  "i":"7",
+                  "type":"Widget",
+                  "metricMode":"Expression",
+                  "expressions":[
+                    "meter_mongodb_cluster_cursor_avg"
+                  ],
+                  "typesOfMQE":[
+                    "TIME_SERIES_VALUES"
+                  ],
+                  "graph":{
+                    "type":"Line",
+                    "step":false,
+                    "smooth":false,
+                    "showSymbol":true,
+                    "showXAxis":true,
+                    "showYAxis":true
+                  },
+                  "widget":{
+                    "title":"Cursor Avg"
+                  }
+                },
+                {
+                  "x":16,
+                  "y":19,
+                  "w":8,
+                  "h":12,
+                  "i":"8",
+                  "type":"Widget",
+                  "metricMode":"Expression",
+                  "graph":{
+                    "type":"Line",
+                    "step":false,
+                    "smooth":false,
+                    "showSymbol":true,
+                    "showXAxis":true,
+                    "showYAxis":true
+                  },
+                  "widget":{
+                    "title":"Replication Lag (ms)"
+                  },
+                  "expressions":[
+                    "meter_mongodb_cluster_repl_lag"
+                  ],
+                  "typesOfMQE":[
+                    "TIME_SERIES_VALUES"
+                  ]
+                },
+                {
+                  "x":0,
+                  "y":31,
+                  "w":6,
+                  "h":11,
+                  "i":"9",
+                  "type":"Widget",
+                  "metricMode":"Expression",
+                  "widget":{
+                    "title":"DB Avg Data Size Per Shard (GB)"
+                  },
+                  "graph":{
+                    "type":"Table",
+                    "showTableValues":true,
+                    "tableHeaderCol1":"",
+                    "tableHeaderCol2":""
+                  },
+                  "metricTypes":[
+                    "readLabeledMetricsValues"
+                  ],
+                  "expressions":[
+                    "meter_mongodb_cluster_db_data_size/1024/1024/1024"
+                  ],
+                  "typesOfMQE":[
+                    "TIME_SERIES_VALUES"
+                  ]
+                },
+                {
+                  "x":6,
+                  "y":31,
+                  "w":6,
+                  "h":11,
+                  "i":"10",
+                  "type":"Widget",
+                  "metricMode":"Expression",
+                  "widget":{
+                    "title":"DB Avg Index Size Per Shard (GB)"
+                  },
+                  "graph":{
+                    "type":"Table",
+                    "showTableValues":true,
+                    "tableHeaderCol1":"",
+                    "tableHeaderCol2":""
+                  },
+                  "metricTypes":[
+                    "readLabeledMetricsValues"
+                  ],
+                  "expressions":[
+                    "meter_mongodb_cluster_db_index_size/1024/1024/1024"
+                  ],
+                  "typesOfMQE":[
+                    "TIME_SERIES_VALUES"
+                  ]
+                },
+                {
+                  "x":12,
+                  "y":31,
+                  "w":6,
+                  "h":11,
+                  "i":"11",
+                  "type":"Widget",
+                  "metricMode":"Expression",
+                  "widget":{
+                    "title":"DB Avg Collection Count Per Shard"
+                  },
+                  "graph":{
+                    "type":"Table",
+                    "showTableValues":true,
+                    "tableHeaderCol1":"",
+                    "tableHeaderCol2":""
+                  },
+                  "metricTypes":[
+                    "readLabeledMetricsValues"
+                  ],
+                  "expressions":[
+                    "meter_mongodb_cluster_db_collection_count"
+                  ],
+                  "typesOfMQE":[
+                    "TIME_SERIES_VALUES"
+                  ]
+                },
+                {
+                  "x":18,
+                  "y":31,
+                  "w":6,
+                  "h":11,
+                  "i":"12",
+                  "type":"Widget",
+                  "metricMode":"Expression",
+                  "widget":{
+                    "title":"DB Avg Index Count Per Shard"
+                  },
+                  "graph":{
+                    "type":"Table",
+                    "showTableValues":true,
+                    "tableHeaderCol1":"",
+                    "tableHeaderCol2":""
+                  },
+                  "metricTypes":[
+                    "readLabeledMetricsValues"
+                  ],
+                  "expressions":[
+                    "meter_mongodb_cluster_db_index_count"
+                  ],
+                  "typesOfMQE":[
+                    "TIME_SERIES_VALUES"
+                  ]
+                }
+              ]
+            },
+            {
+              "name":"Node",
+              "children":[
+                {
+                  "x":0,
+                  "y":0,
+                  "w":24,
+                  "h":28,
+                  "i":"0",
+                  "type":"Widget",
+                  "metricMode":"Expression",
+                  "expressions":[
+                    ""
+                  ],
+                  "typesOfMQE":[
+                    ""
+                  ],
+                  "graph":{
+                    "type":"InstanceList",
+                    "dashboardName":"MongoDB-Node",
+                    "fontSize":12
+                  }
+                }
+              ]
+            }
+          ]
+        }
+      ],
+      "layer":"MONGODB",
+      "entity":"Service",
+      "name":"MongoDB-Cluster",
+      "id":"MongoDB-Cluster",
+      "isRoot":false
+    }
+  }
+]
\ No newline at end of file
diff --git 
a/oap-server/server-starter/src/main/resources/ui-initialized-templates/mongodb/mongodb-node.json
 
b/oap-server/server-starter/src/main/resources/ui-initialized-templates/mongodb/mongodb-node.json
new file mode 100644
index 0000000000..7c6cca4671
--- /dev/null
+++ 
b/oap-server/server-starter/src/main/resources/ui-initialized-templates/mongodb/mongodb-node.json
@@ -0,0 +1,781 @@
+/**
+ * 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.
+ */
+[
+  {
+    "id":"MongoDB-Node",
+    "configuration":{
+      "children":[
+        {
+          "x":0,
+          "y":0,
+          "w":4,
+          "h":7,
+          "i":"0",
+          "type":"Widget",
+          "graph":{
+            "type":"Card",
+            "fontSize":30,
+            "textAlign":"center",
+            "showUnit":true
+          },
+          "metricConfig":[
+            {
+              "unit":"day"
+            }
+          ],          
+          "widget":{
+            "title":"Uptime"
+          },
+          "metricMode":"Expression",
+          "expressions":[
+            "meter_mongodb_node_uptime/3600/24"
+          ],
+          "typesOfMQE":[
+            "SINGLE_VALUE"
+          ]
+        },
+        {
+          "x":4,
+          "y":0,
+          "w":4,
+          "h":7,
+          "i":"1",
+          "type":"Widget",
+          "graph":{
+            "type":"Card",
+            "fontSize":30,
+            "textAlign":"center",
+            "showUnit":true
+          },
+          "widget":{
+            "title":"QPS"
+          },
+          "expressions":[
+            "meter_mongodb_node_qps"
+          ],
+          "typesOfMQE":[
+            "SINGLE_VALUE"
+          ],
+          "metricMode":"Expression"
+        },
+        {
+          "x":8,
+          "y":0,
+          "w":4,
+          "h":7,
+          "i":"2",
+          "type":"Widget",
+          "graph":{
+            "type":"Card",
+            "fontSize":30,
+            "textAlign":"center",
+            "showUnit":true
+          },
+          "widget":{
+            "title":"Latency"
+          },
+          "expressions":[
+            "meter_mongodb_node_latency"
+          ],
+          "typesOfMQE":[
+            "SINGLE_VALUE"
+          ],
+          "metricMode":"Expression",
+          "metricConfig":[
+            {
+              "unit":"µs"
+            }
+          ]
+        },
+        {
+          "x":12,
+          "y":0,
+          "w":4,
+          "h":7,
+          "i":"3",
+          "type":"Widget",
+          "metricMode":"Expression",
+          "metricConfig":[
+            {
+              "unit":"%"
+            }
+          ],
+          "graph":{
+            "type":"Card",
+            "fontSize":30,
+            "textAlign":"center",
+            "showUnit":true
+          },
+          "widget":{
+            "title":"Memory Usage"
+          },
+          "expressions":[
+            "meter_mongodb_node_memory_usage"
+          ],
+          "typesOfMQE":[
+            "SINGLE_VALUE"
+          ]
+        },
+        {
+          "x":16,
+          "y":0,
+          "w":4,
+          "h":7,
+          "i":"4",
+          "type":"Widget",
+          "metricMode":"Expression",
+          "graph":{
+            "type":"Table",
+            "showTableValues":false,
+            "tableHeaderCol1":"Version",
+            "tableHeaderCol2":""
+          },
+          "widget":{
+            "title":"Version"
+          },
+          "metricTypes":[
+            "readLabeledMetricsValues"
+          ],
+          "expressions":[
+            "meter_mongodb_node_version"
+          ],
+          "typesOfMQE":[
+            "TIME_SERIES_VALUES"
+          ]
+        },
+        {
+          "x":20,
+          "y":0,
+          "w":4,
+          "h":7,
+          "i":"5",
+          "type":"Widget",
+          "metricMode":"Expression",
+          "graph":{
+            "type":"Table",
+            "showTableValues":false,
+            "tableHeaderCol1":"ReplSet State",
+            "tableHeaderCol2":""
+          },
+          "widget":{
+            "title":"ReplSet State"
+          },
+          "expressions":[
+            "meter_mongodb_node_rs_state"
+          ],
+          "metricTypes":[
+            "readLabeledMetricsValues"
+          ],
+          "typesOfMQE":[
+            "TIME_SERIES_VALUES"
+          ]
+        },
+        {
+          "x":0,
+          "y":7,
+          "w":6,
+          "h":12,
+          "i":"6",
+          "type":"Widget",
+          "metricMode":"Expression",
+          "expressions":[
+            "meter_mongodb_node_cpu_total_percentage"
+          ],
+          "graph":{
+            "type":"Line",
+            "step":false,
+            "smooth":false,
+            "showSymbol":true,
+            "showXAxis":true,
+            "showYAxis":true
+          },
+          "typesOfMQE":[
+            "TIME_SERIES_VALUES"
+          ],
+          "widget":{
+            "title":"CPU Usage (%)"
+          }
+        },
+        {
+          "x":6,
+          "y":7,
+          "w":6,
+          "h":12,
+          "i":"7",
+          "type":"Widget",
+          "metricMode":"Expression",
+          "metricConfig":[
+            {
+              "label":"in"
+            },
+            {
+              "label":"out"
+            }
+          ],
+          "graph":{
+            "type":"Line",
+            "step":false,
+            "smooth":false,
+            "showSymbol":true,
+            "showXAxis":true,
+            "showYAxis":true
+          },
+          "widget":{
+            "title":"Network (KB/s)"
+          },
+          "expressions":[
+            "meter_mongodb_node_network_bytes_in/1024",
+            "meter_mongodb_node_network_bytes_out/1024"
+          ],
+          "typesOfMQE":[
+            "TIME_SERIES_VALUES",
+            "TIME_SERIES_VALUES"
+          ]
+        },
+        {
+          "x":12,
+          "y":7,
+          "w":6,
+          "h":12,
+          "i":"8",
+          "type":"Widget",
+          "metricMode":"Expression",
+          "metricConfig":[
+            {
+              "label":"Mem"
+            },
+            {
+              "label":"Swap"
+            }
+          ],
+          "graph":{
+            "type":"Bar",
+            "showBackground":true
+          },
+          "widget":{
+            "title":"Memory Free (GB)"
+          },
+          "expressions":[
+            "meter_mongodb_node_memory_free_kb/1024/1024",
+            "meter_mongodb_node_swap_memory_free_kb/1024/1024"
+          ],
+          "typesOfMQE":[
+            "TIME_SERIES_VALUES",
+            "TIME_SERIES_VALUES"
+          ]
+        },
+        {
+          "x":18,
+          "y":7,
+          "w":6,
+          "h":12,
+          "i":"9",
+          "type":"Widget",
+          "metricMode":"Expression",
+          "expressions":[
+            "meter_mongodb_node_fs_used_size/1024/1024/1024",
+            "meter_mongodb_node_fs_total_size/1024/1024/1024"
+          ],
+          "typesOfMQE":[
+            "TIME_SERIES_VALUES",
+            "TIME_SERIES_VALUES"
+          ],
+          "graph":{
+            "type":"Area",
+            "opacity":0.4,
+            "showXAxis":true,
+            "showYAxis":true
+          },
+          "metricConfig":[
+            {
+              "label":"used"
+            },
+            {
+              "label":"total"
+            }
+          ],
+          "widget":{
+            "title":"Disk (GB)"
+          }
+        },
+        {
+          "x":0,
+          "y":19,
+          "w":8,
+          "h":12,
+          "i":"10",
+          "type":"Widget",
+          "graph":{
+            "type":"Line",
+            "step":false,
+            "smooth":false,
+            "showSymbol":true,
+            "showXAxis":true,
+            "showYAxis":true,
+            "legend":{
+              "show":false,
+              "asTable":false
+            }
+          },
+          "widget":{
+            "title":"Connections"
+          },
+          "expressions":[
+            "meter_mongodb_node_connections"
+          ],
+          "typesOfMQE":[
+            "TIME_SERIES_VALUES"
+          ],
+          "metricMode":"Expression"
+        },
+        {
+          "x":8,
+          "y":19,
+          "w":8,
+          "h":12,
+          "i":"11",
+          "type":"Widget",
+          "metricMode":"Expression",
+          "metricConfig":[
+            {
+              "label":"total"
+            },
+            {
+              "label":"writer"
+            },
+            {
+              "label":"reader"
+            }
+          ],
+          "graph":{
+            "type":"Line",
+            "step":false,
+            "smooth":false,
+            "showSymbol":true,
+            "showXAxis":true,
+            "showYAxis":true
+          },
+          "widget":{
+            "title":"Active Client"
+          },
+          "expressions":[
+            "meter_mongodb_node_active_total_num",
+            "meter_mongodb_node_active_writer_num",
+            "meter_mongodb_node_active_reader_num"
+          ],
+          "typesOfMQE":[
+            "TIME_SERIES_VALUES",
+            "TIME_SERIES_VALUES",
+            "TIME_SERIES_VALUES"
+          ]
+        },
+        {
+          "x":16,
+          "y":19,
+          "w":8,
+          "h":12,
+          "i":"12",
+          "type":"Widget",
+          "metricMode":"Expression",
+          "expressions":[
+            "meter_mongodb_node_transactions_active",
+            "meter_mongodb_node_transactions_inactive"
+          ],
+          "metricConfig":[
+            {
+              "label":"active"
+            },
+            {
+              "label":"inactive"
+            }
+          ],
+          "graph":{
+            "type":"Line",
+            "step":false,
+            "smooth":false,
+            "showSymbol":true,
+            "showXAxis":true,
+            "showYAxis":true
+          },
+          "widget":{
+            "title":"Transactions"
+          },
+          "typesOfMQE":[
+            "TIME_SERIES_VALUES",
+            "TIME_SERIES_VALUES"
+          ]
+        },
+        {
+          "x":0,
+          "y":31,
+          "w":8,
+          "h":12,
+          "i":"13",
+          "type":"Widget",
+          "graph":{
+            "type":"Line",
+            "step":false,
+            "smooth":false,
+            "showSymbol":true,
+            "showXAxis":true,
+            "showYAxis":true
+          },
+          "widget":{
+            "title":"Document QPS"
+          },
+          "expressions":[
+            "meter_mongodb_node_document_qps"
+          ],
+          "typesOfMQE":[
+            "TIME_SERIES_VALUES"
+          ],
+          "metricMode":"Expression"
+        },
+        {
+          "x":8,
+          "y":31,
+          "w":8,
+          "h":12,
+          "i":"14",
+          "type":"Widget",
+          "graph":{
+            "type":"Line",
+            "step":false,
+            "smooth":false,
+            "showSymbol":true,
+            "showXAxis":true,
+            "showYAxis":true,
+            "legend":{
+              "asTable":false
+            }
+          },
+          "widget":{
+            "title":"Operation QPS"
+          },
+          "associate":[
+
+          ],
+          "expressions":[
+            "meter_mongodb_node_operation_qps"
+          ],
+          "typesOfMQE":[
+            "TIME_SERIES_VALUES"
+          ],
+          "metricMode":"Expression"
+        },
+        {
+          "x":16,
+          "y":31,
+          "w":8,
+          "h":12,
+          "i":"15",
+          "type":"Widget",
+          "metricMode":"Expression",
+          "expressions":[
+            "meter_mongodb_node_repl_operation_qps"
+          ],
+          "typesOfMQE":[
+            "TIME_SERIES_VALUES"
+          ],
+          "graph":{
+            "type":"Line",
+            "step":false,
+            "smooth":false,
+            "showSymbol":true,
+            "showXAxis":true,
+            "showYAxis":true
+          },
+          "widget":{
+            "title":"Repl Operation QPS"
+          }
+        },
+        {
+          "x":0,
+          "y":43,
+          "w":6,
+          "h":12,
+          "i":"16",
+          "type":"Widget",
+          "graph":{
+            "type":"Line",
+            "step":false,
+            "smooth":false,
+            "showSymbol":true,
+            "showXAxis":true,
+            "showYAxis":true,
+            "legend":{
+              "asTable":false
+            }
+          },
+          "widget":{
+            "title":"Operation Latency (µs)"
+          },
+          "expressions":[
+            "meter_mongodb_node_operation_latency"
+          ],
+          "typesOfMQE":[
+            "TIME_SERIES_VALUES"
+          ],
+          "metricMode":"Expression"
+        },
+        {
+          "x":6,
+          "y":43,
+          "w":6,
+          "h":12,
+          "i":"17",
+          "type":"Widget",
+          "graph":{
+            "type":"Line",
+            "step":false,
+            "smooth":false,
+            "showSymbol":true,
+            "showXAxis":true,
+            "showYAxis":true,
+            "legend":{
+              "show":true,
+              "asTable":false
+            }
+          },
+          "widget":{
+            "title":"Cursor"
+          },
+          "expressions":[
+            "meter_mongodb_node_cursor"
+          ],
+          "typesOfMQE":[
+            "TIME_SERIES_VALUES"
+          ],
+          "metricMode":"Expression"
+        },
+        {
+          "x":12,
+          "y":43,
+          "w":6,
+          "h":12,
+          "i":"18",
+          "type":"Widget",
+          "metricMode":"Expression",
+          "expressions":[
+            "meter_mongodb_node_mem_virtual",
+            "meter_mongodb_node_mem_resident"
+          ],
+          "typesOfMQE":[
+            "TIME_SERIES_VALUES",
+            "TIME_SERIES_VALUES"
+          ],
+          "graph":{
+            "type":"Line",
+            "step":false,
+            "smooth":false,
+            "showSymbol":true,
+            "showXAxis":true,
+            "showYAxis":true
+          },
+          "widget":{
+            "title":"Server Status Memory (MB)"
+          },
+          "metricConfig":[
+            {
+              "label":"virtual"
+            },
+            {
+              "label":"resident"
+            }
+          ]
+        },
+        {
+          "x":18,
+          "y":43,
+          "w":6,
+          "h":12,
+          "i":"19",
+          "type":"Widget",
+          "metricMode":"Expression",
+          "graph":{
+            "type":"Line",
+            "step":false,
+            "smooth":false,
+            "showSymbol":true,
+            "showXAxis":true,
+            "showYAxis":true
+          },
+          "widget":{
+            "title":"Asserts"
+          },
+          "expressions":[
+            "meter_mongodb_node_asserts"
+          ],
+          "typesOfMQE":[
+            "TIME_SERIES_VALUES"
+          ]
+        },
+        {
+          "x":0,
+          "y":55,
+          "w":8,
+          "h":12,
+          "i":"20",
+          "type":"Widget",
+          "metricMode":"Expression",
+          "expressions":[
+            "meter_mongodb_node_repl_buffer_count"
+          ],
+          "graph":{
+            "type":"Line",
+            "step":false,
+            "smooth":false,
+            "showSymbol":true,
+            "showXAxis":true,
+            "showYAxis":true
+          },
+          "widget":{
+            "title":"Repl Buffer Count"
+          },
+          "typesOfMQE":[
+            "TIME_SERIES_VALUES"
+          ]
+        },
+        {
+          "x":8,
+          "y":55,
+          "w":8,
+          "h":12,
+          "i":"21",
+          "type":"Widget",
+          "metricMode":"Expression",
+          "graph":{
+            "type":"Area",
+            "opacity":0.4,
+            "showXAxis":true,
+            "showYAxis":true
+          },
+          "widget":{
+            "title":"Repl Buffer Size (MB)"
+          },
+          "expressions":[
+            "meter_mongodb_node_repl_buffer_size/1024/1024",
+            "meter_mongodb_node_repl_buffer_size_max/1024/1024"
+          ],
+          "typesOfMQE":[
+            "TIME_SERIES_VALUES",
+            "TIME_SERIES_VALUES"
+          ],
+          "metricConfig":[
+            {
+              "label":"current"
+            },
+            {
+              "label":"max"
+            }
+          ]
+        },
+        {
+          "x":16,
+          "y":55,
+          "w":8,
+          "h":12,
+          "i":"22",
+          "type":"Widget",
+          "graph":{
+            "type":"Line",
+            "step":false,
+            "smooth":false,
+            "showSymbol":true,
+            "showXAxis":true,
+            "showYAxis":true
+          },
+          "widget":{
+            "title":"Queued Operation"
+          },
+          "expressions":[
+            "meter_mongodb_node_queued_operation"
+          ],
+          "typesOfMQE":[
+            "TIME_SERIES_VALUES"
+          ],
+          "metricMode":"Expression"
+        },
+        {
+          "x":0,
+          "y":67,
+          "w":12,
+          "h":12,
+          "i":"23",
+          "type":"Widget",
+          "metricMode":"Expression",
+          "expressions":[
+            "meter_mongodb_node_write_wait_num",
+            "meter_mongodb_node_write_wait_timeout_num"
+          ],
+          "typesOfMQE":[
+            "TIME_SERIES_VALUES",
+            "TIME_SERIES_VALUES"
+          ],
+          "graph":{
+            "type":"Area",
+            "opacity":0.4,
+            "showXAxis":true,
+            "showYAxis":true
+          },
+          "widget":{
+            "title":"getLastError Write Num"
+          },
+          "metricConfig":[
+            {
+              "label":"total"
+            },
+            {
+              "label":"timeout"
+            }
+          ]
+        },
+        {
+          "x":12,
+          "y":67,
+          "w":12,
+          "h":12,
+          "i":"24",
+          "type":"Widget",
+          "metricMode":"Expression",
+          "graph":{
+            "type":"Line",
+            "step":false,
+            "smooth":false,
+            "showSymbol":true,
+            "showXAxis":true,
+            "showYAxis":true
+          },
+          "expressions":[
+            "meter_mongodb_node_write_wait_time"
+          ],
+          "typesOfMQE":[
+            "TIME_SERIES_VALUES"
+          ],
+          "widget":{
+            "title":"getLastError Write Time (ms)"
+          }
+        }
+      ],
+      "layer":"MONGODB",
+      "entity":"ServiceInstance",
+      "name":"MongoDB-Node",
+      "id":"MongoDB-Node",
+      "isRoot":false
+    }
+  }
+]
\ No newline at end of file
diff --git 
a/oap-server/server-starter/src/main/resources/ui-initialized-templates/mongodb/mongodb-root.json
 
b/oap-server/server-starter/src/main/resources/ui-initialized-templates/mongodb/mongodb-root.json
new file mode 100644
index 0000000000..0dd6daf092
--- /dev/null
+++ 
b/oap-server/server-starter/src/main/resources/ui-initialized-templates/mongodb/mongodb-root.json
@@ -0,0 +1,62 @@
+/**
+ * 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.
+ */
+[
+  {
+    "id":"MongoDB-Root",
+    "configuration":{
+      "children":[
+        {
+          "x":0,
+          "y":0,
+          "w":24,
+          "h":2,
+          "i":"0",
+          "type":"Text",
+          "graph":{
+            "fontColor":"blue",
+            "backgroundColor":"white",
+            "content":"Provide MongoDB monitoring through OpenTelemetry's 
Prometheus Receiver",
+            "fontSize":14,
+            "textAlign":"left",
+            
"url":"https://skywalking.apache.org/docs/main/next/en/setup/backend/backend-mongodb-monitoring/";
+          }
+        },
+        {
+          "x":0,
+          "y":2,
+          "w":24,
+          "h":33,
+          "i":"1",
+          "type":"Widget",
+          "graph":{
+            "type":"ServiceList",
+            "dashboardName":"MongoDB-Cluster",
+            "fontSize":12,
+            "showXAxis":false,
+            "showYAxis":false,
+            "showGroup":true
+          }
+        }
+      ],
+      "id":"MongoDB-Root",
+      "layer":"MONGODB",
+      "entity":"All",
+      "name":"MongoDB-Root",
+      "isRoot":true
+    }
+  }
+]
\ No newline at end of file
diff --git a/test/e2e-v2/cases/mongodb/docker-compose.yml 
b/test/e2e-v2/cases/mongodb/docker-compose.yml
new file mode 100644
index 0000000000..7a8b4ae974
--- /dev/null
+++ b/test/e2e-v2/cases/mongodb/docker-compose.yml
@@ -0,0 +1,100 @@
+# 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: '2.1'
+
+services:
+  oap:
+    extends:
+      file: ../../script/docker-compose/base-compose.yml
+      service: oap
+    ports:
+      - "12800:12800"
+    networks:
+      - e2e
+  mongodb-1: &mongodb
+    image: mongo:6.0.8
+    networks:
+      - e2e
+    command: mongod --replSet rs1 --shardsvr --port 27017
+    healthcheck:
+      test: [ "CMD", "bash", "-c", "cat < /dev/null > 
/dev/tcp/127.0.0.1/27017" ]
+      interval: 10s
+      timeout: 10s
+      retries: 120
+  mongodb-2: *mongodb
+  mongodb-repl-setup:
+    image: mongo:6.0.8
+    networks:
+      - e2e
+    depends_on:
+      mongodb-1:
+        condition: service_healthy
+      mongodb-2:
+        condition: service_healthy
+    volumes:
+      - ./setup.sh:/setup.sh
+    entrypoint: [ "bash", "/setup.sh" ]
+  mongodb-exporter-1:
+    image: percona/mongodb_exporter:0.39
+    expose:
+      - 9216
+    networks:
+      - e2e
+    depends_on:
+      mongodb-1:
+        condition: service_healthy
+    command:
+      - '--mongodb.uri=mongodb://mongodb-1:27017'
+      - '--discovering-mode'
+      - '--compatible-mode'
+      - '--collector.dbstats'
+      - '--collector.diagnosticdata'
+      - '--collector.replicasetstatus'
+  mongodb-exporter-2:
+    image: percona/mongodb_exporter:0.39
+    expose:
+      - 9216
+    networks:
+      - e2e
+    depends_on:
+      mongodb-2:
+        condition: service_healthy
+    command:
+      - '--mongodb.uri=mongodb://mongodb-2:27017'
+      - '--discovering-mode'
+      - '--compatible-mode'
+      - '--collector.dbstats'
+      - '--collector.diagnosticdata'
+      - '--collector.replicasetstatus'
+  otel-collector:
+    image: otel/opentelemetry-collector:0.72.0
+    networks:
+      - e2e
+    command: [ "--config=/etc/otel-collector-config.yaml" ]
+    volumes:
+      - ./otel-collector-config.yaml:/etc/otel-collector-config.yaml
+    expose:
+      - 55678
+    depends_on:
+      oap:
+        condition: service_healthy
+      mongodb-exporter-1:
+        condition: service_started
+      mongodb-exporter-2:
+        condition: service_started
+
+networks:
+  e2e:
\ No newline at end of file
diff --git a/test/e2e-v2/cases/mongodb/e2e.yaml 
b/test/e2e-v2/cases/mongodb/e2e.yaml
new file mode 100644
index 0000000000..5424c82315
--- /dev/null
+++ b/test/e2e-v2/cases/mongodb/e2e.yaml
@@ -0,0 +1,37 @@
+# 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.
+
+# This file is used to show how to write configuration files and can be used 
to test.
+
+setup:
+  env: compose
+  file: docker-compose.yml
+  timeout: 20m
+  init-system-environment: ../../script/env
+  steps:
+    - name: set PATH
+      command: export PATH=/tmp/skywalking-infra-e2e/bin:$PATH
+    - name: install yq
+      command: bash test/e2e-v2/script/prepare/setup-e2e-shell/install.sh yq
+    - name: install swctl
+      command: bash test/e2e-v2/script/prepare/setup-e2e-shell/install.sh swctl
+
+verify:
+  retry:
+    count: 60
+    interval: 3s
+  cases:
+    - includes:
+        - ./mongodb-cases.yaml
diff --git a/test/e2e-v2/cases/mongodb/expected/instance.yml 
b/test/e2e-v2/cases/mongodb/expected/instance.yml
new file mode 100644
index 0000000000..3e82313740
--- /dev/null
+++ b/test/e2e-v2/cases/mongodb/expected/instance.yml
@@ -0,0 +1,27 @@
+# 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.
+
+{{- contains . }}
+- id: {{ notEmpty .id }}
+  name: mongodb-exporter-1:9216
+  instanceuuid: {{ notEmpty .instanceuuid }}
+  attributes: []
+  language: UNKNOWN
+- id: {{ notEmpty .id }}
+  name: mongodb-exporter-2:9216
+  instanceuuid: {{ notEmpty .instanceuuid }}
+  attributes: []
+  language: UNKNOWN
+{{- end }}
diff --git a/test/e2e-v2/cases/mongodb/expected/metrics-has-value-label.yml 
b/test/e2e-v2/cases/mongodb/expected/metrics-has-value-label.yml
new file mode 100644
index 0000000000..0c957c3c77
--- /dev/null
+++ b/test/e2e-v2/cases/mongodb/expected/metrics-has-value-label.yml
@@ -0,0 +1,25 @@
+# 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.
+
+{{- contains . }}
+- key: {{ notEmpty .key }}
+  value:
+  {{- contains .value }}
+  - key: {{ notEmpty .key }}
+    value:
+      value: {{ ge .value.value 0 }}
+      isemptyvalue: false
+  {{- end }}
+{{- end }}
diff --git a/test/e2e-v2/cases/mongodb/expected/metrics-has-value.yml 
b/test/e2e-v2/cases/mongodb/expected/metrics-has-value.yml
new file mode 100644
index 0000000000..4411655352
--- /dev/null
+++ b/test/e2e-v2/cases/mongodb/expected/metrics-has-value.yml
@@ -0,0 +1,21 @@
+# 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.
+
+{{- contains . }}
+- key: {{ notEmpty .key }}
+  value:
+    value: {{ ge .value.value 0 }}
+    isemptyvalue: false
+{{- end }}
diff --git a/test/e2e-v2/cases/mongodb/expected/service.yml 
b/test/e2e-v2/cases/mongodb/expected/service.yml
new file mode 100644
index 0000000000..328499a74c
--- /dev/null
+++ b/test/e2e-v2/cases/mongodb/expected/service.yml
@@ -0,0 +1,24 @@
+# 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.
+
+{{- contains . }}
+- id: {{ b64enc "mongodb::replset" }}.1
+  name: mongodb::replset
+  group: mongodb
+  shortname: replset
+  layers:
+    - MONGODB
+  normal: true
+{{- end }}
\ No newline at end of file
diff --git a/test/e2e-v2/cases/mongodb/mongodb-cases.yaml 
b/test/e2e-v2/cases/mongodb/mongodb-cases.yaml
new file mode 100644
index 0000000000..7868154d2e
--- /dev/null
+++ b/test/e2e-v2/cases/mongodb/mongodb-cases.yaml
@@ -0,0 +1,119 @@
+# 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.
+
+# This file is used to show how to write configuration files and can be used 
to test.
+
+cases:
+  # service cases
+  - query: swctl --display yaml 
--base-url=http://${oap_host}:${oap_12800}/graphql service ls
+    expected: expected/service.yml
+  - query: swctl --display yaml 
--base-url=http://${oap_host}:${oap_12800}/graphql metrics multiple-linear 
--name=meter_mongodb_cluster_uptime --service-name=mongodb::replset | yq e 
'to_entries | with(.[] ; .value=(.value | to_entries))' -
+    expected: expected/metrics-has-value-label.yml
+  - query: swctl --display yaml 
--base-url=http://${oap_host}:${oap_12800}/graphql metrics multiple-linear 
--name=meter_mongodb_cluster_data_size --service-name=mongodb::replset | yq e 
'to_entries | with(.[] ; .value=(.value | to_entries))' -
+    expected: expected/metrics-has-value-label.yml
+  - query: swctl --display yaml 
--base-url=http://${oap_host}:${oap_12800}/graphql metrics multiple-linear 
--name=meter_mongodb_cluster_collection_count --service-name=mongodb::replset | 
yq e 'to_entries | with(.[] ; .value=(.value | to_entries))' -
+    expected: expected/metrics-has-value-label.yml
+  - query: swctl --display yaml 
--base-url=http://${oap_host}:${oap_12800}/graphql metrics multiple-linear 
--name=meter_mongodb_cluster_object_count --service-name=mongodb::replset | yq 
e 'to_entries | with(.[] ; .value=(.value | to_entries))' -
+    expected: expected/metrics-has-value-label.yml
+  - query: swctl --display yaml 
--base-url=http://${oap_host}:${oap_12800}/graphql metrics multiple-linear 
--name=meter_mongodb_cluster_document_avg_qps --service-name=mongodb::replset | 
yq e 'to_entries | with(.[] ; .value=(.value | to_entries))' -
+    expected: expected/metrics-has-value-label.yml
+  - query: swctl --display yaml 
--base-url=http://${oap_host}:${oap_12800}/graphql metrics multiple-linear 
--name=meter_mongodb_cluster_operation_avg_qps --service-name=mongodb::replset 
| yq e 'to_entries | with(.[] ; .value=(.value | to_entries))' -
+    expected: expected/metrics-has-value-label.yml
+  - query: swctl --display yaml 
--base-url=http://${oap_host}:${oap_12800}/graphql metrics multiple-linear 
--name=meter_mongodb_cluster_connections --service-name=mongodb::replset | yq e 
'to_entries | with(.[] ; .value=(.value | to_entries))' -
+    expected: expected/metrics-has-value-label.yml
+  - query: swctl --display yaml 
--base-url=http://${oap_host}:${oap_12800}/graphql metrics multiple-linear 
--name=meter_mongodb_cluster_cursor_avg --service-name=mongodb::replset | yq e 
'to_entries | with(.[] ; .value=(.value | to_entries))' -
+    expected: expected/metrics-has-value-label.yml
+  - query: swctl --display yaml 
--base-url=http://${oap_host}:${oap_12800}/graphql metrics multiple-linear 
--name=meter_mongodb_cluster_repl_lag --service-name=mongodb::replset | yq e 
'to_entries | with(.[] ; .value=(.value | to_entries))' -
+    expected: expected/metrics-has-value-label.yml
+  - query: swctl --display yaml 
--base-url=http://${oap_host}:${oap_12800}/graphql metrics multiple-linear 
--name=meter_mongodb_cluster_db_data_size --service-name=mongodb::replset | yq 
e 'to_entries | with(.[] ; .value=(.value | to_entries))' -
+    expected: expected/metrics-has-value-label.yml
+  - query: swctl --display yaml 
--base-url=http://${oap_host}:${oap_12800}/graphql metrics multiple-linear 
--name=meter_mongodb_cluster_db_index_size --service-name=mongodb::replset | yq 
e 'to_entries | with(.[] ; .value=(.value | to_entries))' -
+    expected: expected/metrics-has-value-label.yml
+  - query: swctl --display yaml 
--base-url=http://${oap_host}:${oap_12800}/graphql metrics multiple-linear 
--name=meter_mongodb_cluster_db_collection_count 
--service-name=mongodb::replset | yq e 'to_entries | with(.[] ; .value=(.value 
| to_entries))' -
+    expected: expected/metrics-has-value-label.yml
+  - query: swctl --display yaml 
--base-url=http://${oap_host}:${oap_12800}/graphql metrics multiple-linear 
--name=meter_mongodb_cluster_db_index_count --service-name=mongodb::replset | 
yq e 'to_entries | with(.[] ; .value=(.value | to_entries))' -
+    expected: expected/metrics-has-value-label.yml
+
+  # instance cases
+  - query: swctl --display yaml 
--base-url=http://${oap_host}:${oap_12800}/graphql instance ls 
--service-name=mongodb::replset
+    expected: expected/instance.yml
+  - query: swctl --display yaml 
--base-url=http://${oap_host}:${oap_12800}/graphql metrics linear 
--name=meter_mongodb_node_uptime --service-name=mongodb::replset 
--instance-name=mongodb-exporter-1:9216 | yq e 'to_entries' -
+    expected: expected/metrics-has-value.yml
+  - query: swctl --display yaml 
--base-url=http://${oap_host}:${oap_12800}/graphql metrics linear 
--name=meter_mongodb_node_qps --service-name=mongodb::replset 
--instance-name=mongodb-exporter-1:9216 | yq e 'to_entries' -
+    expected: expected/metrics-has-value.yml
+  - query: swctl --display yaml 
--base-url=http://${oap_host}:${oap_12800}/graphql metrics linear 
--name=meter_mongodb_node_latency --service-name=mongodb::replset 
--instance-name=mongodb-exporter-1:9216 | yq e 'to_entries' -
+    expected: expected/metrics-has-value.yml
+  - query: swctl --display yaml 
--base-url=http://${oap_host}:${oap_12800}/graphql metrics linear 
--name=meter_mongodb_node_memory_usage --service-name=mongodb::replset 
--instance-name=mongodb-exporter-1:9216 | yq e 'to_entries' -
+    expected: expected/metrics-has-value.yml
+  - query: swctl --display yaml 
--base-url=http://${oap_host}:${oap_12800}/graphql metrics multiple-linear 
--name=meter_mongodb_node_version --service-name=mongodb::replset 
--instance-name=mongodb-exporter-1:9216 | yq e 'to_entries | with(.[] ; 
.value=(.value | to_entries))' -
+    expected: expected/metrics-has-value-label.yml
+  - query: swctl --display yaml 
--base-url=http://${oap_host}:${oap_12800}/graphql metrics multiple-linear 
--name=meter_mongodb_node_rs_state --service-name=mongodb::replset 
--instance-name=mongodb-exporter-1:9216 | yq e 'to_entries | with(.[] ; 
.value=(.value | to_entries))' -
+    expected: expected/metrics-has-value-label.yml
+  - query: swctl --display yaml 
--base-url=http://${oap_host}:${oap_12800}/graphql metrics linear 
--name=meter_mongodb_node_cpu_total_percentage --service-name=mongodb::replset 
--instance-name=mongodb-exporter-1:9216 | yq e 'to_entries' -
+    expected: expected/metrics-has-value.yml
+  - query: swctl --display yaml 
--base-url=http://${oap_host}:${oap_12800}/graphql metrics linear 
--name=meter_mongodb_node_network_bytes_in --service-name=mongodb::replset 
--instance-name=mongodb-exporter-1:9216 | yq e 'to_entries' -
+    expected: expected/metrics-has-value.yml
+  - query: swctl --display yaml 
--base-url=http://${oap_host}:${oap_12800}/graphql metrics linear 
--name=meter_mongodb_node_network_bytes_out --service-name=mongodb::replset 
--instance-name=mongodb-exporter-1:9216 | yq e 'to_entries' -
+    expected: expected/metrics-has-value.yml
+  - query: swctl --display yaml 
--base-url=http://${oap_host}:${oap_12800}/graphql metrics linear 
--name=meter_mongodb_node_memory_free_kb --service-name=mongodb::replset 
--instance-name=mongodb-exporter-1:9216 | yq e 'to_entries' -
+    expected: expected/metrics-has-value.yml
+  - query: swctl --display yaml 
--base-url=http://${oap_host}:${oap_12800}/graphql metrics linear 
--name=meter_mongodb_node_swap_memory_free_kb --service-name=mongodb::replset 
--instance-name=mongodb-exporter-1:9216 | yq e 'to_entries' -
+    expected: expected/metrics-has-value.yml
+  - query: swctl --display yaml 
--base-url=http://${oap_host}:${oap_12800}/graphql metrics linear 
--name=meter_mongodb_node_fs_used_size --service-name=mongodb::replset 
--instance-name=mongodb-exporter-1:9216 | yq e 'to_entries' -
+    expected: expected/metrics-has-value.yml
+  - query: swctl --display yaml 
--base-url=http://${oap_host}:${oap_12800}/graphql metrics linear 
--name=meter_mongodb_node_fs_total_size --service-name=mongodb::replset 
--instance-name=mongodb-exporter-1:9216 | yq e 'to_entries' -
+    expected: expected/metrics-has-value.yml
+  - query: swctl --display yaml 
--base-url=http://${oap_host}:${oap_12800}/graphql metrics linear 
--name=meter_mongodb_node_connections --service-name=mongodb::replset 
--instance-name=mongodb-exporter-1:9216 | yq e 'to_entries' -
+    expected: expected/metrics-has-value.yml
+  - query: swctl --display yaml 
--base-url=http://${oap_host}:${oap_12800}/graphql metrics linear 
--name=meter_mongodb_node_active_total_num --service-name=mongodb::replset 
--instance-name=mongodb-exporter-1:9216 | yq e 'to_entries' -
+    expected: expected/metrics-has-value.yml
+  - query: swctl --display yaml 
--base-url=http://${oap_host}:${oap_12800}/graphql metrics linear 
--name=meter_mongodb_node_active_reader_num --service-name=mongodb::replset 
--instance-name=mongodb-exporter-1:9216 | yq e 'to_entries' -
+    expected: expected/metrics-has-value.yml
+  - query: swctl --display yaml 
--base-url=http://${oap_host}:${oap_12800}/graphql metrics linear 
--name=meter_mongodb_node_active_writer_num --service-name=mongodb::replset 
--instance-name=mongodb-exporter-1:9216 | yq e 'to_entries' -
+    expected: expected/metrics-has-value.yml
+  - query: swctl --display yaml 
--base-url=http://${oap_host}:${oap_12800}/graphql metrics linear 
--name=meter_mongodb_node_transactions_active --service-name=mongodb::replset 
--instance-name=mongodb-exporter-1:9216 | yq e 'to_entries' -
+    expected: expected/metrics-has-value.yml
+  - query: swctl --display yaml 
--base-url=http://${oap_host}:${oap_12800}/graphql metrics linear 
--name=meter_mongodb_node_transactions_inactive --service-name=mongodb::replset 
--instance-name=mongodb-exporter-1:9216 | yq e 'to_entries' -
+    expected: expected/metrics-has-value.yml
+  - query: swctl --display yaml 
--base-url=http://${oap_host}:${oap_12800}/graphql metrics multiple-linear 
--name=meter_mongodb_node_document_qps --service-name=mongodb::replset 
--instance-name=mongodb-exporter-1:9216 | yq e 'to_entries | with(.[] ; 
.value=(.value | to_entries))' -
+    expected: expected/metrics-has-value-label.yml
+  - query: swctl --display yaml 
--base-url=http://${oap_host}:${oap_12800}/graphql metrics multiple-linear 
--name=meter_mongodb_node_operation_qps --service-name=mongodb::replset 
--instance-name=mongodb-exporter-1:9216 | yq e 'to_entries | with(.[] ; 
.value=(.value | to_entries))' -
+    expected: expected/metrics-has-value-label.yml
+  - query: swctl --display yaml 
--base-url=http://${oap_host}:${oap_12800}/graphql metrics multiple-linear 
--name=meter_mongodb_node_repl_operation_qps --service-name=mongodb::replset 
--instance-name=mongodb-exporter-1:9216 | yq e 'to_entries | with(.[] ; 
.value=(.value | to_entries))' -
+    expected: expected/metrics-has-value-label.yml
+  - query: swctl --display yaml 
--base-url=http://${oap_host}:${oap_12800}/graphql metrics multiple-linear 
--name=meter_mongodb_node_operation_latency --service-name=mongodb::replset 
--instance-name=mongodb-exporter-1:9216 | yq e 'to_entries | with(.[] ; 
.value=(.value | to_entries))' -
+    expected: expected/metrics-has-value-label.yml
+  - query: swctl --display yaml 
--base-url=http://${oap_host}:${oap_12800}/graphql metrics multiple-linear 
--name=meter_mongodb_node_cursor --service-name=mongodb::replset 
--instance-name=mongodb-exporter-1:9216 | yq e 'to_entries | with(.[] ; 
.value=(.value | to_entries))' -
+    expected: expected/metrics-has-value-label.yml
+  - query: swctl --display yaml 
--base-url=http://${oap_host}:${oap_12800}/graphql metrics linear 
--name=meter_mongodb_node_mem_virtual --service-name=mongodb::replset 
--instance-name=mongodb-exporter-1:9216 | yq e 'to_entries' -
+    expected: expected/metrics-has-value.yml
+  - query: swctl --display yaml 
--base-url=http://${oap_host}:${oap_12800}/graphql metrics linear 
--name=meter_mongodb_node_mem_resident --service-name=mongodb::replset 
--instance-name=mongodb-exporter-1:9216 | yq e 'to_entries' -
+    expected: expected/metrics-has-value.yml
+  - query: swctl --display yaml 
--base-url=http://${oap_host}:${oap_12800}/graphql metrics multiple-linear 
--name=meter_mongodb_node_asserts --service-name=mongodb::replset 
--instance-name=mongodb-exporter-1:9216 | yq e 'to_entries | with(.[] ; 
.value=(.value | to_entries))' -
+    expected: expected/metrics-has-value-label.yml
+  - query: swctl --display yaml 
--base-url=http://${oap_host}:${oap_12800}/graphql metrics linear 
--name=meter_mongodb_node_repl_buffer_count --service-name=mongodb::replset 
--instance-name=mongodb-exporter-1:9216 | yq e 'to_entries' -
+    expected: expected/metrics-has-value.yml
+  - query: swctl --display yaml 
--base-url=http://${oap_host}:${oap_12800}/graphql metrics linear 
--name=meter_mongodb_node_repl_buffer_size --service-name=mongodb::replset 
--instance-name=mongodb-exporter-1:9216 | yq e 'to_entries' -
+    expected: expected/metrics-has-value.yml
+  - query: swctl --display yaml 
--base-url=http://${oap_host}:${oap_12800}/graphql metrics linear 
--name=meter_mongodb_node_repl_buffer_size_max --service-name=mongodb::replset 
--instance-name=mongodb-exporter-1:9216 | yq e 'to_entries' -
+    expected: expected/metrics-has-value.yml
+  - query: swctl --display yaml 
--base-url=http://${oap_host}:${oap_12800}/graphql metrics multiple-linear 
--name=meter_mongodb_node_queued_operation --service-name=mongodb::replset 
--instance-name=mongodb-exporter-1:9216 | yq e 'to_entries | with(.[] ; 
.value=(.value | to_entries))' -
+    expected: expected/metrics-has-value-label.yml
+  - query: swctl --display yaml 
--base-url=http://${oap_host}:${oap_12800}/graphql metrics linear 
--name=meter_mongodb_node_write_wait_num --service-name=mongodb::replset 
--instance-name=mongodb-exporter-1:9216 | yq e 'to_entries' -
+    expected: expected/metrics-has-value.yml
+  - query: swctl --display yaml 
--base-url=http://${oap_host}:${oap_12800}/graphql metrics linear 
--name=meter_mongodb_node_write_wait_timeout_num 
--service-name=mongodb::replset --instance-name=mongodb-exporter-1:9216 | yq e 
'to_entries' -
+    expected: expected/metrics-has-value.yml
+  - query: swctl --display yaml 
--base-url=http://${oap_host}:${oap_12800}/graphql metrics linear 
--name=meter_mongodb_node_write_wait_time --service-name=mongodb::replset 
--instance-name=mongodb-exporter-1:9216 | yq e 'to_entries' -
+    expected: expected/metrics-has-value.yml
\ No newline at end of file
diff --git a/test/e2e-v2/cases/mongodb/otel-collector-config.yaml 
b/test/e2e-v2/cases/mongodb/otel-collector-config.yaml
new file mode 100644
index 0000000000..ec7255f26d
--- /dev/null
+++ b/test/e2e-v2/cases/mongodb/otel-collector-config.yaml
@@ -0,0 +1,64 @@
+# 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: 'mongodb-monitoring'
+         metrics_path: "/metrics"
+         scrape_interval: 10s
+         static_configs:
+           - targets: ['mongodb-exporter-1:9216','mongodb-exporter-2:9216']
+             labels:
+               cluster: replset
+
+##################################################################################################################
+# If you want to define instance name rather than using name in target, please 
reference to the following case.  #
+##################################################################################################################
+
+#        - job_name: 'mongodb-monitoring'
+#          metrics_path: "/metrics"
+#          scrape_interval: 10s
+#          static_configs:
+#            - targets: ['mongodb-exporter-1:9216']
+#              labels:
+#                cluster: replset
+#                service_instance_id: mongodb-1:27017
+#            - targets: ['mongodb-exporter-2:9216']
+#              labels:
+#                cluster: replset
+#                service_instance_id: mongodb-2:27017
+
+processors:
+  batch:
+
+exporters:
+  
####################################################################################
+  # If you want to use otlp exporter please ensure that your OAP version is >= 
9.2.0 #
+  
####################################################################################
+  otlp:
+    endpoint: oap:11800
+    tls:
+      insecure: true
+service:
+  pipelines:
+    metrics:
+      receivers:
+      - prometheus
+      processors:
+      - batch
+      exporters:
+      - otlp
diff --git a/test/e2e-v2/cases/mongodb/setup.sh 
b/test/e2e-v2/cases/mongodb/setup.sh
new file mode 100644
index 0000000000..ba9a5d8182
--- /dev/null
+++ b/test/e2e-v2/cases/mongodb/setup.sh
@@ -0,0 +1,46 @@
+#!/bin/bash
+# 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.
+
+echo "Waiting for startup.."
+until mongosh --host mongodb-1:27017 --eval 'quit(db.runCommand({ ping: 1 
}).ok ? 0 : 2)' &>/dev/null; do
+  printf '.'
+  sleep 1
+done
+until mongosh --host mongodb-2:27017 --eval 'quit(db.runCommand({ ping: 1 
}).ok ? 0 : 2)' &>/dev/null; do
+  printf '.'
+  sleep 1
+done
+
+echo "Started.."
+
+mongosh --host mongodb-1:27017 <<EOF
+     var cfg = {
+      "_id": "rs1",
+      "protocolVersion": 1,
+      "members": [
+         {
+           "_id": 0,
+           "host": "mongodb-1:27017"
+         },
+         {
+           "_id": 1,
+           "host": "mongodb-2:27017"
+         }
+      ]
+     };
+     rs.initiate(cfg, { force: true });
+     rs.reconfig(cfg, { force: true });
+EOF
\ No newline at end of file


Reply via email to