You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by wu...@apache.org on 2022/01/12 15:17:50 UTC
[skywalking] branch master updated: Add source layer and dest layer to relation (#8419)
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 250f92d Add source layer and dest layer to relation (#8419)
250f92d is described below
commit 250f92d09c054e71e464cc84603c0c0cdbdd8781
Author: zhang-wei <zh...@apache.org>
AuthorDate: Wed Jan 12 23:17:33 2022 +0800
Add source layer and dest layer to relation (#8419)
---
CHANGES.md | 1 +
docs/en/concepts-and-designs/scope-definitions.md | 84 +++++++++++-----------
.../listener/MultiScopesAnalysisListener.java | 2 +
.../trace/parser/listener/SourceBuilder.java | 4 ++
.../core/source/ServiceInstanceRelation.java | 7 ++
.../oap/server/core/source/ServiceRelation.java | 7 ++
6 files changed, 63 insertions(+), 42 deletions(-)
diff --git a/CHANGES.md b/CHANGES.md
index afcaadc..3858f55 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -25,6 +25,7 @@ Release Notes.
* Introduce new concept `Layer` and removed `NodeType`. More details refer to [v9-version-upgrade](https://skywalking.apache.org/docs/main/latest/en/faq/v9-version-upgrade/).
* Fix query sort metrics failure in H2 Storage.
* Bump up grpc to 1.43.2 and protobuf to 3.19.2 to fix CVE-2021-22569.
+* Add source layer and dest layer to relation.
#### UI
diff --git a/docs/en/concepts-and-designs/scope-definitions.md b/docs/en/concepts-and-designs/scope-definitions.md
index 00c9777..7bf9285 100644
--- a/docs/en/concepts-and-designs/scope-definitions.md
+++ b/docs/en/concepts-and-designs/scope-definitions.md
@@ -157,53 +157,53 @@ This calculates the metrics data from each request of the endpoint in the servic
This calculates the metrics data from each request between services.
-| Name | Remarks | Group Key | Type |
-|---|---|---|---|
-| sourceServiceName | The name of the source service. | | string |
-| sourceServiceNodeType | The type of node to which the Service or Network address belongs, such as Normal, Database, MQ, or Cache. | | enum |
-| sourceServiceInstanceName | The name of the source service instance. | | string |
-| destServiceName | The name of the destination service. | | string |
-| destServiceNodeType | The type of node of to which the Service or Network address belongs. | | enum |
-| destServiceInstanceName | The name of the destination service instance.| | string|
-| endpoint | The endpoint used in this call. | | string
-| componentId | The ID of component used in this call. | yes | string
-| latency | The time taken by each request. | | int |
-| status | Indicates the success or failure of the request.| | bool(true for success) |
-| ~~responseCode~~ | Deprecated.The response code of the HTTP response, and if this request is the HTTP call. E.g. 200, 404, 302| | int |
-| httpResponseStatusCode | The response code of the HTTP response, and if this request is the HTTP call. E.g. 200, 404, 302| | int |
-| rpcStatusCode | The string value of the rpc response code. | | string |
-| type | The type of each request, such as Database, HTTP, RPC, or gRPC. | | enum |
-| detectPoint | Where the relation is detected. The value may be client, server, or proxy. | yes | enum|
-| tlsMode | The TLS mode between source and destination services, such as `service_relation_mtls_cpm = from(ServiceRelation.*).filter(tlsMode == "mTLS").cpm()` || string|
-| sideCar.internalErrorCode | The sidecar/gateway proxy internal error code. The value is based on the implementation. | | string|
-| tcpInfo.receivedBytes | The received bytes of the TCP traffic, if this request is a TCP call. | | long |
-| tcpInfo.sentBytes | The sent bytes of the TCP traffic, if this request is a TCP call. | | long |
+| Name | Remarks | Group Key | Type |
+|---------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------|-----------|------------------------|
+| sourceServiceName | The name of the source service. | | string |
+| sourceServiceInstanceName | The name of the source service instance. | | string |
+| sourceLayer | The layer of the source service. | | enum |
+| destServiceName | The name of the destination service. | | string |
+| destServiceInstanceName | The name of the destination service instance. | | string |
+| destLayer | The layer of the destination service. | | enum |
+| endpoint | The endpoint used in this call. | | string |
+| componentId | The ID of component used in this call. | yes | string |
+| latency | The time taken by each request. | | int |
+| status | Indicates the success or failure of the request. | | bool(true for success) |
+| ~~responseCode~~ | Deprecated.The response code of the HTTP response, and if this request is the HTTP call. E.g. 200, 404, 302 | | int |
+| httpResponseStatusCode | The response code of the HTTP response, and if this request is the HTTP call. E.g. 200, 404, 302 | | int |
+| rpcStatusCode | The string value of the rpc response code. | | string |
+| type | The type of each request, such as Database, HTTP, RPC, or gRPC. | | enum |
+| detectPoint | Where the relation is detected. The value may be client, server, or proxy. | yes | enum |
+| tlsMode | The TLS mode between source and destination services, such as `service_relation_mtls_cpm = from(ServiceRelation.*).filter(tlsMode == "mTLS").cpm()` | | string |
+| sideCar.internalErrorCode | The sidecar/gateway proxy internal error code. The value is based on the implementation. | | string |
+| tcpInfo.receivedBytes | The received bytes of the TCP traffic, if this request is a TCP call. | | long |
+| tcpInfo.sentBytes | The sent bytes of the TCP traffic, if this request is a TCP call. | | long |
### SCOPE `ServiceInstanceRelation`
This calculates the metrics data from each request between service instances.
-| Name | Remarks | Group Key | Type |
-|---|---|---|---|
-| sourceServiceName | The name of the source service. | | string |
-| sourceServiceNodeType | The type of node to which the Service or Network address belongs, such as Normal, Database, MQ, or Cache. | | enum |
-| sourceServiceInstanceName | The name of the source service instance. | | string |
-| destServiceName | The name of the destination service. | | |
-| destServiceNodeType | The type of node to which the Service or Network address belongs, such as Normal, Database, MQ, or Cache. | | string |
-| destServiceInstanceName | The name of the destination service instance. | | string |
-| endpoint | The endpoint used in this call. | | string
-| componentId | The ID of the component used in this call. | yes | string
-| latency | The time taken by each request. | | int |
-| status | Indicates the success or failure of the request.| | bool(true for success) |
-| ~~responseCode~~ | Deprecated.The response code of the HTTP response, and if this request is the HTTP call. E.g. 200, 404, 302| | int |
-| httpResponseStatusCode | The response code of the HTTP response, and if this request is the HTTP call. E.g. 200, 404, 302| | int |
-| rpcStatusCode | The string value of the rpc response code. | | string |
-| type | The type of each request, such as Database, HTTP, RPC, or gRPC. | | enum |
-| detectPoint | Where the relation is detected. The value may be client, server, or proxy. | yes | enum|
-| tlsMode | The TLS mode between source and destination service instances, such as `service_instance_relation_mtls_cpm = from(ServiceInstanceRelation.*).filter(tlsMode == "mTLS").cpm()` || string|
-| sideCar.internalErrorCode | The sidecar/gateway proxy internal error code. The value is based on the implementation. | | string|
-| tcpInfo.receivedBytes | The received bytes of the TCP traffic, if this request is a TCP call. | | long |
-| tcpInfo.sentBytes | The sent bytes of the TCP traffic, if this request is a TCP call. | | long |
+| Name | Remarks | Group Key | Type |
+|---------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------|------------------------|
+| sourceServiceName | The name of the source service. | | string |
+| sourceServiceInstanceName | The name of the source service instance. | | string |
+| sourceServiceLayer | The layer of the source service. | | enum |
+| destServiceName | The name of the destination service. | | |
+| destServiceInstanceName | The name of the destination service instance. | | string |
+| destServiceLayer | The layer of the destination service. | | enum |
+| endpoint | The endpoint used in this call. | | string |
+| componentId | The ID of the component used in this call. | yes | string |
+| latency | The time taken by each request. | | int |
+| status | Indicates the success or failure of the request. | | bool(true for success) |
+| ~~responseCode~~ | Deprecated.The response code of the HTTP response, and if this request is the HTTP call. E.g. 200, 404, 302 | | int |
+| httpResponseStatusCode | The response code of the HTTP response, and if this request is the HTTP call. E.g. 200, 404, 302 | | int |
+| rpcStatusCode | The string value of the rpc response code. | | string |
+| type | The type of each request, such as Database, HTTP, RPC, or gRPC. | | enum |
+| detectPoint | Where the relation is detected. The value may be client, server, or proxy. | yes | enum |
+| tlsMode | The TLS mode between source and destination service instances, such as `service_instance_relation_mtls_cpm = from(ServiceInstanceRelation.*).filter(tlsMode == "mTLS").cpm()` || string | |
+| sideCar.internalErrorCode | The sidecar/gateway proxy internal error code. The value is based on the implementation. | | string |
+| tcpInfo.receivedBytes | The received bytes of the TCP traffic, if this request is a TCP call. | | long |
+| tcpInfo.sentBytes | The sent bytes of the TCP traffic, if this request is a TCP call. | | long |
### SCOPE `EndpointRelation`
diff --git a/oap-server/analyzer/agent-analyzer/src/main/java/org/apache/skywalking/oap/server/analyzer/provider/trace/parser/listener/MultiScopesAnalysisListener.java b/oap-server/analyzer/agent-analyzer/src/main/java/org/apache/skywalking/oap/server/analyzer/provider/trace/parser/listener/MultiScopesAnalysisListener.java
index 201a99f..b0fbe72 100644
--- a/oap-server/analyzer/agent-analyzer/src/main/java/org/apache/skywalking/oap/server/analyzer/provider/trace/parser/listener/MultiScopesAnalysisListener.java
+++ b/oap-server/analyzer/agent-analyzer/src/main/java/org/apache/skywalking/oap/server/analyzer/provider/trace/parser/listener/MultiScopesAnalysisListener.java
@@ -130,6 +130,7 @@ public class MultiScopesAnalysisListener implements EntryAnalysisListener, ExitA
sourceBuilder.setSourceServiceName(Const.USER_SERVICE_NAME);
sourceBuilder.setSourceServiceInstanceName(Const.USER_INSTANCE_NAME);
sourceBuilder.setSourceEndpointName(Const.USER_ENDPOINT_NAME);
+ sourceBuilder.setSourceLayer(Layer.UNDEFINED);
sourceBuilder.setSourceNormal(false);
sourceBuilder.setDestServiceInstanceName(segmentObject.getServiceInstance());
sourceBuilder.setDestServiceName(segmentObject.getService());
@@ -164,6 +165,7 @@ public class MultiScopesAnalysisListener implements EntryAnalysisListener, ExitA
sourceBuilder.setSourceServiceName(segmentObject.getService());
sourceBuilder.setSourceServiceInstanceName(segmentObject.getServiceInstance());
+ sourceBuilder.setSourceLayer(Layer.GENERAL);
final NetworkAddressAlias networkAddressAlias = networkAddressAliasCache.get(networkAddress);
if (networkAddressAlias == null) {
diff --git a/oap-server/analyzer/agent-analyzer/src/main/java/org/apache/skywalking/oap/server/analyzer/provider/trace/parser/listener/SourceBuilder.java b/oap-server/analyzer/agent-analyzer/src/main/java/org/apache/skywalking/oap/server/analyzer/provider/trace/parser/listener/SourceBuilder.java
index 24dfcb6..6a5869d 100644
--- a/oap-server/analyzer/agent-analyzer/src/main/java/org/apache/skywalking/oap/server/analyzer/provider/trace/parser/listener/SourceBuilder.java
+++ b/oap-server/analyzer/agent-analyzer/src/main/java/org/apache/skywalking/oap/server/analyzer/provider/trace/parser/listener/SourceBuilder.java
@@ -175,9 +175,11 @@ class SourceBuilder {
serviceRelation.setSourceServiceName(sourceServiceName);
serviceRelation.setSourceNormal(isSourceNormal);
serviceRelation.setSourceServiceInstanceName(sourceServiceInstanceName);
+ serviceRelation.setSourceLayer(sourceLayer);
serviceRelation.setDestServiceName(destServiceName);
serviceRelation.setDestNormal(isDestNormal);
serviceRelation.setDestServiceInstanceName(destServiceInstanceName);
+ serviceRelation.setDestLayer(destLayer);
serviceRelation.setEndpoint(destEndpointName);
serviceRelation.setComponentId(componentId);
serviceRelation.setLatency(latency);
@@ -225,9 +227,11 @@ class SourceBuilder {
serviceInstanceRelation.setSourceServiceName(sourceServiceName);
serviceInstanceRelation.setSourceServiceNormal(isSourceNormal);
serviceInstanceRelation.setSourceServiceInstanceName(sourceServiceInstanceName);
+ serviceInstanceRelation.setSourceServiceLayer(sourceLayer);
serviceInstanceRelation.setDestServiceName(destServiceName);
serviceInstanceRelation.setDestServiceNormal(isDestNormal);
serviceInstanceRelation.setDestServiceInstanceName(destServiceInstanceName);
+ serviceInstanceRelation.setDestServiceLayer(destLayer);
serviceInstanceRelation.setEndpoint(destEndpointName);
serviceInstanceRelation.setComponentId(componentId);
serviceInstanceRelation.setLatency(latency);
diff --git a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/source/ServiceInstanceRelation.java b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/source/ServiceInstanceRelation.java
index 65de5a4..fccf360 100644
--- a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/source/ServiceInstanceRelation.java
+++ b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/source/ServiceInstanceRelation.java
@@ -20,6 +20,7 @@ package org.apache.skywalking.oap.server.core.source;
import lombok.Getter;
import lombok.Setter;
+import org.apache.skywalking.oap.server.core.analysis.Layer;
import org.apache.skywalking.oap.server.library.util.StringUtil;
import org.apache.skywalking.oap.server.core.analysis.IDManager;
@@ -57,6 +58,9 @@ public class ServiceInstanceRelation extends Source {
@Setter
@ScopeDefaultColumn.DefinedByField(columnName = "source_service_name", requireDynamicActive = true)
private String sourceServiceName;
+ @Getter
+ @Setter
+ private Layer sourceServiceLayer;
@Setter
private boolean isSourceServiceNormal;
@Getter
@@ -67,6 +71,9 @@ public class ServiceInstanceRelation extends Source {
private String destServiceInstanceId;
@Getter
private String destServiceId;
+ @Getter
+ @Setter
+ private Layer destServiceLayer;
@Setter
private boolean isDestServiceNormal;
@Getter
diff --git a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/source/ServiceRelation.java b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/source/ServiceRelation.java
index e256fdd..4cf78e3 100644
--- a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/source/ServiceRelation.java
+++ b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/source/ServiceRelation.java
@@ -20,6 +20,7 @@ package org.apache.skywalking.oap.server.core.source;
import lombok.Getter;
import lombok.Setter;
+import org.apache.skywalking.oap.server.core.analysis.Layer;
import org.apache.skywalking.oap.server.library.util.StringUtil;
import org.apache.skywalking.oap.server.core.analysis.IDManager;
@@ -61,11 +62,17 @@ public class ServiceRelation extends Source {
@Setter
private String sourceServiceInstanceName;
@Getter
+ @Setter
+ private Layer sourceLayer;
+ @Getter
private String destServiceId;
@Getter
@Setter
@ScopeDefaultColumn.DefinedByField(columnName = "dest_name", requireDynamicActive = true)
private String destServiceName;
+ @Getter
+ @Setter
+ private Layer destLayer;
@Setter
private boolean isDestNormal;
@Getter