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 78d9e33f10 Add hierarchy relations auto-matching for NGINX/APISIX. (#11870) 78d9e33f10 is described below commit 78d9e33f10bb6be2a22396fd2d082f1c338952f3 Author: Wan Kai <wankai...@foxmail.com> AuthorDate: Mon Feb 5 18:59:31 2024 +0800 Add hierarchy relations auto-matching for NGINX/APISIX. (#11870) Fix `Nginx-Instance` metrics to instance level. --- docs/en/changes/changes.md | 5 +++ docs/en/concepts-and-designs/service-hierarchy.md | 49 +++++++++++++++++----- .../src/main/resources/hierarchy-definition.yml | 9 ++++ .../apisix/apisix-endpoint.json | 3 +- .../apisix/apisix-instance.json | 35 ++++++++++++++-- .../apisix/apisix-root.json | 3 +- .../apisix/apisix-service.json | 35 ++++++++++++++-- .../browser/browser-app.json | 3 +- .../mesh_dp/mesh-data-plane-service.json | 3 +- .../nginx/nginx-endpoint.json | 5 +-- .../nginx/nginx-instance.json | 39 ++++++++++++----- .../ui-initialized-templates/nginx/nginx-root.json | 5 +-- .../nginx/nginx-service.json | 27 ++++++++++-- .../virtual_mq/virtual-mq-service.json | 3 +- 14 files changed, 180 insertions(+), 44 deletions(-) diff --git a/docs/en/changes/changes.md b/docs/en/changes/changes.md index 089a7de970..371964a6bc 100644 --- a/docs/en/changes/changes.md +++ b/docs/en/changes/changes.md @@ -40,6 +40,10 @@ - VIRTUAL_DATABASE -> POSTGRESQL * Add Golang as a supported language for AMQP. * Support available layers of service in the topology. +* Add Service Hierarchy auto matching layer relationships (upper -> lower) as following: + - NGINX -> K8S_SERVICE + - APISIX -> K8S_SERVICE + - GENERAL -> APISIX #### UI @@ -62,6 +66,7 @@ * Add the not found page(404). * Enhance VNode logic and support multiple Trace IDs in span's ref. * Add the layers filed and associate layers dashboards for the service topology nodes. +* Fix `Nginx-Instance` metrics to instance level. #### Documentation diff --git a/docs/en/concepts-and-designs/service-hierarchy.md b/docs/en/concepts-and-designs/service-hierarchy.md index e1be329ef8..7642f81e4d 100644 --- a/docs/en/concepts-and-designs/service-hierarchy.md +++ b/docs/en/concepts-and-designs/service-hierarchy.md @@ -11,17 +11,20 @@ There 2 ways to detect the connections: If you want to customize it according to your own needs, please refer to [Service Hierarchy Configuration](service-hierarchy-configuration.md). ### Automatically Matching -| Upper layer | Lower layer | Matching rule | -|-------------------|--------------|-------------------------------------------------------------------| -| MESH | MESH_DP | [MESH On MESH_DP](#mesh-on-mesh_dp) | -| MESH | K8S_SERVICE | [MESH On K8S_SERVICE](#mesh-on-k8s_service) | -| MESH_DP | K8S_SERVICE | [MESH_DP On K8S_SERVICE](#mesh_dp-on-k8s_service) | -| GENERAL | K8S_SERVICE | [GENERAL On K8S_SERVICE](#general-on-k8s_service) | -| MYSQL | K8S_SERVICE | [MYSQL On K8S_SERVICE](#mysql-on-k8s_service) | -| POSTGRESQL | K8S_SERVICE | [POSTGRESQL On K8S_SERVICE](#postgresql-on-k8s_service) | -| SO11Y_OAP | K8S_SERVICE | [SO11Y_OAP On K8S_SERVICE](#so11y_oap-on-k8s_service) | -| VIRTUAL_DATABASE | MYSQL | [VIRTUAL_DATABASE On MYSQL](#virtual_database-on-mysql) | -| VIRTUAL_DATABASE | POSTGRESQL | [VIRTUAL_DATABASE On POSTGRESQL](#virtual_database-on-postgresql) | +| Upper layer | Lower layer | Matching rule | +|-------------------|-------------|-------------------------------------------------------------------| +| MESH | MESH_DP | [MESH On MESH_DP](#mesh-on-mesh_dp) | +| MESH | K8S_SERVICE | [MESH On K8S_SERVICE](#mesh-on-k8s_service) | +| MESH_DP | K8S_SERVICE | [MESH_DP On K8S_SERVICE](#mesh_dp-on-k8s_service) | +| GENERAL | K8S_SERVICE | [GENERAL On K8S_SERVICE](#general-on-k8s_service) | +| GENERAL | APISIX | [GENERAL On APISIX](#general-on-apisix) | +| MYSQL | K8S_SERVICE | [MYSQL On K8S_SERVICE](#mysql-on-k8s_service) | +| POSTGRESQL | K8S_SERVICE | [POSTGRESQL On K8S_SERVICE](#postgresql-on-k8s_service) | +| SO11Y_OAP | K8S_SERVICE | [SO11Y_OAP On K8S_SERVICE](#so11y_oap-on-k8s_service) | +| VIRTUAL_DATABASE | MYSQL | [VIRTUAL_DATABASE On MYSQL](#virtual_database-on-mysql) | +| VIRTUAL_DATABASE | POSTGRESQL | [VIRTUAL_DATABASE On POSTGRESQL](#virtual_database-on-postgresql) | +| NGINX | K8S_SERVICE | [NGINX On K8S_SERVICE](#nginx-on-k8s_service) | +| APISIX | K8S_SERVICE | [APISIX On K8S_SERVICE](#apisix-on-k8s_service) | - 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. @@ -59,6 +62,14 @@ If you want to customize it according to your own needs, please refer to [Servic - GENERAL.service.name: `agent::songs` - K8S_SERVICE.service.name: `skywalking-showcase::songs.sample-services` +#### GENERAL On APISIX +- Rule name: `lower-short-name-remove-ns` +- Groovy script: `{ (u, l) -> u.shortName == l.shortName.substring(0, l.shortName.lastIndexOf('.')) }` +- Description: GENERAL.service.shortName == APISIX.service.shortName without namespace +- Matched Example: + - GENERAL.service.name: `agent::frontend` + - APISIX.service.name: `APISIX::frontend.sample-services` + #### MYSQL On K8S_SERVICE - Rule name: `short-name` - Groovy script: `{ (u, l) -> u.shortName == l.shortName }` @@ -99,6 +110,22 @@ If you want to customize it according to your own needs, please refer to [Servic - VIRTUAL_DATABASE.service.name: `psql.skywalking-showcase.svc.cluster.local:5432` - POSTGRESQL.service.name: `postgresql::psql.skywalking-showcase` +#### NGINX On K8S_SERVICE +- Rule name: `short-name` +- Groovy script: `{ (u, l) -> u.shortName == l.shortName }` +- Description: NGINX.service.shortName == K8S_SERVICE.service.shortName +- Matched Example: + - NGINX.service.name: `nginx::nginx.skywalking-showcase` + - K8S_SERVICE.service.name: `skywalking-showcase::nginx.skywalking-showcase` + +#### APISIX On K8S_SERVICE +- Rule name: `short-name` +- Groovy script: `{ (u, l) -> u.shortName == l.shortName }` +- Description: APISIX.service.shortName == K8S_SERVICE.service.shortName +- Matched Example: + - APISIX.service.name: `APISIX::frontend.sample-services` + - K8S_SERVICE.service.name: `skywalking-showcase::frontend.sample-services` + ### 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 1847c7f873..5a7cf115e9 100644 --- a/oap-server/server-starter/src/main/resources/hierarchy-definition.yml +++ b/oap-server/server-starter/src/main/resources/hierarchy-definition.yml @@ -27,6 +27,7 @@ hierarchy: K8S_SERVICE: short-name GENERAL: + APISIX: lower-short-name-remove-ns K8S_SERVICE: lower-short-name-remove-ns MYSQL: @@ -35,6 +36,12 @@ hierarchy: POSTGRESQL: K8S_SERVICE: short-name + APISIX: + K8S_SERVICE: short-name + + NGINX: + K8S_SERVICE: short-name + SO11Y_OAP: K8S_SERVICE: short-name @@ -66,6 +73,8 @@ layer-levels: MYSQL: 2 POSTGRESQL: 2 + APISIX: 2 + NGINX: 2 MESH_DP: 1 diff --git a/oap-server/server-starter/src/main/resources/ui-initialized-templates/apisix/apisix-endpoint.json b/oap-server/server-starter/src/main/resources/ui-initialized-templates/apisix/apisix-endpoint.json index e0dcd55a99..80e63ae651 100644 --- a/oap-server/server-starter/src/main/resources/ui-initialized-templates/apisix/apisix-endpoint.json +++ b/oap-server/server-starter/src/main/resources/ui-initialized-templates/apisix/apisix-endpoint.json @@ -1,7 +1,7 @@ [ { - "id": "apisix-Endpoint", + "id": "APISIX-Endpoint", "configuration": { "children": [ { @@ -120,7 +120,6 @@ "layer": "APISIX", "entity": "Endpoint", "name": "APISIX-Endpoint", - "id": "apisix-Endpoint", "isRoot": false } } diff --git a/oap-server/server-starter/src/main/resources/ui-initialized-templates/apisix/apisix-instance.json b/oap-server/server-starter/src/main/resources/ui-initialized-templates/apisix/apisix-instance.json index 65bf30a372..f288e8892b 100644 --- a/oap-server/server-starter/src/main/resources/ui-initialized-templates/apisix/apisix-instance.json +++ b/oap-server/server-starter/src/main/resources/ui-initialized-templates/apisix/apisix-instance.json @@ -1,7 +1,7 @@ [ { - "id": "apisix-Instance", + "id": "APISIX-Instance", "configuration": { "children": [ { @@ -528,8 +528,37 @@ "layer": "APISIX", "entity": "ServiceInstance", "name": "APISIX-Instance", - "id": "apisix-Instance", - "isRoot": false + "isRoot": false, + "isDefault": true, + "expressions": [ + "avg(meter_apisix_instance_http_status_matched{_='200'})", + "avg(meter_apisix_instance_http_status_matched{_='304'})", + "avg(meter_apisix_instance_http_status_matched{_='404'})", + "avg(meter_apisix_instance_http_status_matched{_='499'})", + "avg(meter_apisix_instance_http_status_matched{_='503'})" + ], + "expressionsConfig": [ + { + "unit": "req / s", + "label": "HTTP Status 200" + }, + { + "unit": "req / s", + "label": "HTTP Status 304" + }, + { + "unit": "req / s", + "label": "HTTP Status 404" + }, + { + "unit": "req / s", + "label": "HTTP Status 499" + }, + { + "unit": "req / s", + "label": "HTTP Status 503" + } + ] } } ] diff --git a/oap-server/server-starter/src/main/resources/ui-initialized-templates/apisix/apisix-root.json b/oap-server/server-starter/src/main/resources/ui-initialized-templates/apisix/apisix-root.json index 7137533693..fc7207425b 100644 --- a/oap-server/server-starter/src/main/resources/ui-initialized-templates/apisix/apisix-root.json +++ b/oap-server/server-starter/src/main/resources/ui-initialized-templates/apisix/apisix-root.json @@ -1,7 +1,7 @@ [ { - "id":"apisix-root", + "id":"APISIX-Root", "configuration":{ "children":[ { @@ -37,7 +37,6 @@ } } ], - "id":"apisix-root", "layer":"APISIX", "entity":"All", "name":"APISIX-Root", diff --git a/oap-server/server-starter/src/main/resources/ui-initialized-templates/apisix/apisix-service.json b/oap-server/server-starter/src/main/resources/ui-initialized-templates/apisix/apisix-service.json index 0af81253f1..2068ddbf49 100644 --- a/oap-server/server-starter/src/main/resources/ui-initialized-templates/apisix/apisix-service.json +++ b/oap-server/server-starter/src/main/resources/ui-initialized-templates/apisix/apisix-service.json @@ -1,7 +1,7 @@ [ { - "id": "apisix-service", + "id": "APISIX-Service", "configuration": { "children": [ { @@ -413,8 +413,37 @@ "layer": "APISIX", "entity": "Service", "name": "APISIX-Service", - "id": "apisix-service", - "isRoot": false + "isRoot": false, + "isDefault": true, + "expressions": [ + "avg(meter_apisix_sv_http_status_matched{_='200'})", + "avg(meter_apisix_sv_http_status_matched{_='304'})", + "avg(meter_apisix_sv_http_status_matched{_='404'})", + "avg(meter_apisix_sv_http_status_matched{_='499'})", + "avg(meter_apisix_sv_http_status_matched{_='503'})" + ], + "expressionsConfig": [ + { + "unit": "req / s", + "label": "HTTP Status 200" + }, + { + "unit": "req / s", + "label": "HTTP Status 304" + }, + { + "unit": "req / s", + "label": "HTTP Status 404" + }, + { + "unit": "req / s", + "label": "HTTP Status 499" + }, + { + "unit": "req / s", + "label": "HTTP Status 503" + } + ] } } ] diff --git a/oap-server/server-starter/src/main/resources/ui-initialized-templates/browser/browser-app.json b/oap-server/server-starter/src/main/resources/ui-initialized-templates/browser/browser-app.json index 4d3a53455b..aefffd1519 100644 --- a/oap-server/server-starter/src/main/resources/ui-initialized-templates/browser/browser-app.json +++ b/oap-server/server-starter/src/main/resources/ui-initialized-templates/browser/browser-app.json @@ -427,7 +427,8 @@ "entity": "Service", "name": "Browser-App", "id": "Browser-app", - "isRoot": false + "isRoot": false, + "isDefault": true } } ] diff --git a/oap-server/server-starter/src/main/resources/ui-initialized-templates/mesh_dp/mesh-data-plane-service.json b/oap-server/server-starter/src/main/resources/ui-initialized-templates/mesh_dp/mesh-data-plane-service.json index 23c0c86083..ab8436be03 100644 --- a/oap-server/server-starter/src/main/resources/ui-initialized-templates/mesh_dp/mesh-data-plane-service.json +++ b/oap-server/server-starter/src/main/resources/ui-initialized-templates/mesh_dp/mesh-data-plane-service.json @@ -92,7 +92,8 @@ "entity": "Service", "name": "Mesh-Data-Plane-Service", "id": "Mesh-Data-Plane-Service", - "isRoot": false + "isRoot": false, + "isDefault": true } } ] diff --git a/oap-server/server-starter/src/main/resources/ui-initialized-templates/nginx/nginx-endpoint.json b/oap-server/server-starter/src/main/resources/ui-initialized-templates/nginx/nginx-endpoint.json index 4d53d0d025..2cec1e7bf0 100644 --- a/oap-server/server-starter/src/main/resources/ui-initialized-templates/nginx/nginx-endpoint.json +++ b/oap-server/server-starter/src/main/resources/ui-initialized-templates/nginx/nginx-endpoint.json @@ -1,6 +1,6 @@ [ { - "id": "nginx-Endpoint", + "id": "Nginx-Endpoint", "configuration": { "children": [ { @@ -159,8 +159,7 @@ "layer": "NGINX", "entity": "Endpoint", "name": "Nginx-Endpoint", - "id": "nginx-Endpoint", "isRoot": false } } -] \ No newline at end of file +] diff --git a/oap-server/server-starter/src/main/resources/ui-initialized-templates/nginx/nginx-instance.json b/oap-server/server-starter/src/main/resources/ui-initialized-templates/nginx/nginx-instance.json index c86c9d1a69..fe0d9eca0a 100644 --- a/oap-server/server-starter/src/main/resources/ui-initialized-templates/nginx/nginx-instance.json +++ b/oap-server/server-starter/src/main/resources/ui-initialized-templates/nginx/nginx-instance.json @@ -1,6 +1,6 @@ [ { - "id": "nginx-Instance", + "id": "Nginx-Instance", "configuration": { "children": [ { @@ -22,7 +22,7 @@ "showYAxis": true }, "expressions": [ - "meter_nginx_service_http_requests" + "meter_nginx_instance_http_requests" ], "metricMode": "Expression", "typesOfMQE": [ @@ -48,7 +48,7 @@ "showYAxis": true }, "expressions": [ - "meter_nginx_service_http_latency" + "meter_nginx_instance_http_latency" ], "metricMode": "Expression", "typesOfMQE": [ @@ -74,7 +74,7 @@ "showYAxis": true }, "expressions": [ - "meter_nginx_service_http_bandwidth/1024" + "meter_nginx_instance_http_bandwidth/1024" ], "metricMode": "Expression", "typesOfMQE": [ @@ -89,7 +89,7 @@ "i": "4", "type": "Widget", "expressions": [ - "meter_nginx_service_http_connections" + "meter_nginx_instance_http_connections" ], "metricMode": "Expression", "typesOfMQE": [ @@ -126,7 +126,7 @@ "showYAxis": true }, "expressions": [ - "meter_nginx_service_http_status" + "meter_nginx_instance_http_status" ], "metricMode": "Expression", "typesOfMQE": [ @@ -166,7 +166,7 @@ "type": "Widget", "metricMode": "Expression", "expressions": [ - "(meter_nginx_service_http_5xx_requests_increment/meter_nginx_service_http_requests_increment)*100" + "(meter_nginx_instance_http_5xx_requests_increment/meter_nginx_instance_http_requests_increment)*100" ], "typesOfMQE": [ "TIME_SERIES_VALUES" @@ -207,8 +207,27 @@ "layer": "NGINX", "entity": "ServiceInstance", "name": "Nginx-Instance", - "id": "nginx-Instance", - "isRoot": false + "isRoot": false, + "isDefault": true, + "expressions": [ + "avg(meter_nginx_instance_http_status{_='200'})", + "avg(meter_nginx_instance_http_status{_='404'})", + "avg(meter_nginx_instance_http_status{_='500'})" + ], + "expressionsConfig": [ + { + "unit": "req / s", + "label": "HTTP Status 200" + }, + { + "unit": "req / s", + "label": "HTTP Status 404" + }, + { + "unit": "req / s", + "label": "HTTP Status 500" + } + ] } } -] \ No newline at end of file +] diff --git a/oap-server/server-starter/src/main/resources/ui-initialized-templates/nginx/nginx-root.json b/oap-server/server-starter/src/main/resources/ui-initialized-templates/nginx/nginx-root.json index d47041c1e5..c5b2a6f8ae 100644 --- a/oap-server/server-starter/src/main/resources/ui-initialized-templates/nginx/nginx-root.json +++ b/oap-server/server-starter/src/main/resources/ui-initialized-templates/nginx/nginx-root.json @@ -1,6 +1,6 @@ [ { - "id": "nginx-root", + "id": "Nginx-Root", "configuration": { "children": [ { @@ -36,7 +36,6 @@ } } ], - "id": "nginx-root", "layer": "NGINX", "entity": "All", "name": "Nginx-Root", @@ -44,4 +43,4 @@ "path": "/Gateway/Nginx" } } -] \ No newline at end of file +] diff --git a/oap-server/server-starter/src/main/resources/ui-initialized-templates/nginx/nginx-service.json b/oap-server/server-starter/src/main/resources/ui-initialized-templates/nginx/nginx-service.json index c2f8f57a37..59b83f6c8c 100644 --- a/oap-server/server-starter/src/main/resources/ui-initialized-templates/nginx/nginx-service.json +++ b/oap-server/server-starter/src/main/resources/ui-initialized-templates/nginx/nginx-service.json @@ -1,6 +1,6 @@ [ { - "id": "nginx-service", + "id": "Nginx-Service", "configuration": { "children": [ { @@ -287,8 +287,27 @@ "layer": "NGINX", "entity": "Service", "name": "Nginx-Service", - "id": "nginx-service", - "isRoot": false + "isRoot": false, + "isDefault": true, + "expressions": [ + "avg(meter_nginx_service_http_status{_='200'})", + "avg(meter_nginx_service_http_status{_='404'})", + "avg(meter_nginx_service_http_status{_='500'})" + ], + "expressionsConfig": [ + { + "unit": "req / s", + "label": "HTTP Status 200" + }, + { + "unit": "req / s", + "label": "HTTP Status 404" + }, + { + "unit": "req / s", + "label": "HTTP Status 500" + } + ] } } -] \ No newline at end of file +] diff --git a/oap-server/server-starter/src/main/resources/ui-initialized-templates/virtual_mq/virtual-mq-service.json b/oap-server/server-starter/src/main/resources/ui-initialized-templates/virtual_mq/virtual-mq-service.json index 4aae7fb7fe..cb43879df6 100644 --- a/oap-server/server-starter/src/main/resources/ui-initialized-templates/virtual_mq/virtual-mq-service.json +++ b/oap-server/server-starter/src/main/resources/ui-initialized-templates/virtual_mq/virtual-mq-service.json @@ -377,7 +377,8 @@ "entity": "Service", "name": "Virtual-MQ-Service", "id": "Virtual-MQ-Service", - "isRoot": false + "isRoot": false, + "isDefault": true } } ]