Back to Skywalking

Service Hierarchy

docs/en/concepts-and-designs/service-hierarchy.md

10.4.013.5 KB
Original Source

Service Hierarchy

SkyWalking v10 introduces a new concept Service Hierarchy which defines the relationships of existing logically same services in various layers. OAP will detect the services from different layers, and try to build the connections.

Detect Service Hierarchy Connections

There 2 ways to detect the connections:

  1. Automatically matching through OAP internal mechanism, no extra work is required.
  2. Build the connections through specific agents.

Note: All the relationships and auto-matching rules should be defined in the config/hierarchy-definition.yml file. If you want to customize it according to your own needs, please refer to Service Hierarchy Configuration.

Automatically Matching

Upper layerLower layerMatching rule
GENERALK8S_SERVICEGENERAL On K8S_SERVICE
GENERALAPISIXGENERAL On APISIX
VIRTUAL_DATABASEMYSQLVIRTUAL_DATABASE On MYSQL
VIRTUAL_DATABASEPOSTGRESQLVIRTUAL_DATABASE On POSTGRESQL
VIRTUAL_DATABASECLICKHOUSEVIRTUAL_DATABASE On CLICKHOUSE
VIRTUAL_MQRABBITMQVIRTUAL_MQ On RABBITMQ
VIRTUAL_MQROCKETMQVIRTUAL_MQ On K8S_SERVICE
VIRTUAL_MQKAFKAVIRTUAL_MQ On KAFKA
VIRTUAL_MQRABBITMQVIRTUAL_MQ On RABBITMQ
VIRTUAL_MQPULSARVIRTUAL_MQ On PULSAR
MESHMESH_DPMESH On MESH_DP
MESHK8S_SERVICEMESH On K8S_SERVICE
MESH_DPK8S_SERVICEMESH_DP On K8S_SERVICE
MYSQLK8S_SERVICEMYSQL On K8S_SERVICE
POSTGRESQLK8S_SERVICEPOSTGRESQL On K8S_SERVICE
CLICKHOUSEK8S_SERVICECLICKHOUSE On K8S_SERVICE
NGINXK8S_SERVICENGINX On K8S_SERVICE
APISIXK8S_SERVICEAPISIX On K8S_SERVICE
ROCKETMQK8S_SERVICEROCKETMQ On K8S_SERVICE
RABBITMQK8S_SERVICERABBITMQ On K8S_SERVICE
KAFKAK8S_SERVICEKAFKA On K8S_SERVICE
PULSARK8S_SERVICEPULSAR On K8S_SERVICE
SO11Y_OAPK8S_SERVICESO11Y_OAP On K8S_SERVICE
KONGK8S_SERVICEKONG 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 default deployment.
  • In SkyWalking the service name could be composed of group and short name with :: separator.

GENERAL On K8S_SERVICE

  • Rule name: lower-short-name-remove-ns
  • Matching expression: { (u, l) -> u.shortName == l.shortName.substring(0, l.shortName.lastIndexOf('.')) }
  • Description: GENERAL.service.shortName == K8S_SERVICE.service.shortName without namespace
  • Matched Example:
    • GENERAL.service.name: agent::songs
    • K8S_SERVICE.service.name: skywalking-showcase::songs.sample-services

