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 eb071e49df Add hierarchy for RabbitMQ (#11935)
eb071e49df is described below

commit eb071e49df3c9e0cc8c997366746ae2199f32d8f
Author: peachisai <2581009...@qq.com>
AuthorDate: Tue Feb 27 12:18:36 2024 +0800

    Add hierarchy for RabbitMQ (#11935)
    
    Co-authored-by: 邵一鸣 <shaoy...@vanke.com>
    Co-authored-by: Wan Kai <wankai...@foxmail.com>
---
 docs/en/changes/changes.md                         |  3 +++
 docs/en/concepts-and-designs/service-hierarchy.md  | 20 +++++++++++++++-
 .../src/main/resources/hierarchy-definition.yml    |  5 ++++
 .../rabbitmq/rabbitmq-cluster.json                 | 27 +++++++++++++++++++++-
 4 files changed, 53 insertions(+), 2 deletions(-)

diff --git a/docs/en/changes/changes.md b/docs/en/changes/changes.md
index 1d4b77f512..b63cb7ef03 100644
--- a/docs/en/changes/changes.md
+++ b/docs/en/changes/changes.md
@@ -58,6 +58,9 @@
 * Add `maxInboundMessageSize (SW_DCS_MAX_INBOUND_MESSAGE_SIZE)` configuration 
to change the max inbound message size of DCS.
 * Fix Service Layer when building Events in the EventHookCallback.
 * Add Golang as a supported language for Pulsar.
+* Add Service Hierarchy auto matching layer relationships (upper -> lower) as 
following:
+  - RABBITMQ -> K8S_SERVICE
+  - VIRTUAL_MQ -> RABBITMQ
 
 #### UI
 
diff --git a/docs/en/concepts-and-designs/service-hierarchy.md 
b/docs/en/concepts-and-designs/service-hierarchy.md
index 126eed6c60..482985d6c4 100644
--- a/docs/en/concepts-and-designs/service-hierarchy.md
+++ b/docs/en/concepts-and-designs/service-hierarchy.md
@@ -26,7 +26,9 @@ If you want to customize it according to your own needs, 
please refer to [Servic
 | NGINX            | K8S_SERVICE | [NGINX On 
K8S_SERVICE](#nginx-on-k8s_service)                     |
 | APISIX           | K8S_SERVICE | [APISIX On 
K8S_SERVICE](#apisix-on-k8s_service)                   |
 | ROCKETMQ         | K8S_SERVICE | [ROCKETMQ On 
K8S_SERVICE](#rocketmq-on-k8s_service)               |
-| VIRTUAL_MQ       | ROCKETMQ    | [VIRTUAL_MQ On 
K8S_SERVICE](#virtual_mq-on-rocketmq)                     |
+| VIRTUAL_MQ       | ROCKETMQ    | [VIRTUAL_MQ On 
ROCKETMQ](#virtual_mq-on-rocketmq)              |
+| RABBITMQ         | K8S_SERVICE | [RABBITMQ On 
K8S_SERVICE](#rabbitmq-on-k8s_service)               |
+| VIRTUAL_MQ       | RABBITMQ    | [VIRTUAL_MQ On 
RABBITMQ](#virtual_mq-on-rabbitmq)              |
 
 - The following sections will describe the **default matching rules** in 
detail and use the `upper-layer On lower-layer` format. 
 - The example service name are based on SkyWalking 
[Showcase](https://github.com/apache/skywalking-showcase) default deployment.
@@ -144,6 +146,22 @@ If you want to customize it according to your own needs, 
please refer to [Servic
   - VIRTUAL_MQ.service.name: 
`rocketmq.skywalking-showcase.svc.cluster.local:9876`
   - ROCKETMQ.service.name: `rocketmq::rocketmq.skywalking-showcase`
 
+#### RABBITMQ On K8S_SERVICE
+- Rule name: `short-name`
+- Groovy script: `{ (u, l) -> u.shortName == l.shortName }`
+- Description: RABBITMQ.service.shortName == K8S_SERVICE.service.shortName
+- Matched Example:
+  - RABBITMQ.service.name: `rabbitmq::rabbitmq.skywalking-showcase`
+  - K8S_SERVICE.service.name: 
`skywalking-showcase::rabbitmq.skywalking-showcase`
+
+#### VIRTUAL_MQ On RABBITMQ
+- Rule name: `lower-short-name-with-fqdn`
+- Groovy script: `{ (u, l) -> u.shortName.substring(0, 
u.shortName.lastIndexOf(':')) == l.shortName.concat('.svc.cluster.local') }`
+- Description: VIRTUAL_MQ.service.shortName remove port == 
RABBITMQ.service.shortName with fqdn suffix
+- Matched Example:
+  - VIRTUAL_MQ.service.name: 
`rabbitmq.skywalking-showcase.svc.cluster.local:5672`
+  - RABBITMQ.service.name: `rabbitmq::rabbitmq.skywalking-showcase`
+
 ### Build Through Specific Agents
 Use agent tech involved(such as eBPF) and deployment tools(such as operator 
and agent injector) detect the service hierarchy relations.
 
diff --git 
a/oap-server/server-starter/src/main/resources/hierarchy-definition.yml 
b/oap-server/server-starter/src/main/resources/hierarchy-definition.yml
index f1d53cbb91..fa688a13f2 100644
--- a/oap-server/server-starter/src/main/resources/hierarchy-definition.yml
+++ b/oap-server/server-starter/src/main/resources/hierarchy-definition.yml
@@ -48,12 +48,16 @@ hierarchy:
   ROCKETMQ:
     K8S_SERVICE: short-name
 
+  RABBITMQ:
+    K8S_SERVICE: short-name
+
   VIRTUAL_DATABASE:
     MYSQL: lower-short-name-with-fqdn
     POSTGRESQL: lower-short-name-with-fqdn
 
   VIRTUAL_MQ:
     ROCKETMQ: lower-short-name-with-fqdn
+    RABBITMQ: lower-short-name-with-fqdn
 
 # Use Groovy script to define the matching rules, the input parameters are the 
upper service(u) and the lower service(l) and the return value is a boolean,
 # which are used to match the relation between the upper service(u) and the 
lower service(l) on the different layers.
@@ -83,6 +87,7 @@ layer-levels:
   APISIX: 2
   NGINX: 2
   ROCKETMQ: 2
+  RABBITMQ: 2
 
   MESH_DP: 1
 
diff --git 
a/oap-server/server-starter/src/main/resources/ui-initialized-templates/rabbitmq/rabbitmq-cluster.json
 
b/oap-server/server-starter/src/main/resources/ui-initialized-templates/rabbitmq/rabbitmq-cluster.json
index d0b86b3a43..70bf069ead 100644
--- 
a/oap-server/server-starter/src/main/resources/ui-initialized-templates/rabbitmq/rabbitmq-cluster.json
+++ 
b/oap-server/server-starter/src/main/resources/ui-initialized-templates/rabbitmq/rabbitmq-cluster.json
@@ -732,7 +732,32 @@
       "entity": "Service",
       "name": "RabbitMQ-Cluster",
       "id": "RabbitMQ-Cluster",
-      "isRoot": false
+      "isRoot": false,
+      "isDefault": true,
+      "expressions": [
+        "avg(meter_rabbitmq_messages_published)",
+        "avg(meter_rabbitmq_messages_unconfirmed)",
+        "avg(meter_rabbitmq_queues)",
+        "avg(meter_rabbitmq_channels)",
+        "avg(meter_rabbitmq_connections)"
+      ],
+      "expressionsConfig": [
+        {
+          "label": "messages published"
+        },
+        {
+          "label": "messages unconfirmed"
+        },
+        {
+          "label": "queues"
+        },
+        {
+          "label": "channels"
+        },
+        {
+          "label": "connections"
+        }
+      ]
     }
   }
 ]

Reply via email to