GENERAL On APISIX

  • Rule name: lower-short-name-remove-ns
  • Matching expression: { (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

VIRTUAL_DATABASE On MYSQL

  • Rule name: lower-short-name-with-fqdn
  • Matching expression: { (u, l) -> u.shortName.substring(0, u.shortName.lastIndexOf(':')) == l.shortName.concat('.svc.cluster.local') }
  • Description: VIRTUAL_DATABASE.service.shortName remove port == MYSQL.service.shortName with fqdn suffix
  • Matched Example:
    • VIRTUAL_DATABASE.service.name: mysql.skywalking-showcase.svc.cluster.local:3306
    • MYSQL.service.name: mysql::mysql.skywalking-showcase

VIRTUAL_DATABASE On POSTGRESQL

  • Rule name: lower-short-name-with-fqdn
  • Matching expression: { (u, l) -> u.shortName.substring(0, u.shortName.lastIndexOf(':')) == l.shortName.concat('.svc.cluster.local') }
  • Description: VIRTUAL_DATABASE.service.shortName remove port == POSTGRESQL.service.shortName with fqdn suffix
  • Matched Example:
    • VIRTUAL_DATABASE.service.name: psql.skywalking-showcase.svc.cluster.local:5432
    • POSTGRESQL.service.name: postgresql::psql.skywalking-showcase

VIRTUAL_DATABASE On CLICKHOUSE

  • Rule name: lower-short-name-with-fqdn
  • Matching expression: { (u, l) -> u.shortName.substring(0, u.shortName.lastIndexOf(':')) == l.shortName.concat('.svc.cluster.local') }
  • Description: VIRTUAL_DATABASE.service.shortName remove port == CLICKHOUSE.service.shortName with fqdn suffix
  • Matched Example:
    • VIRTUAL_DATABASE.service.name: clickhouse.skywalking-showcase.svc.cluster.local:8123
    • CLICKHOUSE.service.name: clickhouse::clickhouse.skywalking-showcase

VIRTUAL_MQ On ROCKETMQ

  • Rule name: lower-short-name-with-fqdn
  • Matching expression: { (u, l) -> u.shortName.substring(0, u.shortName.lastIndexOf(':')) == l.shortName.concat('.svc.cluster.local') }
  • Description: VIRTUAL_MQ.service.shortName remove port == ROCKETMQ.service.shortName with fqdn suffix
  • Matched Example:
    • VIRTUAL_MQ.service.name: rocketmq.skywalking-showcase.svc.cluster.local:9876
    • ROCKETMQ.service.name: rocketmq::rocketmq.skywalking-showcase

VIRTUAL_MQ On RABBITMQ

  • Rule name: lower-short-name-with-fqdn
  • Matching expression: { (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

VIRTUAL_MQ On KAFKA

  • Rule name: lower-short-name-with-fqdn
  • Matching expression: { (u, l) -> u.shortName.substring(0, u.shortName.lastIndexOf(':')) == l.shortName.concat('.svc.cluster.local') }
  • Description: VIRTUAL_MQ.service.shortName remove port == KAFKA.service.shortName with fqdn suffix
  • Matched Example:
    • VIRTUAL_MQ.service.name: kafka.skywalking-showcase.svc.cluster.local:9092
    • KAFKA.service.name: kafka::rocketmq.skywalking-showcase

VIRTUAL_MQ On PULSAR

  • Rule name: lower-short-name-with-fqdn
  • Matching expression: { (u, l) -> u.shortName.substring(0, u.shortName.lastIndexOf(':')) == l.shortName.concat('.svc.cluster.local') }
  • Description: VIRTUAL_MQ.service.shortName remove port == PULSAR.service.shortName with fqdn suffix
  • Matched Example:
    • VIRTUAL_MQ.service.name: pulsar.skywalking-showcase.svc.cluster.local:6650
    • PULSAR.service.name: pulsar::pulsar.skywalking-showcase

MESH On MESH_DP

  • Rule name: name
  • Matching expression: { (u, l) -> u.name == l.name }
  • Description: MESH.service.name == MESH_DP.service.name
  • Matched Example:
    • MESH.service.name: mesh-svr::songs.sample-services
    • MESH_DP.service.name: mesh-svr::songs.sample-services

MESH On K8S_SERVICE

  • Rule name: short-name
  • Matching expression: { (u, l) -> u.shortName == l.shortName }
  • Description: MESH.service.shortName == K8S_SERVICE.service.shortName
  • Matched Example:
    • MESH.service.name: mesh-svr::songs.sample-services
    • K8S_SERVICE.service.name: skywalking-showcase::songs.sample-services

MESH_DP On K8S_SERVICE

  • Rule name: short-name
  • Matching expression: { (u, l) -> u.shortName == l.shortName }
  • Description: MESH_DP.service.shortName == K8S_SERVICE.service.shortName
  • Matched Example:
    • MESH_DP.service.name: mesh-svr::songs.sample-services
    • K8S_SERVICE.service.name: skywalking-showcase::songs.sample-services

MYSQL On K8S_SERVICE

  • Rule name: short-name
  • Matching expression: { (u, l) -> u.shortName == l.shortName }
  • Description: MYSQL.service.shortName == K8S_SERVICE.service.shortName
  • Matched Example:
    • MYSQL.service.name: mysql::mysql.skywalking-showcase
    • K8S_SERVICE.service.name: skywalking-showcase::mysql.skywalking-showcase

POSTGRESQL On K8S_SERVICE

  • Rule name: short-name
  • Matching expression: { (u, l) -> u.shortName == l.shortName }
  • Description: POSTGRESQL.service.shortName == K8S_SERVICE.service.shortName
  • Matched Example:
    • POSTGRESQL.service.name: postgresql::psql.skywalking-showcase
    • K8S_SERVICE.service.name: skywalking-showcase::psql.skywalking-showcase

CLICKHOUSE On K8S_SERVICE

  • Rule name: short-name
  • Matching expression: { (u, l) -> u.shortName == l.shortName }
  • Description: CLICKHOUSE.service.shortName == K8S_SERVICE.service.shortName
  • Matched Example:
    • CLICKHOUSE.service.name: clickhouse::clickhouse.skywalking-showcase
    • K8S_SERVICE.service.name: skywalking-showcase::clickhouse.skywalking-showcase

NGINX On K8S_SERVICE

  • Rule name: short-name
  • Matching expression: { (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
  • Matching expression: { (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

ROCKETMQ On K8S_SERVICE

  • Rule name: short-name
  • Matching expression: { (u, l) -> u.shortName == l.shortName }
  • Description: ROCKETMQ.service.shortName == K8S_SERVICE.service.shortName
  • Matched Example:
    • ROCKETMQ.service.name: rocketmq::rocketmq.skywalking-showcase
    • K8S_SERVICE.service.name: skywalking-showcase::rocketmq.skywalking-showcase

RABBITMQ On K8S_SERVICE

  • Rule name: short-name
  • Matching expression: { (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

KAFKA On K8S_SERVICE

  • Rule name: short-name
  • Matching expression: { (u, l) -> u.shortName == l.shortName }
  • Description: KAFKA.service.shortName == K8S_SERVICE.service.shortName
  • Matched Example:
    • KAFKA.service.name: kafka::kafka.skywalking-showcase
    • K8S_SERVICE.service.name: skywalking-showcase::kafka.skywalking-showcase

PULSAR On K8S_SERVICE

  • Rule name: short-name
  • Matching expression: { (u, l) -> u.shortName == l.shortName }
  • Description: PULSAR.service.shortName == K8S_SERVICE.service.shortName
  • Matched Example:
    • PULSAR.service.name: pulsar::pulsar.skywalking-showcase
    • K8S_SERVICE.service.name: skywalking-showcase::pulsar.skywalking-showcase

SO11Y_OAP On K8S_SERVICE

  • Rule name: short-name
  • Matching expression: { (u, l) -> u.shortName == l.shortName }
  • Description: SO11Y_OAP.service.shortName == K8S_SERVICE.service.shortName
  • Matched Example:
    • SO11Y_OAP.service.name: demo-oap.skywalking-showcase
    • K8S_SERVICE.service.name: skywalking-showcase::demo-oap.skywalking-showcase

KONG On K8S_SERVICE

  • Rule name: short-name
  • Matching expression: { (u, l) -> u.shortName == l.shortName }
  • Description: KONG.service.shortName == K8S_SERVICE.service.shortName
  • Matched Example:
    • KONG.service.name: kong::kong.skywalking-showcase
    • K8S_SERVICE.service.name: skywalking-showcase::kong.skywalking-showcase

Build Through Specific Agents

Use agent tech involved(such as eBPF) and deployment tools(such as operator and agent injector) to detect the service hierarchy relations.

Upper layerLower layerAgent

Instance Hierarchy

Instance Hierarchy relationship follows the same definition as Service Hierarchy.

Automatically Matching

If the service hierarchy is built, the instance hierarchy relationship could be detected automatically through the following rules:

  1. The upper instance name equals the lower instance name.
  2. The upper instance attribute pod/hostname equals the lower instance attribute pod/hostname.
  3. The upper instance attribute pod/hostname equals the lower instance name.
  4. The upper instance name equals the lower instance attribute pod/hostname.

Build Through Specific Agents